mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
Pushalot: changed URL request to non-blocking - fixed problem with parameter order for image
git-svn-id: https://svn.fhem.de/fhem/trunk@8701 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
60f7388cb4
commit
930a4b8aa7
@ -1,5 +1,8 @@
|
||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||
# Do not insert empty lines here, update check depends on it.
|
||||
- bugfix: 70_Pushalot: corrected parameter order for image
|
||||
- change: 70_Pushalot: changed http call to non-blocking
|
||||
- feature: 70_Pushalot: module to send push notification to Windows Phone
|
||||
- change: 02_HTTPSRV: require trailing slash in infix to foster
|
||||
integration of TabletUI
|
||||
- feature: 59_Weather: polish translations (Lukasz)
|
||||
|
@ -14,23 +14,23 @@
|
||||
#
|
||||
#
|
||||
# You can send messages via the following command:
|
||||
# set <Pushalot_device> message "<message>" ["<title>"] ["<link>"] ["<link_title>"] ["<image>"] [<important>] [<silent>]
|
||||
# set <Pushalot_device> message "<message>" ["<title>"] ["<image>"] ["<link>"] ["<link_title>"] [<important>] [<silent>]
|
||||
#
|
||||
# Examples:
|
||||
# set PushNotification message "This is my message."
|
||||
# set PushNotification message "This is my message." "With Title"
|
||||
# set PushNotification message "This is my message." "With Title" "http://www.xyz.com""
|
||||
# set PushNotification message "This is my message." "With Title" "http://www.xyz.com" "Link Title"
|
||||
# set PushNotification message "This is my message." "With Title" "http://www.xyz.com" "Link Title" "http://www.xyz/image.png"
|
||||
# set PushNotification message "This is my message." "With Title" "http://www.xyz.com" "Link Title" "http://www.xyz/image.png" True False
|
||||
# set PushNotification message "This is my message." "With Title" "http://www.xyz/image.png"
|
||||
# set PushNotification message "This is my message." "With Title" "http://www.xyz/image.png" "http://www.xyz.com""
|
||||
# set PushNotification message "This is my message." "With Title" "http://www.xyz/image.png" "http://www.xyz.com" "Link Title"
|
||||
# set PushNotification message "This is my message." "With Title" "http://www.xyz/image.png" "http://www.xyz.com" "Link Title" True False
|
||||
#
|
||||
# Explantation:
|
||||
#
|
||||
# - The first parameter is the message to send
|
||||
# - The second parameter is an optional title for the message
|
||||
# - The third parameter is an optional link for the message
|
||||
# - The fourth parameter is an optional link title for the message
|
||||
# - The fifth parameter is an optional image for the message
|
||||
# - The third parameter is an optional image for the message
|
||||
# - The fourth parameter is an optional link for the message
|
||||
# - The fifth parameter is an optional link title for the message
|
||||
# - The sixth parameter defines whether the message should be marked as important
|
||||
# - The seventh parameter defines whether the message should be delivered silently
|
||||
#
|
||||
@ -131,7 +131,9 @@ sub Pushalot_Set($@)
|
||||
}
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
sub Pushalot_Build_Body($@)
|
||||
#------------------------------------------------------------------------------
|
||||
{
|
||||
my ($hash, @args) = @_;
|
||||
|
||||
@ -172,12 +174,50 @@ sub Pushalot_Send($$)
|
||||
{
|
||||
my ($hash,$body) = @_;
|
||||
|
||||
$response = GetFileFromURL($hash->{helper}{Url}, 10, $body, 0, 5);
|
||||
my $params = {
|
||||
url => $hash->{helper}{Url},
|
||||
timeout => 10,
|
||||
hash => $hash,
|
||||
data => $body,
|
||||
message => $body,
|
||||
method => "POST",
|
||||
callback => \&Pushalot_Callback
|
||||
};
|
||||
|
||||
return Pushalot_Parse_Result($hash, $message, $response);
|
||||
HttpUtils_NonblockingGet($params);
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
sub Pushalot_Callback($)
|
||||
#------------------------------------------------------------------------------
|
||||
{
|
||||
my ($params, $err, $data) = @_;
|
||||
my $hash = $params->{hash};
|
||||
|
||||
if($err ne "")
|
||||
{
|
||||
$returnObject = {
|
||||
Success => false,
|
||||
Status => 500,
|
||||
Description => "Request could not be completed: " . $err
|
||||
};
|
||||
|
||||
Pushalot_Parse_Result($hash, $params->{message}, encode_json $returnObject);
|
||||
}
|
||||
|
||||
elsif($data ne "")
|
||||
{
|
||||
Pushalot_Parse_Result($hash, $params->{message}, $data);
|
||||
}
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
sub Pushalot_Parse_Result($$$)
|
||||
#------------------------------------------------------------------------------
|
||||
{
|
||||
my ($hash, $message, $result) = @_;
|
||||
|
||||
@ -190,10 +230,6 @@ sub Pushalot_Parse_Result($$$)
|
||||
readingsBulkUpdate($hash, "last-status", $returnObject->{"Status"});
|
||||
readingsBulkUpdate($hash, "last-description", $returnObject->{"Description"});
|
||||
readingsEndUpdate($hash, 1);
|
||||
|
||||
return undef if($returnObject->{"Status"} == 200);
|
||||
|
||||
return $returnObject->{"Description"};
|
||||
}
|
||||
|
||||
|
||||
@ -244,7 +280,7 @@ sub Pushalot_Parse_Result($$$)
|
||||
<a name="PushalotSet"></a>
|
||||
<b>Set</b>
|
||||
<ul>
|
||||
<code>set <Pushalot_device> "<message>" ["<title>"] ["<link>"] ["<link_title>"] ["<image>"] ["<important>"] ["<silent>"]</code>
|
||||
<code>set <Pushalot_device> "<message>" ["<title>"] ["<image>"] ["<link>"] ["<link_title>"] ["<important>"] ["<silent>"]</code>
|
||||
<br>
|
||||
<br>
|
||||
<table>
|
||||
@ -260,6 +296,10 @@ sub Pushalot_Parse_Result($$$)
|
||||
<td><title></td>
|
||||
<td>The title of the message.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><image></td>
|
||||
<td>An optional image URL that is shown in the message.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><link></td>
|
||||
<td>An optional link that should be appended to the message body.</td>
|
||||
@ -268,10 +308,6 @@ sub Pushalot_Parse_Result($$$)
|
||||
<td><link_title></td>
|
||||
<td>An optional link title. If no title is set, the URL is shown as title in the message.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><image></td>
|
||||
<td>An optional image URL that is shown in the message.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><important></td>
|
||||
<td>True|False: True if the message should be marked as 'important', otherwise False (Default)</td>
|
||||
@ -286,11 +322,11 @@ sub Pushalot_Parse_Result($$$)
|
||||
<ul>
|
||||
<code>set PushNotification message "This is my message."</code><br>
|
||||
<code>set PushNotification message "This is my message." "With Title"</code><br>
|
||||
<code>set PushNotification message "This is my message." "With Title" "http://www.xyz.com"</code><br>
|
||||
<code>set PushNotification message "This is my message." "With Title" "http://www.xyz.com" "Link Title"</code><br>
|
||||
<code>set PushNotification message "This is my message." "With Title" "http://www.xyz.com" "Link Title" "http://www.xyz.com/image.png"</code><br>
|
||||
<code>set PushNotification message "This is my message." "With Title" "http://www.xyz.com" "Link Title" "http://www.xyz.com/image.png" True</code><br>
|
||||
<code>set PushNotification message "This is my message." "With Title" "http://www.xyz.com" "Link Title" "http://www.xyz.com/image.png" True False</code><br>
|
||||
<code>set PushNotification message "This is my message." "With Title" "http://www.xyz.com/image.png"</code><br>
|
||||
<code>set PushNotification message "This is my message." "With Title" "http://www.xyz.com/image.png" "http://www.xyz.com"</code><br>
|
||||
<code>set PushNotification message "This is my message." "With Title" "http://www.xyz.com/image.png" "http://www.xyz.com" "Link Title" </code><br>
|
||||
<code>set PushNotification message "This is my message." "With Title" "http://www.xyz.com/image.png" "http://www.xyz.com" "Link Title" True</code><br>
|
||||
<code>set PushNotification message "This is my message." "With Title" "http://www.xyz.com/image.png" "http://www.xyz.com" "Link Title" True False</code><br>
|
||||
</ul>
|
||||
<br>
|
||||
</ul>
|
||||
@ -351,7 +387,7 @@ sub Pushalot_Parse_Result($$$)
|
||||
<a name="PushalotSet"></a>
|
||||
<b>Set</b>
|
||||
<ul>
|
||||
<code>set <Pushalot_device> "<message>" ["<title>"] ["<link>"] ["<link_title>"] ["<image>"] ["<important>"] ["<silent>"]</code>
|
||||
<code>set <Pushalot_device> "<message>" ["<title>"] ["<image>"] ["<link>"] ["<link_title>"] ["<important>"] ["<silent>"]</code>
|
||||
<br>
|
||||
<br>
|
||||
<table>
|
||||
@ -367,6 +403,10 @@ sub Pushalot_Parse_Result($$$)
|
||||
<td><title></td>
|
||||
<td>Der Titel der Nachricht.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><image></td>
|
||||
<td>Optionale Bild-URL die in der Nachricht angezeigt werden soll.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><link></td>
|
||||
<td>Ein optionaler Link der an die Nachricht angehängt werden soll.</td>
|
||||
@ -375,10 +415,6 @@ sub Pushalot_Parse_Result($$$)
|
||||
<td><link_title></td>
|
||||
<td>Optionaler Link Titel. Wenn kein Titel angegeben wird, ist dieser die URL.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><image></td>
|
||||
<td>Optionale Bild-URL die in der Nachricht angezeigt werden soll.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><important></td>
|
||||
<td>True|False: True wenn die Nachricht als 'wichtig' markiert werden soll, sonst False (Default)</td>
|
||||
@ -393,11 +429,11 @@ sub Pushalot_Parse_Result($$$)
|
||||
<ul>
|
||||
<code>set PushNotification message "Das ist meine Nachricht."</code><br>
|
||||
<code>set PushNotification message "Das ist meine Nachricht." "Mit Titel"</code><br>
|
||||
<code>set PushNotification message "Das ist meine Nachricht." "Mit Titel" "http://www.xyz.com"</code><br>
|
||||
<code>set PushNotification message "Das ist meine Nachricht." "Mit Titel" "http://www.xyz.com" "Link Titel"</code><br>
|
||||
<code>set PushNotification message "Das ist meine Nachricht." "Mit Titel" "http://www.xyz.com" "Link Titel" "http://www.xyz.com/image.png"</code><br>
|
||||
<code>set PushNotification message "Das ist meine Nachricht." "Mit Titel" "http://www.xyz.com" "Link Titel" "http://www.xyz.com/image.png" True</code><br>
|
||||
<code>set PushNotification message "Das ist meine Nachricht." "Mit Titel" "http://www.xyz.com" "Link Title" "http://www.xyz.com/image.png" True False</code><br>
|
||||
<code>set PushNotification message "Das ist meine Nachricht." "Mit Titel" "http://www.xyz.com/image.png"</code><br>
|
||||
<code>set PushNotification message "Das ist meine Nachricht." "Mit Titel" "http://www.xyz.com/image.png" "http://www.xyz.com"</code><br>
|
||||
<code>set PushNotification message "Das ist meine Nachricht." "Mit Titel" "http://www.xyz.com/image.png" "http://www.xyz.com" "Link Titel" </code><br>
|
||||
<code>set PushNotification message "Das ist meine Nachricht." "Mit Titel" "http://www.xyz.com/image.png" "http://www.xyz.com" "Link Titel" True</code><br>
|
||||
<code>set PushNotification message "Das ist meine Nachricht." "Mit Titel" "http://www.xyz.com/image.png" "http://www.xyz.com" "Link Title" True False</code><br>
|
||||
</ul>
|
||||
<br>
|
||||
Notes:
|
||||
|
Loading…
Reference in New Issue
Block a user