36_Shelly.pm: some minor fixes
git-svn-id: https://svn.fhem.de/fhem/trunk@30483 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -170,6 +170,8 @@
|
|||||||
# 6.04.3 new: Shelly Pro2 UL-type added
|
# 6.04.3 new: Shelly Pro2 UL-type added
|
||||||
# fix: do not set gain to 100% on set hsv|rgb.
|
# fix: do not set gain to 100% on set hsv|rgb.
|
||||||
# 6.04.4 fix: accept set rgbw .. (ShellyPlusRGBWpm)
|
# 6.04.4 fix: accept set rgbw .. (ShellyPlusRGBWpm)
|
||||||
|
# 6.04.5 new: add "less than an hour" to uptime reading
|
||||||
|
# fix: do not format incoming values als float for set power ... etc.
|
||||||
|
|
||||||
# to do new: periods Month and Year for energymeter
|
# to do new: periods Month and Year for energymeter
|
||||||
# to do roller: get maxtime open/close from shelly gen1
|
# to do roller: get maxtime open/close from shelly gen1
|
||||||
@@ -194,7 +196,7 @@ sub Shelly_Set ($@);
|
|||||||
sub Shelly_status(@);
|
sub Shelly_status(@);
|
||||||
|
|
||||||
#-- globals on start
|
#-- globals on start
|
||||||
my $version = "6.04.4 21.10.2025";
|
my $version = "6.04.5 03.11.2025";
|
||||||
|
|
||||||
my $defaultINTERVAL = 60;
|
my $defaultINTERVAL = 60;
|
||||||
my $multiplyIntervalOnError = 1.0; # mechanism disabled if value=1
|
my $multiplyIntervalOnError = 1.0; # mechanism disabled if value=1
|
||||||
@@ -203,7 +205,7 @@ my %shelly_firmware = ( # latest known versions # as of 29.08.2024
|
|||||||
# used by sub Shelly_firmwarecheck
|
# used by sub Shelly_firmwarecheck
|
||||||
"gen1" => "1.14.0", # v1.14.1-rc1
|
"gen1" => "1.14.0", # v1.14.1-rc1
|
||||||
"shelly4" => "1.6.6",
|
"shelly4" => "1.6.6",
|
||||||
"gen2" => "1.7.0",
|
"gen2" => "1.7.1",
|
||||||
"walldisplay" => "2.3.6"
|
"walldisplay" => "2.3.6"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -2435,11 +2437,10 @@ sub Shelly_Set ($@) {
|
|||||||
}
|
}
|
||||||
if( $channel =~ /\D/ || $channel >= $channels ){ # check if channel is anything else than a digit or wrong number
|
if( $channel =~ /\D/ || $channel >= $channels ){ # check if channel is anything else than a digit or wrong number
|
||||||
Shelly_error_handling($hash,"Shelly_Set","Wrong channel <$channel> for command <$cmd>",1);
|
Shelly_error_handling($hash,"Shelly_Set","Wrong channel <$channel> for command <$cmd>",1);
|
||||||
}elsif( $value !~ /[0-9.]/ ){ # check if value is a number
|
}elsif( $value !~ /^[+-]?[0-9.]+$/ ){ # check if value is a number (may have two dots)
|
||||||
Shelly_error_handling($hash,"Shelly_Set","Wrong value <$value> for command <$cmd>",1);
|
Shelly_error_handling($hash,"Shelly_Set","Wrong value <$value> for command <$cmd>",1);
|
||||||
}else{
|
}else{
|
||||||
$subs = $channels>1?"_".$channel:"" ;
|
$subs = $channels>1?"_".$channel:"" ;
|
||||||
$value = sprintf( "%5.2f", $value ); ## %5.1f
|
|
||||||
Shelly_readingsBulkUpdate($hash,$signal.$subs,$value,$signal);
|
Shelly_readingsBulkUpdate($hash,$signal.$subs,$value,$signal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7409,7 +7410,8 @@ sub Shelly_readingsBulkUpdate($$$@){ # derived from fhem.pl readingsBulkUpdateIf
|
|||||||
elsif( $seconds > 192800 ) { $num = int($seconds/86400); # 24 hrsm per day
|
elsif( $seconds > 192800 ) { $num = int($seconds/86400); # 24 hrsm per day
|
||||||
$value .= " (more than $num days)"; }
|
$value .= " (more than $num days)"; }
|
||||||
elsif( $seconds > 86400 ) { $value .= " (more than a day)"; }
|
elsif( $seconds > 86400 ) { $value .= " (more than a day)"; }
|
||||||
else { $value .= " (less than a day)"; } # don't worry if it is exactly a day
|
elsif( $seconds >= 3600 ) { $value .= " (less than a day)"; }
|
||||||
|
else { $value .= " (less than an hour)"; } # don't worry if it is exactly a day
|
||||||
$value .= ", last reboot at ".FmtDateTime(time()-$seconds);
|
$value .= ", last reboot at ".FmtDateTime(time()-$seconds);
|
||||||
}elsif( AttrVal($name,"showunits","none") ne "none" ){
|
}elsif( AttrVal($name,"showunits","none") ne "none" ){
|
||||||
$value .= $si_units{$unit}[1]; # add a si-units string to the reading
|
$value .= $si_units{$unit}[1]; # add a si-units string to the reading
|
||||||
|
|||||||
Reference in New Issue
Block a user