diff --git a/CHANGED b/CHANGED index 4e2c3becd..dd573222e 100644 --- a/CHANGED +++ b/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII - SVN + - feature: SYSSTAT: allow stateFormat - feature: Module 70_VIERA supports now module 95_remotecontrol with own layout for VIERA TV - feature: InternalVal function added (like ReadingsVal) diff --git a/FHEM/32_SYSSTAT.pm b/FHEM/32_SYSSTAT.pm index 00200aee0..1bd6af7d6 100644 --- a/FHEM/32_SYSSTAT.pm +++ b/FHEM/32_SYSSTAT.pm @@ -160,9 +160,13 @@ SYSSTAT_GetUpdate($) #my $load = $hash->{loadavg}->get; my $load = SYSSTAT_getLoadAVG( $hash ); - $hash->{STATE} = $load->{avg_1} . " " . $load->{avg_5} . " " . $load->{avg_15} if( defined($load->{avg_1}) ); + readingsBeginUpdate($hash); - readingsSingleUpdate($hash,"load",$load->{avg_1},defined($hash->{LOCAL} ? 0 : 1)); + my $state = $load->{avg_1} . " " . $load->{avg_5} . " " . $load->{avg_15} if( defined($load->{avg_1}) ); + + readingsBulkUpdate($hash,"state",$state); + + readingsBulkUpdate($hash,"load",$load->{avg_1}); my $do_diskusage = 1; if( defined($hash->{INTERVAL_FS} ) ) { @@ -188,14 +192,14 @@ SYSSTAT_GetUpdate($) if( AttrVal($name, "useregex", "") eq "" ) { for my $filesystem (@{$hash->{filesystems}}) { my $fs = $usage->{$filesystem}; - readingsSingleUpdate($hash,$fs->{mountpoint},$fs->{$type},defined($hash->{LOCAL} ? 0 : 1)); + readingsBulkUpdate($hash,$fs->{mountpoint},$fs->{$type}); } } else { for my $filesystem (@{$hash->{filesystems}}) { foreach my $key (keys %$usage) { if( $key =~ /$filesystem/ ) { my $fs = $usage->{$key}; - readingsSingleUpdate($hash,$fs->{mountpoint},$fs->{$type},defined($hash->{LOCAL} ? 0 : 1)); + readingsBulkUpdate($hash,$fs->{mountpoint},$fs->{$type}); } } } @@ -208,14 +212,16 @@ SYSSTAT_GetUpdate($) if( AttrVal($name, "raspberrytemperature", "0") eq 2 ) { $temp = sprintf( "%.1f", (3 * ReadingsVal($name,"temperature",$temp) + $temp ) / 4 ); } - readingsSingleUpdate($hash,"temperature",$temp,defined($hash->{LOCAL} ? 0 : 1)); + readingsBulkUpdate($hash,"temperature",$temp); } } if( AttrVal($name, "raspberrycpufreq", "0") > 0 ) { my $freq = SYSSTAT_getPiFreq($hash); - readingsSingleUpdate($hash,"cpufreq",$freq,defined($hash->{LOCAL} ? 0 : 1)); + readingsBulkUpdate($hash,"cpufreq",$freq); } + + readingsEndUpdate($hash,defined($hash->{LOCAL} ? 0 : 1)); } sub @@ -415,6 +421,7 @@ SYSSTAT_getPiFreq( $ ) If set the entries of the filesystems list are treated as regex.