fix integer declaration for temperature values

This commit is contained in:
Marko Oldenburg 2022-12-14 20:10:58 +01:00
parent d4c2f84566
commit 84915674a8

View File

@ -388,18 +388,16 @@ sub _ProcessingRetrieveData($$) {
); );
$self->{cached}{current} = { $self->{cached}{current} = {
'dewPoint' => 'dewPoint' => sprintf( "%.1f", $data->{$unit}{dewpt} ),
int( sprintf( "%.1f", $data->{$unit}{dewpt} ) + 0.5 ), 'heatIndex' => $data->{$unit}{heatIndex},
'heatIndex' => $data->{$unit}{heatIndex},
'precipRate' => $data->{$unit}{precipRate}, 'precipRate' => $data->{$unit}{precipRate},
'precipTotal' => $data->{$unit}{precipTotal}, 'precipTotal' => $data->{$unit}{precipTotal},
'pressure' => int( 'pressure' => int(
sprintf( "%.1f", $data->{$unit}{pressure} ) + 0.5 sprintf( "%.1f", $data->{$unit}{pressure} ) + 0.5
), ),
'temperature' => 'temperature' =>
int( sprintf( "%.1f", $data->{$unit}{temp} ) + 0.5 ), sprintf( "%.1f", $data->{$unit}{temp} ),
'temp_c' => 'temp_c' => sprintf( "%.1f", $data->{$unit}{temp} ),
int( sprintf( "%.1f", $data->{$unit}{temp} ) + 0.5 ),
'wind_chill' => int( 'wind_chill' => int(
sprintf( "%.1f", ( $data->{$unit}{windChill} ) ) + sprintf( "%.1f", ( $data->{$unit}{windChill} ) ) +
0.5 0.5
@ -507,33 +505,27 @@ sub _ProcessingRetrieveData($$) {
) )
) )
), ),
'low_c' => int( 'low_c' => sprintf(
sprintf( "%.1f", "%.1f", $data->{temperatureMin}[$i]
$data->{temperatureMin}[$i] ) + 0.5
), ),
'high_c' => int( 'high_c' => sprintf(
sprintf( "%.1f",
"%.1f", (
( $data->{temperatureMax}[$i]
$data->{temperatureMax}[$i] ? $data->{temperatureMax}[$i]
? $data->{temperatureMax}[$i] : 0
: 0 )
)
) + 0.5
), ),
'tempLow' => int( 'tempLow' => sprintf(
sprintf( "%.1f", "%.1f", $data->{temperatureMin}[$i]
$data->{temperatureMin}[$i] ) + 0.5
), ),
'tempHigh' => int( 'tempHigh' => sprintf(
sprintf( "%.1f",
"%.1f", (
( $data->{temperatureMax}[$i]
$data->{temperatureMax}[$i] ? $data->{temperatureMax}[$i]
? $data->{temperatureMax}[$i] : 0
: 0 )
)
) + 0.5
), ),
} }
); );