mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
59_Weather: attribute disable
git-svn-id: https://svn.fhem.de/fhem/trunk@12559 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1731d74e4d
commit
0027446e13
@ -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.
|
||||
- feature: 59_Weather: attribute disable
|
||||
- new: 10_EQ3BT: Support EQ3 Bluetooth thermostat
|
||||
define living.thermostat EQ3BT <MAC>
|
||||
- updated: 88_HMCCU: New version 3.5
|
||||
|
@ -85,7 +85,7 @@ sub Weather_Initialize($) {
|
||||
$hash->{UndefFn} = "Weather_Undef";
|
||||
$hash->{GetFn} = "Weather_Get";
|
||||
$hash->{SetFn} = "Weather_Set";
|
||||
$hash->{AttrList}= $readingFnAttributes;
|
||||
$hash->{AttrList}= "disable " . $readingFnAttributes;
|
||||
$hash->{NotifyFn}= "Weather_Notify";
|
||||
|
||||
#Weather_DebugCodes('de');
|
||||
@ -116,6 +116,7 @@ sub Weather_RetrieveData($$) {
|
||||
hash => $hash,
|
||||
);
|
||||
|
||||
# this needs to be finalized to use the APIOPTIONS
|
||||
my $maxage= $hash->{fhem}{allowCache} ? 600 : 0; # use cached data if allowed
|
||||
$hash->{fhem}{allowCache}= 1;
|
||||
YahooWeatherAPI_RetrieveDataWithCache($maxage, \%args);
|
||||
@ -302,7 +303,16 @@ sub Weather_GetUpdate($) {
|
||||
my ($hash) = @_;
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
Weather_RetrieveData($name, 0);
|
||||
if($attr{$name} && $attr{$name}{disable}) {
|
||||
Log3 $hash, 5, "Weather $name: retrieval of weather data is disabled by attribute.";
|
||||
readingsBeginUpdate($hash);
|
||||
readingsBulkUpdate($hash, "pubDateComment", "disabled by attribute");
|
||||
readingsBulkUpdate($hash, "validity", "stale");
|
||||
readingsEndUpdate($hash, 1);
|
||||
Weather_RearmTimer($hash, gettimeofday()+$hash->{INTERVAL});
|
||||
} else {
|
||||
Weather_RetrieveData($name, 0);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -368,7 +378,7 @@ sub Weather_Notify($$) {
|
||||
return if($dev->{NAME} ne "global");
|
||||
return if(!grep(m/^INITIALIZED|REREADCFG$/, @{$dev->{CHANGED}}));
|
||||
|
||||
return if($attr{$name} && $attr{$name}{disable});
|
||||
# return if($attr{$name} && $attr{$name}{disable});
|
||||
|
||||
# update weather after initialization or change of configuration
|
||||
# wait 10 to 29 seconds to avoid congestion due to concurrent activities
|
||||
@ -709,6 +719,8 @@ WeatherAsHtmlD($;$)
|
||||
<a name="Weatherattr"></a>
|
||||
<b>Attributes</b>
|
||||
<ul>
|
||||
<li>disable: disables the retrieval of weather data - the timer runs according to schedule,
|
||||
though no data is requested from the API.</li>
|
||||
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>
|
||||
</ul>
|
||||
<br>
|
||||
@ -812,6 +824,8 @@ WeatherAsHtmlD($;$)
|
||||
<a name="Weatherattr"></a>
|
||||
<b>Attribute</b>
|
||||
<ul>
|
||||
<li>disable: stellt die Abfrage der Wetterdaten ab - der Timer läft gemäß Plan doch es werden keine Daten vom
|
||||
API angefordert.</li>
|
||||
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>
|
||||
</ul>
|
||||
<br>
|
||||
|
Loading…
x
Reference in New Issue
Block a user