2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-20 01:06:04 +00:00

Pushsafer: added device name to availableMessages readings (Forum: #59240)

git-svn-id: https://svn.fhem.de/fhem/trunk@12486 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2016-11-01 16:58:54 +00:00
parent 374e65447d
commit c21a37f8be
2 changed files with 14 additions and 6 deletions

View File

@ -1,5 +1,6 @@
# 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.
- changed: Pushsafer: added devicename to availableMessages reading name
- feature: 98_Hyperion: new set toggleMode
new attr hyperionToggleModes
new german commandref

View File

@ -364,13 +364,20 @@ sub Pushsafer_Callback($$$)
readingsBulkUpdate($hash, "lastSuccess", $1);
}
if($data =~ /available"?\s*:\s*{([^}]+)}/s)
if($data =~ /available"?\s*:\s*{(.+)\s*}\s*}\s*$/gcs)
{
my %devices = map { split(/:/, $_) } map { s/"//g; $_ } split(",", $1);
my %devices = grep { defined($_) } map { /^"?(\d+)"?:({.+})$/ ? ($1 => $2) : undef } split(",", $1);
foreach my $dev (keys %devices)
{
readingsBulkUpdate($hash, "availableMessages-$dev", $devices{$dev});
if(defined($devices{$dev}) and $devices{$dev} =~ /^{\s*"?([^":]+)"?\s*:\s*"?([^":]+)"?\s*}$/)
{
my ($devname, $available) = ($1, $2);
$devname =~ s/\s+//g;
readingsBulkUpdate($hash, "availableMessages-$dev-$devname", $available);
}
}
}
@ -477,7 +484,7 @@ sub Pushsafer_Callback($$$)
<ul>
<li><b>lastSuccess</b> - The last successful status message received by the Pushsafer server</li>
<li><b>lastError</b> - The last errur message received by the Pushsafer server</li>
<li><b>availableMessages-<i>&lt;deviceID&gt;</i></b> - The remaining messages that can be send to this device</li>
<li><b>availableMessages-<i>&lt;device ID&gt;</i>-<i>&lt;device name&gt;</i></b> - The remaining messages that can be send to this device</li>
</ul>
</ul>
=end html
@ -574,7 +581,7 @@ sub Pushsafer_Callback($$$)
<ul>
<li><b>lastSuccess</b> - Die letzte erfolgreiche Statusmeldung vom Pushsafer Server</li>
<li><b>lastError</b> - Die letzte Fehlermeldung vom Pushsafer Server</li>
<li><b>availableMessages-<i>&lt;Ger&auml;te-ID&gt;</i></b> - Die verbleibende Anzahl an Nachrichten die zu diesem Ger&auml;t noch gesendet werden k&ouml;nnen</li>
<li><b>availableMessages-<i>&lt;Ger&auml;te-ID&gt;</i>-<i>&lt;Ger&auml;te-Name&gt;</i></b> - Die verbleibende Anzahl an Nachrichten die zu diesem Ger&auml;t noch gesendet werden k&ouml;nnen</li>
</ul>
</ul>