From 3af4f614afba036c1410cb2615a894e1e436d748 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 22 Dec 2015 07:41:43 +0100 Subject: [PATCH] =?UTF-8?q?INTERNAL=20f=C3=BCr=20alten=20hombotState=20hin?= =?UTF-8?q?zugef=C3=BCgt,=20verbesserte=20Erkennung=20eines=20undefinierte?= =?UTF-8?q?n=20Zustandes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_HOMBOT.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/74_HOMBOT.pm b/74_HOMBOT.pm index 76be0ee..a6fd8d8 100644 --- a/74_HOMBOT.pm +++ b/74_HOMBOT.pm @@ -34,7 +34,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; -my $version = "0.1.41"; +my $version = "0.1.42"; @@ -401,6 +401,8 @@ sub HOMBOT_RetrieveHomebotInfoFinished($$$) { ### Begin Parse Processing readingsSingleUpdate( $hash, "state", "active", 1) if( ReadingsVal( $name, "state", 0 ) ne "initialized" or ReadingsVal( $name, "state", 0 ) ne "active" ); + my $previousHombotState = ReadingsVal( $name, "hombotState", "none" ); + readingsBeginUpdate( $hash ); @@ -442,7 +444,7 @@ sub HOMBOT_RetrieveHomebotInfoFinished($$$) { readingsBulkUpdate( $hash, $t, $v ) if( $t =~ m/[a-z]/s && defined( $t ) && defined( $v ) ); } - readingsBulkUpdate( $hash, "hombotState", "UNKNOWN" ) if( ReadingsVal( $name, "hombotState", "" ) eq "" ); + readingsBulkUpdate( $hash, "hombotState", "UNKNOWN" ) if( ReadingsVal( $name, "hombotState", "UNKNOWN" ) eq "" ); } elsif( $parsid eq "statistichtml" ) { @@ -488,7 +490,7 @@ sub HOMBOT_RetrieveHomebotInfoFinished($$$) { readingsBulkUpdate( $hash, "state", "active" ) if( ReadingsVal( $name, "state", 0 ) eq "initialized" ); readingsEndUpdate( $hash, 1 ); - + $hash->{previousHombotState} = $previousHombotState if( $previousHombotState != ReadingsVal( $name, "hombotState", "none" ); ## verändert das INTERVAL in Abhängigkeit vom Arbeitsstatus des Bots if( ReadingsVal( $name, "hombotState", "CHARGING" ) eq "WORKING" || ReadingsVal( $name, "hombotState", "CHARGING" ) eq "HOMING" || ReadingsVal( $name, "hombotState", "CHARGING" ) eq "DOCKING" ) {