From 70577691e743af152b0d60fb3885b9a7a4a5463f Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Fri, 20 May 2022 12:37:19 +0000 Subject: [PATCH] 76_SolarForecast.pm: contrib 0.63.1 git-svn-id: https://svn.fhem.de/fhem/trunk@26064 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/76_SolarForecast.pm | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index 52edec3a5..08a13e845 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -7207,9 +7207,16 @@ return; ################################################################ sub isConsumerOn { my $hash = shift; - my $c = shift; + my $c = shift; + my $name = $hash->{NAME}; + + my $cname = ConsumerVal ($hash, $c, "name", ""); # Devicename Customer + + if(!$defs{$cname}) { + Log3($name, 1, qq{$name - the consumer device "$cname" is invalid, the "on" state can't be identified}); + return; + } - my $cname = ConsumerVal ($hash, $c, "name", ""); # Devicename Customer my $reg = ConsumerVal ($hash, $c, "onreg", "on"); my $rswstate = ConsumerVal ($hash, $c, "rswstate", "state"); # Reading mit Schaltstatus my $swstate = ReadingsVal ($cname, $rswstate, "undef"); @@ -7227,8 +7234,15 @@ return; sub isConsumerOff { my $hash = shift; my $c = shift; + my $name = $hash->{NAME}; + + my $cname = ConsumerVal ($hash, $c, "name", ""); # Devicename Customer + + if(!$defs{$cname}) { + Log3($name, 1, qq{$name - the consumer device "$cname" is invalid, the "off" state can't be identified}); + return; + } - my $cname = ConsumerVal ($hash, $c, "name", ""); # Devicename Customer my $reg = ConsumerVal ($hash, $c, "offreg", "off"); my $rswstate = ConsumerVal ($hash, $c, "rswstate", "state"); # Reading mit Schaltstatus my $swstate = ReadingsVal ($cname, $rswstate, "undef");