2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-27 22:53:29 +00:00

76_SolarForecast: fix get Automatic State

git-svn-id: https://svn.fhem.de/fhem/trunk@28358 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2024-01-08 19:22:53 +00:00
parent 17e704ce03
commit c99838494d

View File

@ -6789,9 +6789,7 @@ sub __getAutomaticState {
my $type = $paref->{type}; my $type = $paref->{type};
my $c = $paref->{consumer}; my $c = $paref->{consumer};
my $consumer = AttrVal ($name, "consumer${c}", ""); my $consumer = ConsumerVal ($hash, $c, 'name', ''); # Name Consumer Device
my ($ac,$hc) = parseParams ($consumer);
$consumer = $ac->[0] // "";
if (!$consumer || !$defs{$consumer}) { if (!$consumer || !$defs{$consumer}) {
my $err = qq{ERROR - the device "$consumer" doesn't exist anymore! Delete or change the attribute "consumer${c}".}; my $err = qq{ERROR - the device "$consumer" doesn't exist anymore! Delete or change the attribute "consumer${c}".};
@ -6799,7 +6797,7 @@ sub __getAutomaticState {
return; return;
} }
my $dswitch = $hc->{switchdev}; # alternatives Schaltdevice my $dswitch = ConsumerVal ($hash, $c, 'dswitch', ''); # alternatives Schaltdevice
if ($dswitch) { if ($dswitch) {
if (!$defs{$dswitch}) { if (!$defs{$dswitch}) {
@ -6812,9 +6810,9 @@ sub __getAutomaticState {
$dswitch = $consumer; $dswitch = $consumer;
} }
my $rauto = $hc->{auto} // q{}; my $autord = ConsumerVal ($hash, $c, 'autoreading', ''); # Readingname f. Automatiksteuerung
my $auto = 1; my $auto = 1;
$auto = ReadingsVal ($dswitch, $rauto, 1) if($rauto); # Reading für Ready-Bit -> Einschalten möglich ? $auto = ReadingsVal ($dswitch, $autord, 1) if($autord); # Reading für Ready-Bit -> Einschalten möglich ?
$data{$type}{$name}{consumers}{$c}{auto} = $auto; # Automaticsteuerung: 1 - Automatic ein, 0 - Automatic aus $data{$type}{$name}{consumers}{$c}{auto} = $auto; # Automaticsteuerung: 1 - Automatic ein, 0 - Automatic aus
@ -8602,8 +8600,6 @@ sub collectAllRegConsumers {
my $rauto = $hc->{auto} // q{}; my $rauto = $hc->{auto} // q{};
my $ctype = $hc->{type} // $defctype; my $ctype = $hc->{type} // $defctype;
my $auto = 1;
$auto = ReadingsVal ($consumer, $rauto, 1) if($rauto); # Reading für Ready-Bit -> Einschalten möglich ?
$data{$type}{$name}{consumers}{$c}{name} = $consumer; # Name des Verbrauchers (Device) $data{$type}{$name}{consumers}{$c}{name} = $consumer; # Name des Verbrauchers (Device)
$data{$type}{$name}{consumers}{$c}{alias} = $alias; # Alias des Verbrauchers (Device) $data{$type}{$name}{consumers}{$c}{alias} = $alias; # Alias des Verbrauchers (Device)
@ -8617,7 +8613,6 @@ sub collectAllRegConsumers {
$data{$type}{$name}{consumers}{$c}{offcom} = $hc->{off} // q{}; # Setter Ausschaltkommando $data{$type}{$name}{consumers}{$c}{offcom} = $hc->{off} // q{}; # Setter Ausschaltkommando
$data{$type}{$name}{consumers}{$c}{dswitch} = $dswitch; # Switchdevice zur Kommandoausführung $data{$type}{$name}{consumers}{$c}{dswitch} = $dswitch; # Switchdevice zur Kommandoausführung
$data{$type}{$name}{consumers}{$c}{autoreading} = $rauto; # Readingname zur Automatiksteuerung $data{$type}{$name}{consumers}{$c}{autoreading} = $rauto; # Readingname zur Automatiksteuerung
$data{$type}{$name}{consumers}{$c}{auto} = $auto; # Automaticsteuerung: 1 - Automatic ein, 0 - Automatic aus
$data{$type}{$name}{consumers}{$c}{retotal} = $rtot // q{}; # Reading der Leistungsmessung $data{$type}{$name}{consumers}{$c}{retotal} = $rtot // q{}; # Reading der Leistungsmessung
$data{$type}{$name}{consumers}{$c}{uetotal} = $utot // q{}; # Unit der Leistungsmessung $data{$type}{$name}{consumers}{$c}{uetotal} = $utot // q{}; # Unit der Leistungsmessung
$data{$type}{$name}{consumers}{$c}{rpcurr} = $rpcurr // q{}; # Reading der aktuellen Leistungsaufnahme $data{$type}{$name}{consumers}{$c}{rpcurr} = $rpcurr // q{}; # Reading der aktuellen Leistungsaufnahme
@ -15054,6 +15049,7 @@ return $def;
# $co: Consumer Nummer (01,02,03,...) # $co: Consumer Nummer (01,02,03,...)
# $key: name - Name des Verbrauchers (Device) # $key: name - Name des Verbrauchers (Device)
# alias - Alias des Verbrauchers (Device) # alias - Alias des Verbrauchers (Device)
# autoreading - Readingname f. Automatiksteuerung
# type - Typ des Verbrauchers # type - Typ des Verbrauchers
# state - Schaltstatus des Consumers # state - Schaltstatus des Consumers
# power - nominale Leistungsaufnahme des Verbrauchers in W # power - nominale Leistungsaufnahme des Verbrauchers in W