Skip to content

v1.6.29 - Fix forecast sensor crash on null fields

Choose a tag to compare

@yashijoe yashijoe released this 02 Jul 06:32

Fix: "Unexpected error updating listener" on forecast sensors (#29)

RainMachineForecastSensor.extra_state_attributes called int(data.get("temperature", 0)). The 0 default only kicks in when the key is absent — but the RainMachine mixer sends an explicit null for some fields on further-out forecast days, so .get() returned None and int(None) raised TypeError (reported 1283×).

Because the attribute calculation aborted, the entire state write failed — which is also why forecast days beyond yesterday/today/tomorrow showed unknown even though the RainMachine UI had them.

Fix

Guard every numeric forecast field (temperature, minTemp, maxTemp, rain, qpf, et0final) with or 0 so an explicit null no longer crashes formatting. Forecast sensors now populate all available days.

Note on °C vs °F

Forecast temperatures come from RainMachine in Celsius and are currently exposed with a hardcoded °C unit. Fahrenheit display is a separate enhancement — thanks @sidsolutions-net for flagging it.