zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

value template returns Unknown when 0

Open henrikseger opened this issue 1 year ago • 1 comments

Hello,

On a nimly lock device the last_unlock_user is a number. But in Home Assistant it now shows as "" when that number is 0. When creating a custom MQTT sensor there is no problem, but the default discovered sensor shows the wrong value ("") instead of 0. If the value is anything else than 0, it works correctly. I've tracked it down to this line of code being the likely problem, as all the MQTT json etc looks good. It's only the representation in the Home Assistant sensor value that the error occurs.

https://github.com/Koenkk/zigbee2mqtt/blob/ba337bd329aeb4ca17735c0cf09b31293c8cff06/lib/extension/homeassistant.ts#L1214

henrikseger avatar Mar 07 '25 21:03 henrikseger

Made a proper problem report instead

henrikseger avatar Mar 07 '25 21:03 henrikseger