fix change attribut model

This commit is contained in:
Marko Oldenburg 2019-01-18 19:08:07 +01:00
parent 61c39b23d5
commit b00621193f

View File

@ -131,12 +131,15 @@ sub Weather_DebugCodes($) {
sub Weather_Initialize($) {
my ($hash) = @_;
$hash->{DefFn} = "Weather_Define";
$hash->{UndefFn} = "Weather_Undef";
$hash->{GetFn} = "Weather_Get";
$hash->{SetFn} = "Weather_Set";
$hash->{AttrList}= "disable:0,1 " . $readingFnAttributes;
$hash->{NotifyFn}= "Weather_Notify";
$hash->{DefFn} = 'Weather_Define';
$hash->{UndefFn} = 'Weather_Undef';
$hash->{GetFn} = 'Weather_Get';
$hash->{SetFn} = 'Weather_Set';
$hash->{AttrList}=
'disable:0,1 '
. 'model '
. $readingFnAttributes;
$hash->{NotifyFn}= 'Weather_Notify';
#Weather_DebugCodes('de');
}
@ -432,13 +435,12 @@ sub Weather_Define($$) {
$hash->{API} = $api;
$hash->{APIKEY} = $apikey;
$hash->{APIOPTIONS} = $apioptions;
$attr{$name}->{model} = $api;
#$hash->{UNITS} = "c"; # hardcoded to use degrees centigrade (Celsius)
$hash->{READINGS}->{current_date_time}->{TIME}= TimeNow();
$hash->{READINGS}->{current_date_time}->{VAL}= "none";
$hash->{fhem}->{allowCache}= 1;
CommandAttr(undef,$name . ' model ' . $api) if ( AttrVal($name,'model','none') ne $api );
readingsSingleUpdate($hash,'state','Initialized',1);
Weather_LanguageInitialize($hash->{LANG});