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

59_WUup: use CommandAttr for default attributes

git-svn-id: https://svn.fhem.de/fhem/trunk@21541 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mahowi 2020-03-30 06:38:57 +00:00
parent 0302ac4f53
commit e2d1469bdb
2 changed files with 31 additions and 9 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- change: 59_WUup: use CommandAttr for default attributes
- feature: 66_EseraOneWire: add support for Esera 11233, dual output
- bugfix: 71_YAMAHA_AVR: use correct dsp command for RX-V2065 model
- change: 57_Calendar: treatment of cutoffOlderThan amended for series

View File

@ -35,7 +35,7 @@ use HttpUtils;
use UConv;
use FHEM::Meta;
my $version = "0.9.15";
my $version = "0.9.16";
################################################################################
#
@ -93,10 +93,21 @@ sub WUup_Define {
readingsSingleUpdate( $hash, "state", "defined", 1 );
$attr{$name}{room} //= "Weather";
$attr{$name}{unit_windspeed} //= "km/h";
$attr{$name}{unit_solarradiation} //= "lux";
$attr{$name}{round} //= 4;
#$attr{$name}{room} //= "Weather";
CommandAttr( undef, "$name room Weather" )
if ( AttrVal( $name, "room", "" ) eq q{} );
#$attr{$name}{unit_windspeed} //= "km/h";
CommandAttr( undef, "$name unit_windspeed km/h" )
if ( AttrVal( $name, "unit_windspeed", "" ) eq q{} );
#$attr{$name}{unit_solarradiation} //= "lux";
CommandAttr( undef, "$name unit_solarradiation lux" )
if ( AttrVal( $name, "unit_solarradiation", "" ) eq q{} );
#$attr{$name}{round} //= 4;
CommandAttr( undef, "$name round 4" )
if ( AttrVal( $name, "round", "" ) eq q{} );
RemoveInternalTimer($hash);
@ -225,12 +236,21 @@ sub WUup_send {
$url .= "?ID=" . $hash->{helper}{stationid};
$url .= "&PASSWORD=" . $hash->{helper}{password};
my $datestring = strftime "%F+%T", gmtime;
$datestring =~ s/:/%3A/g;
$url .= "&dateutc=" . $datestring;
$attr{$name}{unit_windspeed} //= "km/h";
$attr{$name}{unit_solarradiation} //= "lux";
$attr{$name}{round} //= 4;
#$attr{$name}{unit_windspeed} //= "km/h";
CommandAttr( undef, "$name unit_windspeed km/h" )
if ( AttrVal( $name, "unit_windspeed", "" ) eq q{} );
#$attr{$name}{unit_solarradiation} //= "lux";
CommandAttr( undef, "$name unit_solarradiation lux" )
if ( AttrVal( $name, "unit_solarradiation", "" ) eq q{} );
#$attr{$name}{round} //= 4;
CommandAttr( undef, "$name round 4" )
if ( AttrVal( $name, "round", "" ) eq q{} );
my ( $data, $d, $r, $o );
my $a = $attr{$name};
@ -373,6 +393,7 @@ sub WUup_receive {
# 2020-03-12 use UConv to calculate solarradiation from lux to W/m²
# 2020-03-25 remove prototypes
# 2020-03-26 code cleanup
# 2020-03-30 use CommandAttr for default attributes
#
################################################################################
@ -606,7 +627,7 @@ sub WUup_receive {
"license": [
"gpl_2"
],
"version": "v0.9.15",
"version": "v0.9.16",
"release_status": "stable",
"author": [
"Manfred Winter <mahowi@gmail.com>"