mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
SYSMON: fix warnings
git-svn-id: https://svn.fhem.de/fhem/trunk@14106 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
529a3dab04
commit
8f62e3d7ea
@ -3624,7 +3624,9 @@ sub SYSMON_PowerAcInfo($$) {
|
||||
my $type="ac";
|
||||
my $base = "cat /sys/class/power_supply/".$type."/";
|
||||
|
||||
my $d_online = trim(SYSMON_execute($hash, $base."online"));
|
||||
my $d_online_t = SYSMON_execute($hash, $base."online");
|
||||
if($d_online_t) {
|
||||
my $d_online = trim($d_online_t);
|
||||
my $d_present = trim(SYSMON_execute($hash, $base."present 2>/dev/null"));
|
||||
my $d_current = SYSMON_execute($hash, $base."current_now 2>/dev/null");
|
||||
if(defined $d_current) {$d_current/=1000;} else {return $map;}
|
||||
@ -3637,6 +3639,7 @@ sub SYSMON_PowerAcInfo($$) {
|
||||
#$map->{"power_".$type."_voltage"}=$d_voltage;
|
||||
$map->{"power_".$type."_stat"}="$d_online $d_present $d_voltage $d_current";
|
||||
$map->{"power_".$type."_text"}=$type.": ".(($d_present eq "1") ? "present" : "absent")." / ".($d_online eq "1" ? "online" : "offline").", voltage: ".$d_voltage." V, current: ".$d_current." mA, ".(int(($d_voltage*$d_current/100+0.5))/10)." W";
|
||||
}
|
||||
return $map;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user