2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-19 12:46:03 +00:00

59_LuftdatenInfo: added error handling for malformed JSON string

git-svn-id: https://svn.fhem.de/fhem/trunk@14211 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
igami 2017-05-07 19:21:41 +00:00
parent 95e8914681
commit a1abcb536d

View File

@ -244,6 +244,13 @@ sub LuftdatenInfo_ParseHttpResponse($) {
readingsSingleUpdate($hash, "state", "error", 1);
}
elsif($data !~ /^\[.*\]$/s){
Log3(
$SELF, 2, "$TYPE ($SELF) - error while request: malformed JSON string"
);
readingsSingleUpdate($hash, "state", "error", 1);
}
elsif($data eq "[]"){
if( index($param->{url}, $hash->{SENSORID2}) > -1
&& InternalVal($SELF, "SENSORIDS", "implicit") eq "implicit"