2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

76_SolarForecast: contrib 1.0.8

git-svn-id: https://svn.fhem.de/fhem/trunk@28099 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2023-10-28 15:10:22 +00:00
parent 3d55290f3c
commit d404e40245

View File

@ -9101,15 +9101,28 @@ sub __createOwnSpec {
($v->{2}, $u->{2}) = split /\s+/, ReadingsVal ($name, $h->{2}{rdg}, '');
($v->{3}, $u->{3}) = split /\s+/, ReadingsVal ($name, $h->{3}{rdg}, '');
if ($uatr eq 'kWh') {
if ($uatr eq 'kWh') {
for (my $r = 0 ; $r < $vinr; $r++) {
if ($u->{$r} && $u->{$r} =~ /Wh/xs) {
next if(!$u->{$r});
if ($u->{$r} =~ /^Wh/xs) {
$v->{$r} = sprintf "%.1f",($v->{$r} / 1000);
$u->{$r} = 'kWh';
}
}
}
if ($uatr eq 'Wh') {
for (my $r = 0 ; $r < $vinr; $r++) {
next if(!$u->{$r});
if ($u->{$r} =~ /^kWh/xs) {
$v->{$r} = sprintf "%.0f",($v->{$r} * 1000);
$u->{$r} = 'Wh';
}
}
}
$ownv .= "<tr>";
$ownv .= "<td $dstyle>".($cats[$i-1] ? '<b>'.$cats[$i-1].'</b>' : '')."</td>";
$ownv .= "<td $dstyle><b>".$h->{0}{label}.":</b></td> <td align=right $dstyle>".$v->{0}." ".$u->{0}."</td>" if($h->{0}{label});