Skip to content

Fix CO2 remote crash when remote has no CO2 info (#152) - #159

Merged
jasperslits merged 1 commit into
mainfrom
fix/co2-remote-missing-co2-152
Aug 9, 2026
Merged

Fix CO2 remote crash when remote has no CO2 info (#152)#159
jasperslits merged 1 commit into
mainfrom
fix/co2-remote-missing-co2-152

Conversation

@jasperslits

Copy link
Copy Markdown
Owner

Fixes #152

When a configured remote does not include CO2 data, the MQTT payload for that remote can be either null or a dict without a co2 key (e.g. {"remote0":null} or {"remote0":{"timestamp":0,...}}). The previous code did payload[json_field]["co2"], which raised TypeError: 'NoneType' object is not subscriptable or KeyError: 'co2', spamming the Home Assistant log.

This change reads the remote payload with .get() and only extracts co2 when it is a dict, falling back to None otherwise.

🤖 Generated with Claude Code

@jasperslits
jasperslits merged commit a41d542 into main Aug 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Foutmelding in hassio log wrt remote not having Co2 info

1 participant