Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HA type error due to null water_leak property in MQTT payload #9236

Closed
pabigot opened this issue Oct 19, 2021 · 8 comments
Closed

HA type error due to null water_leak property in MQTT payload #9236

pabigot opened this issue Oct 19, 2021 · 8 comments
Labels
problem Something isn't working

Comments

@pabigot
Copy link

pabigot commented Oct 19, 2021

I've got a Aqara water leak sensor, feeding data to Home Assistant (2021.10.6) with zigbee2mqtt version 1.21.2 (both in docker containers).

When the sensor reports Home Assistant (2021.10.6) complains:

2021-10-19 09:26:48 INFO (MainThread) [homeassistant.components.mqtt.binary_sensor]
 No matching payload found for entity: AqWS1 water leak with state topic: zigbee2mqtt/AqWS1.
 Payload: '{"battery":100,"battery_low":null,"linkquality":255,"voltage":3055,"water_leak":null}',
 template output: 'None', with value template 'Template("{{ value_json.water_leak }}")'

After it's been triggered, the null gets replaced by a binary which HA accepts:

Zigbee2MQTT:info  2021-10-19 09:31:53: MQTT publish: topic 'zigbee2mqtt/AqWS1', payload '{"battery":100,"battery_low":null,"linkquality":255,"voltage":3055,"water_leak":null}'
Zigbee2MQTT:info  2021-10-19 09:32:45: MQTT publish: topic 'zigbee2mqtt/AqWS1', payload '{"battery":100,"battery_low":false,"linkquality":255,"tamper":false,"voltage":3055,"water_leak":true}'
Zigbee2MQTT:info  2021-10-19 09:33:07: MQTT publish: topic 'zigbee2mqtt/AqWS1', payload '{"battery":100,"battery_low":false,"linkquality":255,"tamper":false,"voltage":3055,"water_leak":false}'

It's not obvious to me where the property gets processed, or I'd try to provide a patch to initialize it to the correct type.

@pabigot pabigot added the problem Something isn't working label Oct 19, 2021
@Koenkk
Copy link
Owner

Koenkk commented Oct 19, 2021

@emontnemery seems that the binary sensor doesn't allow the unknown (None) value, is this something that can be supported?

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the stale Stale issues label Nov 19, 2021
@emontnemery
Copy link

Sorry, I missed the ping @Koenkk
What do you expect MQTT binary sensor to do if it gets a None value?
It is a binary_sensor after all, so can only be on, off or unavailable.

@Koenkk
Copy link
Owner

Koenkk commented Nov 19, 2021

@emontnemery I would expect its value to be unknown similar to e.g. number

@emontnemery
Copy link

Home Assistant binary sensors only have on+off states. The only other possibility is to set it to unavailable.

@github-actions github-actions bot removed the stale Stale issues label Nov 23, 2021
@Koenkk
Copy link
Owner

Koenkk commented Nov 23, 2021

@emontnemery I see, unavailable doesn't cover it imo. Lets leave it like this.

@emontnemery
Copy link

This will allow binary sensors to have an unknown state: home-assistant/core#60193,

@Koenkk
Copy link
Owner

Koenkk commented Nov 23, 2021

Awesome! I will close this then since it will be solved in HA

@Koenkk Koenkk closed this as completed Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants