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

70_ZoneMinder: fixed JSON-parsing bug

git-svn-id: https://svn.fhem.de/fhem/trunk@19941 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
delmar 2019-08-03 09:12:45 +00:00
parent ab51330bec
commit 8af3ae50e0
2 changed files with 13 additions and 1 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: 70_ZoneMinder: fixed JSON-parsing bug
- feature: 57_Calendar: get ...events include:... returnType:...
- feature: 44_TEK603: ser2net support
- feature: 73_AutoShuttersControl: add new Dev TYPE in %posSetCmds,

View File

@ -255,7 +255,8 @@ sub ZoneMinder_API_ReadHostInfo_Callback {
$hash->{ZM_VERSION} = 'error';
$hash->{ZM_API_VERSION} = 'error';
} elsif($data ne "") {
$data =~ s/\R//g;
my $zmVersion = ZoneMinder_GetConfigValueByKey($hash, $data, 'version');
if (not $zmVersion) {
$zmVersion = 'unknown';
@ -281,6 +282,8 @@ sub ZoneMinder_API_ReadHostLoad_Callback {
Log3 $name, 0, "error while requesting ".$param->{url}." - $err";
readingsSingleUpdate($hash, 'CPU_Load', 'error', 0);
} elsif($data ne "") {
$data =~ s/\R//g;
my $load = ZoneMinder_GetConfigArrayByKey($hash, $data, 'load');
readingsSingleUpdate($hash, 'CPU_Load', $load, 1);
@ -299,6 +302,8 @@ sub ZoneMinder_API_ReadConfig_Callback {
if($err ne "") {
Log3 $name, 0, "error while requesting ".$param->{url}." - $err";
} elsif($data ne "") {
$data =~ s/\R//g;
my $zmPathZms = ZoneMinder_GetConfigValueByName($hash, $data, 'ZM_PATH_ZMS');
if ($zmPathZms) {
$zmPathZms =~ s/\\//g;
@ -356,6 +361,7 @@ sub ZoneMinder_API_UpdateMonitors_Callback {
my $hash = $param->{hash};
my $name = $hash->{NAME};
$data =~ s/\R//g;
my @monitors = split(/\{"Monitor"\:\{/, $data);
foreach my $monitorData (@monitors) {
@ -388,6 +394,7 @@ sub ZoneMinder_API_CreateMonitors_Callback {
my $hash = $param->{hash};
my $name = $hash->{NAME};
$data =~ s/\R//g;
my @monitors = split(/\{"Monitor"\:\{/, $data);
foreach my $monitorData (@monitors) {
@ -502,6 +509,8 @@ sub ZoneMinder_API_ChangeMonitorState_Callback {
my $hash = $param->{hash};
my $name = $hash->{NAME};
if ($data) {
$data =~ s/\R//g;
my $monitorId = $param->{zmMonitorId};
my $logDevHash = $modules{ZM_Monitor}{defptr}{$name.'_'.$monitorId};
my $function = $param->{zmFunction};
@ -526,6 +535,8 @@ sub ZoneMinder_API_QueryEventDetails_Callback {
my $hash = $param->{hash};
my $name = $hash->{NAME};
$data =~ s/\R//g;
my $zmMonitorId = ZoneMinder_GetConfigValueByKey($hash, $data, 'MonitorId');
my $zmEventId = ZoneMinder_GetConfigValueByKey($hash, $data, 'Id');
my $zmNotes = ZoneMinder_GetConfigValueByKey($hash, $data, 'Notes');