change license reading
This commit is contained in:
parent
9c9e790d88
commit
9fddd33c83
@ -364,6 +364,7 @@ sub Weather_WriteReadings($$) {
|
|||||||
foreach my $r (keys %{$dataRef} ) {
|
foreach my $r (keys %{$dataRef} ) {
|
||||||
readingsBulkUpdate($hash, $r, $dataRef->{$r})
|
readingsBulkUpdate($hash, $r, $dataRef->{$r})
|
||||||
if ( ref($dataRef->{$r}) ne 'HASH' and ref($dataRef->{$r}) ne 'ARRAY' );
|
if ( ref($dataRef->{$r}) ne 'HASH' and ref($dataRef->{$r}) ne 'ARRAY' );
|
||||||
|
readingsBulkUpdate($hash, '.license', $dataRef->{license}->{text});
|
||||||
}
|
}
|
||||||
|
|
||||||
readingsBulkUpdate($hash, "validity", "up-to-date");
|
readingsBulkUpdate($hash, "validity", "up-to-date");
|
||||||
@ -485,12 +486,13 @@ sub Weather_Get($@) {
|
|||||||
my $value;
|
my $value;
|
||||||
|
|
||||||
if(defined($hash->{READINGS}->{$reading})) {
|
if(defined($hash->{READINGS}->{$reading})) {
|
||||||
$value= $hash->{READINGS}->{$reading}->{VAL};
|
$value = $hash->{READINGS}->{$reading}->{VAL};
|
||||||
} else {
|
} else {
|
||||||
my $rt= "";
|
my $rt = '';
|
||||||
if(defined($hash->{READINGS})) {
|
if(defined($hash->{READINGS})) {
|
||||||
$rt= join(":noArg ", sort keys %{$hash->{READINGS}});
|
$rt = join(":noArg ", sort keys %{$hash->{READINGS}});
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Unknown reading $reading, choose one of " . $rt;
|
return "Unknown reading $reading, choose one of " . $rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ sub _ProcessingRetrieveData($$) {
|
|||||||
localtime( $self->{fetchTime} )
|
localtime( $self->{fetchTime} )
|
||||||
);
|
);
|
||||||
$self->{cached}->{timezone} = $data->{timezone};
|
$self->{cached}->{timezone} = $data->{timezone};
|
||||||
$self->{cached}->{license}->{Text} = $data->{flags}->{'meteoalarm-license'};
|
$self->{cached}->{license}{text} = $data->{flags}->{'meteoalarm-license'};
|
||||||
$self->{cached}->{current} = {
|
$self->{cached}->{current} = {
|
||||||
'temperature' => int(
|
'temperature' => int(
|
||||||
sprintf( "%.1f", $data->{currently}->{temperature} ) + 0.5
|
sprintf( "%.1f", $data->{currently}->{temperature} ) + 0.5
|
||||||
|
@ -250,6 +250,7 @@ sub _ProcessingRetrieveData($$) {
|
|||||||
if ( $self->{endpoint} eq 'weather' ) {
|
if ( $self->{endpoint} eq 'weather' ) {
|
||||||
$self->{cached}->{country} = $data->{sys}->{country};
|
$self->{cached}->{country} = $data->{sys}->{country};
|
||||||
$self->{cached}->{city} = $data->{name};
|
$self->{cached}->{city} = $data->{name};
|
||||||
|
$self->{cached}->{license}{text} = 'none';
|
||||||
$self->{cached}->{current} = {
|
$self->{cached}->{current} = {
|
||||||
'temperature' => int(
|
'temperature' => int(
|
||||||
sprintf( "%.1f", ( $data->{main}->{temp} - 273.15 )
|
sprintf( "%.1f", ( $data->{main}->{temp} - 273.15 )
|
||||||
|
Loading…
Reference in New Issue
Block a user