mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
38_netatmo: forecast data check
git-svn-id: https://svn.fhem.de/fhem/trunk@11950 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
10cf444a27
commit
d36dbbd08e
@ -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.
|
||||
- bugfix: 38_netatmo: forecast data check
|
||||
- bugfix: 73_km200.pm: Bugfix for uninitialized values
|
||||
- feature: 73_GasCalculator: New Readings "EnergyXLast" and "EnergyCostXLast"
|
||||
- changed: 98_Hyperion: introducing new attribute hyperionNoSudo
|
||||
|
@ -2530,118 +2530,120 @@ netatmo_parseForecast($$)
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
|
||||
my $i = 0;
|
||||
foreach my $forecastdata ( @{$json->{body}{forecastDays}})
|
||||
if(defined($json->{body}{forecastDays}))
|
||||
{
|
||||
my $i = 0;
|
||||
foreach my $forecastdata ( @{$json->{body}{forecastDays}})
|
||||
{
|
||||
|
||||
|
||||
if(defined($forecastdata->{rain}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_rain", $forecastdata->{rain}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{max_temp}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_temp_max", $forecastdata->{max_temp}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{min_temp}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_temp_min", $forecastdata->{min_temp}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{windangle}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_windangle", $forecastdata->{windangle}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{wind_direction}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_wind_direction", $forecastdata->{wind_direction}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{windgust}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_windgust", $forecastdata->{windgust}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{sun}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_sun", $forecastdata->{sun}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{uv}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_uv", $forecastdata->{uv}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{sunset}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_sunset", FmtDateTime($forecastdata->{sunset}), 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{sunrise}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_sunrise", FmtDateTime($forecastdata->{sunrise}), 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{day_locale}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_day", $forecastdata->{day_locale}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{weather_symbol_day}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_symbol_day", $forecastdata->{weather_symbol_day}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{weather_symbol_night}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_symbol_night", $forecastdata->{weather_symbol_night}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
|
||||
$i++;
|
||||
}#foreach forecast
|
||||
if(defined($forecastdata->{rain}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_rain", $forecastdata->{rain}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{max_temp}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_temp_max", $forecastdata->{max_temp}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{min_temp}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_temp_min", $forecastdata->{min_temp}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{windangle}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_windangle", $forecastdata->{windangle}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{wind_direction}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_wind_direction", $forecastdata->{wind_direction}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{windgust}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_windgust", $forecastdata->{windgust}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{sun}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_sun", $forecastdata->{sun}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{uv}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_uv", $forecastdata->{uv}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{sunset}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_sunset", FmtDateTime($forecastdata->{sunset}), 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{sunrise}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_sunrise", FmtDateTime($forecastdata->{sunrise}), 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{day_locale}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_day", $forecastdata->{day_locale}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{weather_symbol_day}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_symbol_day", $forecastdata->{weather_symbol_day}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
if(defined($forecastdata->{weather_symbol_night}))
|
||||
{
|
||||
readingsBeginUpdate($hash);
|
||||
$hash->{".updateTimestamp"} = FmtDateTime($forecasttime);
|
||||
readingsBulkUpdate( $hash, "fc".$i."_symbol_night", $forecastdata->{weather_symbol_night}, 1 );
|
||||
$hash->{CHANGETIME}[0] = FmtDateTime($forecasttime);
|
||||
readingsEndUpdate($hash,1);
|
||||
}
|
||||
|
||||
$i++;
|
||||
}#foreach forecast
|
||||
}#defined forecastdays
|
||||
|
||||
}#ok
|
||||
}#json
|
||||
|
Loading…
Reference in New Issue
Block a user