2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

72_TA_CMI_JSON: handling invalid JSON

git-svn-id: https://svn.fhem.de/fhem/trunk@25639 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
delmar 2022-02-06 14:30:31 +00:00
parent 5f2c9b0ae5
commit 3044ab71e7
2 changed files with 11 additions and 0 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.
- bugfix: 72_TA_CMI_JSON: skipping invalid JSON
- feature: 50_Signalbot: text formatting and emoticons via unicode
- feature: 70_ESCVP21net.pm: toggle, TW7400, new Readings
- new: lib/FHEM/Text/Unicode: apply text styles in Unicode

View File

@ -271,6 +271,16 @@ sub ParseHttpResponse($$$) {
readingsEndUpdate($hash, 1);
} elsif($data ne "") {
my $keyValues = json2nameValue($data);
my $j2nvErr = $keyValues->{json2nameValueErrorText};
if (defined $j2nvErr) {
Log3 $name, 1, "TA_CMI_JSON ($name) - JSON problem: $j2nvErr. Skipping. Can be ignored if not occurring too often.";
readingsBeginUpdate($hash);
readingsBulkUpdate($hash, 'state', 'ERROR', 0);
readingsBulkUpdate($hash, 'error', $j2nvErr, 0);
readingsEndUpdate($hash, 1);
return undef;
}
my $canDevice = extractDeviceName($keyValues->{Header_Device});
$hash->{CAN_DEVICE} = $canDevice;