diff --git a/59_Weather.pm b/59_Weather.pm index 9e0c635..49789b7 100755 --- a/59_Weather.pm +++ b/59_Weather.pm @@ -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});