File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
custom_components/bureau_of_meteorology/PyBoM Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -121,9 +121,14 @@ async def flatten_forecast_data(self):
121
121
flattened ["uv_end_time" ] = uv ["end_time" ]
122
122
123
123
rain = self .daily_forecasts_data ["data" ][day ]["rain" ]
124
- flattened ["rain_amount_min" ] = rain ["amount" ]["min" ]
125
- flattened ["rain_amount_max" ] = rain ["amount" ]["max" ]
126
124
flattened ["rain_chance" ] = rain ["chance" ]
125
+ flattened ["rain_amount_min" ] = rain ["amount" ]["min" ]
126
+
127
+ # When rain amount max is None, set as rain amount min
128
+ if rain ["amount" ]["max" ] is None :
129
+ flattened ["rain_amount_max" ] = flattened ["rain_amount_min" ]
130
+ else :
131
+ flattened ["rain_amount_max" ] = rain ["amount" ]["max" ]
127
132
128
133
self .daily_forecasts_data ["data" ][day ].update (flattened )
129
134
You can’t perform that action at this time.
0 commit comments