mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
70_ENIGMA2: convert HDD values to GB
git-svn-id: https://svn.fhem.de/fhem/trunk@14163 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
7289108623
commit
050e02fbba
@ -797,7 +797,7 @@ sub ENIGMA2_Get($@) {
|
|||||||
return "Unknown argument $what, "
|
return "Unknown argument $what, "
|
||||||
. "choose one of power:noArg input:noArg volume:noArg mute:noArg channel:noArg currentMedia:noArg currentTitle:noArg nextTitle:noArg providername:noArg servicevideosize:noArg streamUrl:,mobile ";
|
. "choose one of power:noArg input:noArg volume:noArg mute:noArg channel:noArg currentMedia:noArg currentTitle:noArg nextTitle:noArg providername:noArg servicevideosize:noArg streamUrl:,mobile ";
|
||||||
}
|
}
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1384,19 +1384,37 @@ sub ENIGMA2_ReceiveCommand($$$) {
|
|||||||
my @value =
|
my @value =
|
||||||
split( / /,
|
split( / /,
|
||||||
$return->{e2about}{e2hddinfo}[$i]{capacity} );
|
$return->{e2about}{e2hddinfo}[$i]{capacity} );
|
||||||
readingsBulkUpdate( $hash, $readingname, $value[0] )
|
if (@value) {
|
||||||
if ( @value
|
if ( $value[0] =~ /^\d+(?:\.\d+)?$/ ) {
|
||||||
&& ReadingsVal( $name, $readingname, "" ) ne
|
$value[0] = round( $value[0] * 1024, 1 )
|
||||||
$value[0] );
|
if ( $value[1] && $value[1] =~ /TB/i );
|
||||||
|
$value[0] = round( $value[0] / 1024, 1 )
|
||||||
|
if ( $value[1] && $value[1] =~ /MB/i );
|
||||||
|
$value[0] =
|
||||||
|
round( $value[0] / 1024 / 1024, 1 )
|
||||||
|
if ( $value[1] && $value[1] =~ /KB/i );
|
||||||
|
}
|
||||||
|
readingsBulkUpdateIfChanged( $hash,
|
||||||
|
$readingname, $value[0] );
|
||||||
|
}
|
||||||
|
|
||||||
$readingname = "hdd" . $counter . "_free";
|
$readingname = "hdd" . $counter . "_free";
|
||||||
@value =
|
@value =
|
||||||
split( / /,
|
split( / /,
|
||||||
$return->{e2about}{e2hddinfo}[$i]{free} );
|
$return->{e2about}{e2hddinfo}[$i]{free} );
|
||||||
readingsBulkUpdate( $hash, $readingname, $value[0] )
|
if (@value) {
|
||||||
if ( @value
|
if ( $value[0] =~ /^\d+(?:\.\d+)?$/ ) {
|
||||||
&& ReadingsVal( $name, $readingname, "" ) ne
|
$value[0] = round( $value[0] * 1024, 1 )
|
||||||
$value[0] );
|
if ( $value[1] && $value[1] =~ /TB/i );
|
||||||
|
$value[0] = round( $value[0] / 1024, 1 )
|
||||||
|
if ( $value[1] && $value[1] =~ /MB/i );
|
||||||
|
$value[0] =
|
||||||
|
round( $value[0] / 1024 / 1024, 1 )
|
||||||
|
if ( $value[1] && $value[1] =~ /KB/i );
|
||||||
|
}
|
||||||
|
readingsBulkUpdateIfChanged( $hash,
|
||||||
|
$readingname, $value[0] );
|
||||||
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -1413,18 +1431,34 @@ sub ENIGMA2_ReceiveCommand($$$) {
|
|||||||
$readingname = "hdd1_capacity";
|
$readingname = "hdd1_capacity";
|
||||||
my @value =
|
my @value =
|
||||||
split( / /, $return->{e2about}{e2hddinfo}{capacity} );
|
split( / /, $return->{e2about}{e2hddinfo}{capacity} );
|
||||||
readingsBulkUpdate( $hash, $readingname, $value[0] )
|
if (@value) {
|
||||||
if ( @value
|
if ( $value[0] =~ /^\d+(?:\.\d+)?$/ ) {
|
||||||
&& ReadingsVal( $name, $readingname, "" ) ne
|
$value[0] = round( $value[0] * 1024, 1 )
|
||||||
$value[0] );
|
if ( $value[1] && $value[1] =~ /TB/i );
|
||||||
|
$value[0] = round( $value[0] / 1024, 1 )
|
||||||
|
if ( $value[1] && $value[1] =~ /MB/i );
|
||||||
|
$value[0] = round( $value[0] / 1024 / 1024, 1 )
|
||||||
|
if ( $value[1] && $value[1] =~ /KB/i );
|
||||||
|
}
|
||||||
|
readingsBulkUpdateIfChanged( $hash,
|
||||||
|
$readingname, $value[0] );
|
||||||
|
}
|
||||||
|
|
||||||
$readingname = "hdd1_free";
|
$readingname = "hdd1_free";
|
||||||
@value =
|
@value =
|
||||||
split( / /, $return->{e2about}{e2hddinfo}{free} );
|
split( / /, $return->{e2about}{e2hddinfo}{free} );
|
||||||
readingsBulkUpdate( $hash, $readingname, $value[0] )
|
if (@value) {
|
||||||
if ( @value
|
if ( $value[0] =~ /^\d+(?:\.\d+)?$/ ) {
|
||||||
&& ReadingsVal( $name, $readingname, "" ) ne
|
$value[0] = round( $value[0] * 1024, 1 )
|
||||||
$value[0] );
|
if ( $value[1] && $value[1] =~ /TB/i );
|
||||||
|
$value[0] = round( $value[0] / 1024, 1 )
|
||||||
|
if ( $value[1] && $value[1] =~ /MB/i );
|
||||||
|
$value[0] = round( $value[0] / 1024 / 1024, 1 )
|
||||||
|
if ( $value[1] && $value[1] =~ /KB/i );
|
||||||
|
}
|
||||||
|
readingsBulkUpdateIfChanged( $hash,
|
||||||
|
$readingname, $value[0] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Log3 $name, 5,
|
Log3 $name, 5,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user