2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 02:10:32 +00:00

70_Pushover: make title optional parameter to match commandref and Pushover API definition

git-svn-id: https://svn.fhem.de/fhem/trunk@10394 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2016-01-07 01:41:06 +00:00
parent 58e4aa5b68
commit 74133df9eb

View File

@ -71,8 +71,9 @@ sub Pushover_Initialize($$) {
"disable:0,1 timestamp:0,1 title sound:pushover,bike,bugle,cashregister,classical,cosmic,falling,gamelan,incoming,intermission,magic,mechanical,pianobar,siren,spacealarm,tugboat,alien,climb,persistent,echo,updown,none device priority:0,1,-1,-2 callbackUrl " "disable:0,1 timestamp:0,1 title sound:pushover,bike,bugle,cashregister,classical,cosmic,falling,gamelan,incoming,intermission,magic,mechanical,pianobar,siren,spacealarm,tugboat,alien,climb,persistent,echo,updown,none device priority:0,1,-1,-2 callbackUrl "
. $readingFnAttributes; . $readingFnAttributes;
#a priority value of 2 is not predifined as for this also a value for retry and expire must be set # a priority value of 2 is not predifined as for this also a value for
#which will most likely not be used with default values. # retry and expire must be set which will most likely not be used with
# default values.
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -136,10 +137,16 @@ sub Pushover_Define($$) {
# start Validation Timer # start Validation Timer
RemoveInternalTimer($hash); RemoveInternalTimer($hash);
if (ReadingsVal($name,"tokenState","invalid") ne "valid" || ReadingsVal($name,"userState","invalid") ne "valid" || $init_done) { if ( ReadingsVal( $name, "tokenState", "invalid" ) ne "valid"
InternalTimer( gettimeofday() + 5, "Pushover_ValidateUser", $hash, 0 ); || ReadingsVal( $name, "userState", "invalid" ) ne "valid"
} else { || $init_done )
InternalTimer( gettimeofday() + 21600, "Pushover_ValidateUser", $hash, 0 ); {
InternalTimer( gettimeofday() + 5,
"Pushover_ValidateUser", $hash, 0 );
}
else {
InternalTimer( gettimeofday() + 21600,
"Pushover_ValidateUser", $hash, 0 );
} }
return undef; return undef;
@ -219,8 +226,10 @@ sub Pushover_SendCommand($$;$\%) {
if ( !defined( $type->{USER_KEY} ) ) { if ( !defined( $type->{USER_KEY} ) ) {
$cmd .= "&user=" . $hash->{USER_KEY}; $cmd .= "&user=" . $hash->{USER_KEY};
} else { }
Log3 $name, 4, "Pushover $name: USER_KEY found in device name: ".$type->{USER_KEY}; else {
Log3 $name, 4,
"Pushover $name: USER_KEY found in device name: " . $type->{USER_KEY};
$cmd .= "&user=" . $type->{USER_KEY}; $cmd .= "&user=" . $type->{USER_KEY};
} }
@ -325,7 +334,13 @@ sub Pushover_ReceiveCommand($$$) {
my $values = $param->{type}; my $values = $param->{type};
my $return; my $return;
Log3 $name, 5, "Pushover $name: Received HttpUtils callback:\n\nPARAM:\n".Dumper($param)."\n\nERROR:\n".Dumper($err)."\n\nDATA:\n".Dumper($data); Log3 $name, 5,
"Pushover $name: Received HttpUtils callback:\n\nPARAM:\n"
. Dumper($param)
. "\n\nERROR:\n"
. Dumper($err)
. "\n\nDATA:\n"
. Dumper($data);
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
@ -398,17 +413,21 @@ sub Pushover_ReceiveCommand($$$) {
my $apiLimit = 7500; my $apiLimit = 7500;
my $apiRemaining = 1; my $apiRemaining = 1;
my $apiReset; my $apiReset;
if ( $param->{httpheader} =~ m/X-Limit-App-Limit:[\s\t]*(.*)[\s\t\n]*/ ) { if ( $param->{httpheader} =~ m/X-Limit-App-Limit:[\s\t]*(.*)[\s\t\n]*/ )
{
$apiLimit = $1; $apiLimit = $1;
readingsBulkUpdate( $hash, "apiLimit", $1 ) readingsBulkUpdate( $hash, "apiLimit", $1 )
if ( ReadingsVal( $name, "apiLimit", "" ) ne $1 ); if ( ReadingsVal( $name, "apiLimit", "" ) ne $1 );
} }
if ( $param->{httpheader} =~ m/X-Limit-App-Remaining:[\s\t]*(.*)[\s\t\n]*/ ) { if ( $param->{httpheader} =~
m/X-Limit-App-Remaining:[\s\t]*(.*)[\s\t\n]*/ )
{
$apiRemaining = $1; $apiRemaining = $1;
readingsBulkUpdate( $hash, "apiRemaining", $1 ) readingsBulkUpdate( $hash, "apiRemaining", $1 )
if ( ReadingsVal( $name, "apiRemaining", "" ) ne $1 ); if ( ReadingsVal( $name, "apiRemaining", "" ) ne $1 );
} }
if ( $param->{httpheader} =~ m/X-Limit-App-Reset:[\s\t]*(.*)[\s\t\n]*/ ) { if ( $param->{httpheader} =~ m/X-Limit-App-Reset:[\s\t]*(.*)[\s\t\n]*/ )
{
$apiReset = $1; $apiReset = $1;
readingsBulkUpdate( $hash, "apiReset", $1 ) readingsBulkUpdate( $hash, "apiReset", $1 )
if ( ReadingsVal( $name, "apiReset", "" ) ne $1 ); if ( ReadingsVal( $name, "apiReset", "" ) ne $1 );
@ -421,14 +440,22 @@ sub Pushover_ReceiveCommand($$$) {
} }
# error handling # error handling
elsif ( ($param->{code} == 200 || $param->{code} >= 400) && elsif (
( (ref($return) eq "HASH" && $return->{status} ne "1") || (ref($return) ne "HASH" && $return !~ m/"status":1,/) ) ) { ( $param->{code} == 200 || $param->{code} >= 400 )
$values{result} = "Error " . $param->{code} . ": Unspecified error occured"; && ( ( ref($return) eq "HASH" && $return->{status} ne "1" )
|| ( ref($return) ne "HASH" && $return !~ m/"status":1,/ ) )
)
{
$values{result} =
"Error " . $param->{code} . ": Unspecified error occured";
if ( ref($return) eq "HASH" && defined $return->{errors} ) { if ( ref($return) eq "HASH" && defined $return->{errors} ) {
$values{result} = $values{result} =
"Error " . $param->{code} . ": " . join( ". ", @{ $return->{errors} } ); "Error "
. $param->{code} . ": "
. join( ". ", @{ $return->{errors} } );
} }
elsif ( ref($return) ne "HASH" && $return =~ m/"errors":\[(.*)\]/ ) { elsif ( ref($return) ne "HASH" && $return =~ m/"errors":\[(.*)\]/ )
{
$values{result} = "Error " . $param->{code} . ": " . $1; $values{result} = "Error " . $param->{code} . ": " . $1;
} }
@ -437,12 +464,17 @@ sub Pushover_ReceiveCommand($$$) {
if ( ref($return) eq "HASH" && defined( $return->{token} ) ) { if ( ref($return) eq "HASH" && defined( $return->{token} ) ) {
$state = "unauthorized"; $state = "unauthorized";
readingsBulkUpdate( $hash, "tokenState", $return->{token} ) readingsBulkUpdate( $hash, "tokenState", $return->{token} )
if ( ReadingsVal($name,"tokenState","") ne $return->{token} ); if (
} elsif ( ref($return) ne "HASH" && $return =~ m/"token":"invalid"/ ) { ReadingsVal( $name, "tokenState", "" ) ne $return->{token}
);
}
elsif ( ref($return) ne "HASH" && $return =~ m/"token":"invalid"/ )
{
$state = "unauthorized"; $state = "unauthorized";
readingsBulkUpdate( $hash, "tokenState", "invalid" ) readingsBulkUpdate( $hash, "tokenState", "invalid" )
if ( ReadingsVal( $name, "tokenState", "" ) ne "invalid" ); if ( ReadingsVal( $name, "tokenState", "" ) ne "invalid" );
} else { }
else {
readingsBulkUpdate( $hash, "tokenState", "valid" ) readingsBulkUpdate( $hash, "tokenState", "valid" )
if ( ReadingsVal( $name, "tokenState", "" ) ne "valid" ); if ( ReadingsVal( $name, "tokenState", "" ) ne "valid" );
} }
@ -451,44 +483,66 @@ sub Pushover_ReceiveCommand($$$) {
$state = "unauthorized" if ( !defined( $values->{USER_KEY} ) ); $state = "unauthorized" if ( !defined( $values->{USER_KEY} ) );
readingsBulkUpdate( $hash, "userState", $return->{user} ) readingsBulkUpdate( $hash, "userState", $return->{user} )
if ( ReadingsVal($name,"userState","") ne $return->{user} && !defined($values->{USER_KEY}) ); if ( ReadingsVal( $name, "userState", "" ) ne $return->{user}
&& !defined( $values->{USER_KEY} ) );
$hash->{helper}{FAILED_USERKEYS}{ $values->{USER_KEY} } = "USERKEY ".$values->{USER_KEY}." ".$return->{user}." - ".$values{result} $hash->{helper}{FAILED_USERKEYS}{ $values->{USER_KEY} } =
"USERKEY "
. $values->{USER_KEY} . " "
. $return->{user} . " - "
. $values{result}
if ( defined( $values->{USER_KEY} ) ); if ( defined( $values->{USER_KEY} ) );
} elsif ( ref($return) ne "HASH" && $return =~ m/"user":"invalid"/ ) { }
elsif ( ref($return) ne "HASH" && $return =~ m/"user":"invalid"/ ) {
$state = "unauthorized" if ( !defined( $values->{USER_KEY} ) ); $state = "unauthorized" if ( !defined( $values->{USER_KEY} ) );
readingsBulkUpdate( $hash, "userState", "invalid" ) readingsBulkUpdate( $hash, "userState", "invalid" )
if ( ReadingsVal($name,"userState","") ne "invalid" && !defined($values->{USER_KEY}) ); if ( ReadingsVal( $name, "userState", "" ) ne "invalid"
&& !defined( $values->{USER_KEY} ) );
$hash->{helper}{FAILED_USERKEYS}{ $values->{USER_KEY} } = "USERKEY ".$values->{USER_KEY}." invalid - ".$values{result} $hash->{helper}{FAILED_USERKEYS}{ $values->{USER_KEY} } =
"USERKEY "
. $values->{USER_KEY}
. " invalid - "
. $values{result}
if ( defined( $values->{USER_KEY} ) ); if ( defined( $values->{USER_KEY} ) );
} else { }
else {
readingsBulkUpdate( $hash, "userState", "valid" ) readingsBulkUpdate( $hash, "userState", "valid" )
if ( ReadingsVal($name,"userState","") ne "valid" && !defined($values->{USER_KEY}) ); if ( ReadingsVal( $name, "userState", "" ) ne "valid"
&& !defined( $values->{USER_KEY} ) );
delete $hash->{helper}{FAILED_USERKEYS}{ $values->{USER_KEY} } delete $hash->{helper}{FAILED_USERKEYS}{ $values->{USER_KEY} }
if (!defined($values->{USER_KEY}) && defined($hash->{helper}{FAILED_USERKEYS}{ $values->{USER_KEY} }) ); if (
!defined( $values->{USER_KEY} )
&& defined(
$hash->{helper}{FAILED_USERKEYS}{ $values->{USER_KEY} }
)
);
} }
} else { }
else {
$state = "limited" if ( $apiRemaining < 1 ); $state = "limited" if ( $apiRemaining < 1 );
readingsBulkUpdate( $hash, "tokenState", "valid" ) readingsBulkUpdate( $hash, "tokenState", "valid" )
if ( ReadingsVal($name,"tokenState","") ne "valid" && !defined($values->{USER_KEY}) ); if ( ReadingsVal( $name, "tokenState", "" ) ne "valid"
&& !defined( $values->{USER_KEY} ) );
readingsBulkUpdate( $hash, "userState", "valid" ) readingsBulkUpdate( $hash, "userState", "valid" )
if ( ReadingsVal($name,"userState","") ne "valid" && !defined($values->{USER_KEY}) ); if ( ReadingsVal( $name, "userState", "" ) ne "valid"
&& !defined( $values->{USER_KEY} ) );
} }
# messages.json # messages.json
if ( $service eq "messages.json" ) { if ( $service eq "messages.json" ) {
readingsBulkUpdate( $hash, "lastTitle", $values->{title} ); readingsBulkUpdate( $hash, "lastTitle", $values->{title} );
readingsBulkUpdate( $hash, "lastMessage", urlDecode($values->{message}) ); readingsBulkUpdate( $hash, "lastMessage",
urlDecode( $values->{message} ) );
readingsBulkUpdate( $hash, "lastPriority", $values->{priority} ); readingsBulkUpdate( $hash, "lastPriority", $values->{priority} );
readingsBulkUpdate( $hash, "lastAction", $values->{action} ) readingsBulkUpdate( $hash, "lastAction", $values->{action} )
if ( $values->{action} ne "" ); if ( $values->{action} ne "" );
@ -496,7 +550,8 @@ sub Pushover_ReceiveCommand($$$) {
if ( $values->{action} eq "" ); if ( $values->{action} eq "" );
readingsBulkUpdate( $hash, "lastDevice", $values->{device} ) readingsBulkUpdate( $hash, "lastDevice", $values->{device} )
if ( $values->{device} ne "" ); if ( $values->{device} ne "" );
readingsBulkUpdate( $hash, "lastDevice", ReadingsVal($name, "devices", "all") ) readingsBulkUpdate( $hash, "lastDevice",
ReadingsVal( $name, "devices", "all" ) )
if ( $values->{device} eq "" ); if ( $values->{device} eq "" );
if ( ref($return) eq "HASH" ) { if ( ref($return) eq "HASH" ) {
@ -507,8 +562,11 @@ sub Pushover_ReceiveCommand($$$) {
if ( $values->{expire} ne "" ) { if ( $values->{expire} ne "" ) {
readingsBulkUpdate( $hash, "cbTitle_" . $values->{cbNr}, readingsBulkUpdate( $hash, "cbTitle_" . $values->{cbNr},
$values->{title} ); $values->{title} );
readingsBulkUpdate( $hash, "cbMsg_" . $values->{cbNr}, readingsBulkUpdate(
urlDecode($values->{message}) ); $hash,
"cbMsg_" . $values->{cbNr},
urlDecode( $values->{message} )
);
readingsBulkUpdate( $hash, "cbPrio_" . $values->{cbNr}, readingsBulkUpdate( $hash, "cbPrio_" . $values->{cbNr},
$values->{priority} ); $values->{priority} );
readingsBulkUpdate( $hash, "cbAck_" . $values->{cbNr}, readingsBulkUpdate( $hash, "cbAck_" . $values->{cbNr},
@ -519,8 +577,11 @@ sub Pushover_ReceiveCommand($$$) {
$values->{device} ); $values->{device} );
} }
else { else {
readingsBulkUpdate( $hash, "cbDev_" . $values->{cbNr}, readingsBulkUpdate(
ReadingsVal($name, "devices", "all") ); $hash,
"cbDev_" . $values->{cbNr},
ReadingsVal( $name, "devices", "all" )
);
} }
if ( defined $return->{receipt} ) { if ( defined $return->{receipt} ) {
@ -550,7 +611,8 @@ sub Pushover_ReceiveCommand($$$) {
if ( ref($return) eq "HASH" ) { if ( ref($return) eq "HASH" ) {
my $devices = "-"; my $devices = "-";
my $group = "0"; my $group = "0";
$devices = join( ",", @{ $return->{devices} } ) if (defined($return->{devices})); $devices = join( ",", @{ $return->{devices} } )
if ( defined( $return->{devices} ) );
$group = $return->{group} if ( defined( $return->{group} ) ); $group = $return->{group} if ( defined( $return->{group} ) );
readingsBulkUpdate( $hash, "devices", $devices ) readingsBulkUpdate( $hash, "devices", $devices )
@ -566,7 +628,9 @@ sub Pushover_ReceiveCommand($$$) {
# Set reading for availability # Set reading for availability
# #
my $available = 0; my $available = 0;
$available = 1 if ( $param->{code} ne "429" && ($state eq "connected" || $state eq "error") ); $available = 1
if ( $param->{code} ne "429"
&& ( $state eq "connected" || $state eq "error" ) );
readingsBulkUpdate( $hash, "available", $available ) readingsBulkUpdate( $hash, "available", $available )
if ( ReadingsVal( $name, "available", "" ) ne $available ); if ( ReadingsVal( $name, "available", "" ) ne $available );
@ -583,16 +647,24 @@ sub Pushover_ReceiveCommand($$$) {
if ( $state eq "disconnected" ) { if ( $state eq "disconnected" ) {
$nextTimer = gettimeofday() + 300; $nextTimer = gettimeofday() + 300;
# re-validate every 6 hours if there was no message sent during that time }
} elsif ($available eq "1") {
# re-validate every 6 hours if there was no message sent during
# that time
elsif ( $available eq "1" ) {
$nextTimer = gettimeofday() + 21600; $nextTimer = gettimeofday() + 21600;
}
# re-validate after API limit was reset # re-validate after API limit was reset
} elsif ($state eq "limited" || $param->{code} == 429) { elsif ( $state eq "limited" || $param->{code} == 429 ) {
$nextTimer = ReadingsVal($name,"apiReset",gettimeofday() + 21277) + 323; $nextTimer =
ReadingsVal( $name, "apiReset", gettimeofday() + 21277 ) + 323;
} }
RemoveInternalTimer($hash); RemoveInternalTimer($hash);
$hash->{VALIDATION_TIMER} = $nextTimer; $hash->{VALIDATION_TIMER} = $nextTimer;
InternalTimer( $nextTimer, "Pushover_ValidateUser", $hash, 0 ) if ($nextTimer ne "none"); InternalTimer( $nextTimer, "Pushover_ValidateUser", $hash, 0 )
if ( $nextTimer ne "none" );
readingsEndUpdate( $hash, 1 ); readingsEndUpdate( $hash, 1 );
@ -612,7 +684,8 @@ sub Pushover_ValidateUser ($;$) {
if ( AttrVal( $name, "disable", 0 ) == 1 ) { if ( AttrVal( $name, "disable", 0 ) == 1 ) {
$hash->{VALIDATION_TIMER} = "disabled"; $hash->{VALIDATION_TIMER} = "disabled";
RemoveInternalTimer($hash); RemoveInternalTimer($hash);
InternalTimer( gettimeofday() + 900, "Pushover_ValidateUser", $hash, 0 ); InternalTimer( gettimeofday() + 900, "Pushover_ValidateUser", $hash,
0 );
return; return;
} }
@ -634,7 +707,7 @@ sub Pushover_SetMessage {
my %values = (); my %values = ();
#Set defaults #Set defaults
$values{title} = AttrVal( $hash->{NAME}, "title", "Information" ); $values{title} = AttrVal( $hash->{NAME}, "title", "" );
$values{message} = ""; $values{message} = "";
$values{device} = AttrVal( $hash->{NAME}, "device", "" ); $values{device} = AttrVal( $hash->{NAME}, "device", "" );
$values{priority} = AttrVal( $hash->{NAME}, "priority", 0 ); $values{priority} = AttrVal( $hash->{NAME}, "priority", 0 );
@ -742,20 +815,24 @@ sub Pushover_SetMessage {
$values{action} = $1; $values{action} = $1;
} }
# check if we got a user or group key as device and use it as user-key instead of hash->USER_KEY # check if we got a user or group key as device and use it as
# user-key instead of hash->USER_KEY
if ( $values{device} =~ /^([A-Za-z0-9]{30})(:([A-Za-z0-9_-]+))?$/s ) { if ( $values{device} =~ /^([A-Za-z0-9]{30})(:([A-Za-z0-9_-]+))?$/s ) {
$values{USER_KEY} = $1; $values{USER_KEY} = $1;
$values{device} = $3; $values{device} = $3;
return $hash->{helper}{FAILED_USERKEYS}{ $values{USER_KEY} } return $hash->{helper}{FAILED_USERKEYS}{ $values{USER_KEY} }
if (defined($hash->{helper}{FAILED_USERKEYS}{ $values{USER_KEY} }) ); if (
defined( $hash->{helper}{FAILED_USERKEYS}{ $values{USER_KEY} } ) );
} }
#Check if all mandatory arguments are filled # Check if all mandatory arguments are filled:
#"title" and "message" can not be empty and if "priority" is set to "2" "retry" and "expire" must also be set # "message" can not be empty and if "priority" is set to "2" "retry" and
#"url_title" and "action" need to be set together and require "expire" to be set as well # "expire" must also be set.
# "url_title" and "action" need to be set together and require "expire"
# to be set as well.
if ( if (
( $values{title} ne "" && $values{message} ne "" ) $values{message} ne ""
&& ( ( $values{retry} ne "" && $values{expire} ne "" ) && ( ( $values{retry} ne "" && $values{expire} ne "" )
|| $values{priority} < 2 ) || $values{priority} < 2 )
&& ( && (
@ -768,7 +845,9 @@ sub Pushover_SetMessage {
) )
) )
{ {
my $body = "title=" . urlEncode( $values{title} ); my $body;
$body = "title=" . urlEncode( $values{title} )
if ( $values{title} ne "" );
if ( $values{message} =~ if ( $values{message} =~
/\<(\/|)[biu]\>|\<(\/|)font(.+)\>|\<(\/|)a(.*)\>|\<br\s?\/?\>/ /\<(\/|)[biu]\>|\<(\/|)font(.+)\>|\<(\/|)a(.*)\>|\<br\s?\/?\>/
@ -776,7 +855,9 @@ sub Pushover_SetMessage {
{ {
Log3 $name, 4, "Pushover $name: handling message with HTML content"; Log3 $name, 4, "Pushover $name: handling message with HTML content";
$body = $body . "&html=1"; $body = $body . "&html=1";
$values{message} =~ s/(?<!\\)(\\n)/<br \/>/g; # replace \n by <br /> but ignore \\n
# replace \n by <br /> but ignore \\n
$values{message} =~ s/(?<!\\)(\\n)/<br \/>/g;
} }
elsif ( $values{message} =~ /^nohtml:.*/ ) { elsif ( $values{message} =~ /^nohtml:.*/ ) {
@ -785,9 +866,16 @@ sub Pushover_SetMessage {
$values{message} =~ s/^(nohtml:).*//; $values{message} =~ s/^(nohtml:).*//;
} }
$values{message} = urlEncode( $values{message} ); # HttpUtil's urlEncode() does not handle \n but would escape % so we encode first # HttpUtil's urlEncode() does not handle \n but would escape %
$values{message} =~ s/(?<!%5c)(%5cn)/%0a/g; # replace any URL-encoded \n with their hex equivalent but ignore \\n # so we encode first
$values{message} =~ s/%5c%5cn/%5cn/g; # replace any URL-encoded \\n by \n $values{message} = urlEncode( $values{message} );
# replace any URL-encoded \n with their hex equivalent but ignore \\n
$values{message} =~ s/(?<!%5c)(%5cn)/%0a/g;
# replace any URL-encoded \\n by \n
$values{message} =~ s/%5c%5cn/%5cn/g;
$body = $body . "&message=" . $values{message}; $body = $body . "&message=" . $values{message};
if ( $values{device} ne "" ) { if ( $values{device} ne "" ) {
@ -854,7 +942,9 @@ sub Pushover_SetMessage {
} }
Log3 $name, 5, Log3 $name, 5,
"Pushover $name: Adding supplementary URL '$values{url_title}' ($url) with action '$values{action}' (expires after $values{expire} => $values{cbNr})"; "Pushover $name: Adding supplementary URL '$values{url_title}' ($url) with "
. "action '$values{action}' (expires after $values{expire} => "
. "$values{cbNr})";
$body = $body =
$body $body
. "&url_title=" . "&url_title="
@ -916,14 +1006,17 @@ sub Pushover_SetMessage {
return; return;
} }
else { else {
#There was a problem with the arguments, so tell the user the correct usage of the 'set msg' command
# There was a problem with the arguments, so tell the user the
# correct usage of the 'set msg' command
if ( 1 == $argc && $values{title} eq "" ) { if ( 1 == $argc && $values{title} eq "" ) {
return return
"Please define the default title in the pushover device arguments."; "Please define the default title in the pushover device arguments.";
} }
else { else {
return return
"Syntax: $name msg ['<title>'] '<msg>' ['<device>' <priority> '<sound>' [<retry> <expire> ['<url_title>' '<action>']]]"; "Syntax: $name msg ['<title>'] '<msg>' ['<device>' <priority> '<sound>' "
. "[<retry> <expire> ['<url_title>' '<action>']]]";
} }
} }
} }
@ -1027,7 +1120,8 @@ sub Pushover_CGI() {
my $redirect = ""; my $redirect = "";
# run FHEM command if desired # run FHEM command if desired
if ( ReadingsVal($name, $rAct, "pushover://") !~ /^[\w-]+:\/\/.*$/ ) if ( ReadingsVal( $name, $rAct, "pushover://" ) !~
/^[\w-]+:\/\/.*$/ )
{ {
$redirect = "pushover://"; $redirect = "pushover://";
@ -1050,7 +1144,8 @@ sub Pushover_CGI() {
. $redirect . $redirect
. "\"></head><body><a href=\"" . "\"></head><body><a href=\""
. $redirect . $redirect
. "\">Click here to get redirected to your destination</a></body></html>" . "\">Click here to get redirected to your destination"
. "</a></body></html>"
) if ( $redirect ne "" ); ) if ( $redirect ne "" );
} }