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
HomeAssistant template warning and error for Hampton Bay/Wink/King of Fans 99432 #8617
Comments
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 |
Not stale, still an issue |
So of all that is in your templates is it only the This is the file: https://github.com/Koenkk/zigbee2mqtt/blob/07a8a78a551f95ef345d97b4f5db79cb85318189/lib/extension/homeassistant.ts |
Can you check if this has been fixed in the latest-dev? Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/how_tos/how-to-switch-to-dev-branch.html) |
Sorry for the delay. I switched to the dev branch and still get the log errors for some reason. I'm not sure why the code didn't fix it - tried restarting home assistant and zigbee2mqtt several times, and reinstalled the mqtt integration. This is the discovery payload I get:
The new default option in the code change doesn't seem to feed into the state_value_template for some reason. |
@mwav3 could you post the Home Assistant warning? I expect that |
I'm still getting the same ones initially, its like the code change to add the default isn't having any impact on the template for some reason
I'm thinking the wrong file may have been updated? I see updates to lib/extension/homeassistant.ts in this PR, but the old PR that made changes to this template by @cmccambridge #7359 updated two other files called lib/extension/homeassistant.js and test/homeassistant.test.js Update: |
After checking out the dev branch make sure you do a |
When I run
I tried npm install but then get errors about python not being installed This was on docker with latest-dev tag |
with docker you don't have to worry about building/installing dependencies, everything is already in the image. Could you provide the debug log when z2m posts something to |
Debug logs show this for light config
And for fan config
Here's one showing current state of the device
Update: |
Do you still get the: |
It didn't make sense I was getting the error because the entire state of the device was being published, including the fan_state. After further testing it only happened when Home Assistant restarted. When it restarted, there was a "retained" message in the MQTT broker on zigbee2mqtt/Bedroom Fan that was only reporting the fan speed an no other values, which created the template error. Shortly after Home Assistant restarted, the MQTT message was updated with all fresh values and the error didn't happen anymore. I deleted the retained message (which I can only guess must have been stuck there from an older version of zigbee2mqtt), and the template error cleared and has not returned. At some point, the device was retaining messages, and then the setting changed and it no longer was. I'm not sure if I did that or it changed when between versions, but I'm closing as this issue was on my end. Thanks for your time and patience. |
What happened
The MQTT template for the Hampton Bay/Wink/King of Fans 99432 was recently updated. Thanks to the great work of @cmccambridge with this PR - #7359 , all fan controls and speeds are now able to be controlled in the Home Assistant template. Home Assistant has also recently updated their templating requirements to be more rigid, and now expects a default and defined value for all template items.
However, two errors still persist in the logs as a result of the template loaded for this fan.
The light template creates the following error:
The fan template creates the following warning:
What did you expect to happen
No errors in the logs and the template follows Home Assistant's requirements. I was able to modify templates to control the fan and light and when I set them in my config file for Home Assistant the error and warning are cleared. I would submit a PR to fix this but unfortunately I do not understand the zigbee2mqtt program enough to find the code and propose changes. Hopefully someone can take these templates and put them in the files so they can be auto-discovered for other users.
Right now, everything works fine and these warnings do not impact performance, but the concern is that starting with the next release for 10/2021 for Home Assistant, any template warning or error will cause the template to fail, and the device will not work and render the device uncontrollable on the next update.
The light template that fixes the error is here:
The fan template that fixes the error is here:
How to reproduce it (minimal and precise)
Error is displayed as soon as the fan is discovered in Home Assistant
Please let me know if you need any other info.
Debug info
Zigbee2MQTT version: 1.21.1
Adapter hardware: CC2652R1, - zzh stick
Adapter firmware version: CC2652R_router_20210128
The text was updated successfully, but these errors were encountered: