Skip to content

Commit dc6a70f

Browse files
authored
Merge pull request hollie#862 from appzer/stable
Update Pushsafer.pm
2 parents b1555ec + 0624dc9 commit dc6a70f

File tree

1 file changed

+46
-13
lines changed

1 file changed

+46
-13
lines changed

lib/Pushsafer.pm

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,19 @@ Configure the required pushsafer settings in your mh.private.ini file:
1313
Pushsafer_t = "MisterHouse" Default title for messages if none provided
1414
Pushsafer_d = <Default device or device group id to send notifications to>
1515
Pushsafer_i = <Default icon>
16+
Pushsafer_c = <Default iconcolor>
1617
Pushsafer_s = <Default sound>
1718
Pushsafer_v = <Default vibration>
19+
Pushsafer_l = <Default time2live>
20+
Pushsafer_u = <Default url>
21+
Pushsafer_ut = <Default urltitle>
22+
Pushsafer_pr = <Default priority>
23+
Pushsafer_re = <Default retry>
24+
Pushsafer_ex = <Default expire>
25+
Pushsafer_cr = <Default confirm>
26+
Pushsafer_a = <Default answer>
27+
Pushsafer_ao = <Default answeroptions>
28+
Pushsafer_af = <Default answerforce>
1829
Pushsafer_disable = 1 Disable notifications. Messages will still be logged
1930
2031
Create a pushsafer instance in the .mht file, or in user code:
@@ -32,8 +43,19 @@ A user code file overriding parameters normally specified in mh.private.ini. A
3243
t => 'Home Notification',
3344
d => '111',
3445
i => '11',
46+
c => '#FF0000',
3547
s => '5',
3648
v => '1',
49+
l => '',
50+
u => 'https://www.pushsafer.com',
51+
ut => 'Open Pushsafer',
52+
pr => '0',
53+
re => '',
54+
ex => '',
55+
cr => '',
56+
a => '1',
57+
ao => 'yes|no|maybe',
58+
af => '1',
3759
});
3860
3961
@@ -94,13 +116,24 @@ Creates a new Pushsafer object. The parameter hash is optional. Defaults will b
94116
B<This must be excluded from the primary misterhouse loop, or the acknowledgment checking and duplicate message rate limiting will be lost>
95117
96118
my $push = Pushsafer->new( {
97-
k => "xxxx...", # Set the Private or Alias Key
98-
t => "Some title", # Set default title for messages
99-
d => "111", # Set the target device or device group (leaving this unset goes to all devices)
100-
i => "5", # Set the icon to be displayed
101-
s => "3", # Set the sound to be played
102-
v => "1", # Set the vibration to be played
103-
speak => 1, # Enable or disable speak of notifications and acknowledgment
119+
k => "xxxx...", # Set the Private or Alias Key
120+
t => "Some title", # Set default title for messages
121+
d => "111", # Set the target device or device group (leaving this unset goes to all devices)
122+
i => "5", # Set the icon to be displayed
123+
c => "#FF0000", # Set the color of icon to be displayed
124+
s => "3", # Set the sound to be played
125+
v => "1", # Set the vibration to be played
126+
l => "", # Set the Time in minutes, after a message automatically gets purged.
127+
u => 'https://www.pushsafer.com', # Set the URL.
128+
ut => 'Open Pushsafer', # Set the Title of URL.
129+
pr => '0', # Set the Priority.
130+
re => '', # Set the Retry.
131+
ex => '', # Set the Expire.
132+
cr => '', # Set the Confirm.
133+
a => '1', # Set the Answer.
134+
ao => 'yes|no|maybe', # Set the Answer Options.
135+
af => '1', # Set the Force Answer.
136+
speak => 1, # Enable or disable speak of notifications and acknowledgment
104137
});
105138
106139
Any of these parameters may be specified in mh.private.ini by prefixing them with "Pushsafer_"
@@ -122,7 +155,7 @@ sub new {
122155
$self->{speak} = 1; # Speak notifications and acknowledgements
123156

124157
# Merge the mh.private.ini defaults into the object
125-
foreach (qw( k t d i s v speak disable)) {
158+
foreach (qw( k t d i c s v l u ut pr re ex cr a ao af speak disable)) {
126159
$self->{$_} = $params->{$_};
127160
$self->{$_} = $::config_parms{"Pushsafer_$_"} unless defined $self->{$_};
128161
}
@@ -153,12 +186,12 @@ This is the primary method of the Pushsafer object. The message text is the onl
153186
154187
The optional parameter hash can be used to override defaults, or specify additional
155188
information for the notification. The list is not exclusive. Additional parameters will be passed
156-
in the POST to Pushsafer.com. This allows support of any API parameter as defined at https://pushsafer.net/api
189+
in the POST to Pushsafer.com. This allows support of any API parameter as defined at https://www.pushsafer.com/api
157190
158191
$push->notify("Some urgent message", {
159-
k => "xxxx...", # Override the Private or Alias Key
160-
t => "Some title", # Override title of message
161-
d => "1111" # Device or device-group id
192+
k => "xxxx...", # Override the Private or Alias Key
193+
t => "Some title", # Override title of message
194+
d => "1111" # Device or device-group id
162195
});
163196
164197
Notify will record the last message sent along with a timestamp. If the duplicate message is sent within
@@ -197,7 +230,7 @@ sub notify {
197230
}
198231

199232
# Merge in the message defaults, They can be overridden
200-
foreach (qw( k t d i s v )) {
233+
foreach (qw( k t d i c s v l u ut pr re ex cr a ao af )) {
201234
next unless ( defined $self->{$_} );
202235
$callparms->{$_} = $self->{$_} unless defined $callparms->{$_};
203236
}

0 commit comments

Comments
 (0)