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
Template rendering warnings in latest Home Assistant beta for dictionary missing attribute #6987
Comments
After this does: https://www.zigbee2mqtt.io/integration/home_assistant.html#via-home-assistant-entity still work? If yes, please create a PR. |
Made one already actually, its linked above (#6988 ). I don't really see why it wouldn't, the PR is just changing how the state of the sensor gets set somewhat to prevent errors. That type of trigger is just looking for state change events so its downstream of that part. I don't have an easy way to do a mock test of a dev build of Z2M unfortunately since I don't have the spare devices I would need. Later I can try faking it directly using MQTT if need be though. Send discovery messages identical to what Z2M sends and then fake state change events. Will have to do some digging to come up with the mocks though. |
Same here. |
Still coming in:
|
I'm curious to any specific zigbee2mqtt configuration. Do you have any (device specific) configuration about using the legacy api or anything? |
Myself, just a basic/vanilla configuration. |
Same here:
EDIT: I've seen there is a PR attached. This error is WITHOUT the contents of the PR. I have not tested with it. |
I'm using on device like motion sensors, door sensors
and have the same error. If I disable in HA entity sensor "temperature" in those devices, then there is no error. So I think the problem is sending to HA information for blocked sensors for example: |
It seems is being produced by some attributes that for some reason "don't have value". For example, a Xiaomi relay:
If I press For others is not as easy, a vibration sensor:
|
There is also problem with Neo NAS-AB02B0 Siren Alarm:
I'm using autodiscovery, default setup, nothing custom with that device... Also can't set exposed values.... |
Fixed now in the dev branch |
@Koenkk ; Can't seem to find how often you make official release. in other words; When will this issue also be available in the stable branch? So I can benefit from it in my HA installation. |
If you look in the releases list for this repo there's a new minor release on the first of the month every month for the past 6 months like clockwork. So I would guess May 1st unless Koenkk decides this issue or some other recent issue is serious enough to warrant a patch. |
Next release will be 1 may indeed. |
Hello, i'm running dev version and still get this kind of warnings in HA, i think for my Tuya/Moes thermostats:
@Koenkk Any chance to fix that? Or should i open new issue? :) |
@jacekpaszkowski can you try changing zigbee2mqtt/lib/extension/homeassistant.js Line 182 in abd8a09
|
@Koenkk i'm running zigbee2mqtt as HA add-on, i don't know how to change this file :( |
SSH into your machine, go into docker container by executing |
If I understand well, this will be fixed on may.
in configuration.yaml (In Home Assistant). |
hello @Koenkk
in edge version z2m nano not work, only vi and i have homeassistant.js in ./app/lib/extension/ and line is 193 |
@playersct due to code changes line numbers may vary, but there is only one occurrence of " |
Nevermind, it turns out I had another Z2M instance connected to the same Mosquitto server, and that one was not updated to 1.18.3, hence the The only one I still have is
I think it is related to OSRAM plugs and bulbs. |
Hi, it's june now and I have everything up-to-date and still see those errors coming by: Logger: homeassistant.helpers.template Template variable warning: 'dict object' has no attribute 'requested_brightness_level' when rendering '{{ value_json.requested_brightness_level }}' |
Hello, same here
no changes with the last release of june |
Hi, same for me. |
If you are seeing this error that means you have a sensor in HA created by Z2M for a device. However that device is not providing any data for that particular sensor. If you're OK with the sensor having status unknown because you don't care about it then there's a very simple solution - disable the sensor in HA. It will then stop trying to parse the json looking for data which does not exist and reporting If you do care about this sensor because perhaps it is not unknown all the time and reports an actual value occasionally then please provide more info. For example, what device is it and what causes it to report in an actual value for that particular attribute? This warning (not error) is designed to alert you to issues already occurring that you didn't know about. Like having a sensor which always has value |
Got this issue. Error: Possible relevant Z2M configuration options:
Need the legacy api for https://github.com/rgruebel/ha_zigbee2mqtt_networkmap HA MQTT entity:
This is not used in automation because it cannot trigger when the previous action occurs again (e.g. pressing a button a single time, then another single click, the last single click does not trigger). I use it to log the button usage to InfluxDB. HA automation:
This triggers on any incoming message, even if it is the same as the previous one. Looking at the error I think it relates to the 'HA MQTT entity' part. In MQTT Explorer I see the action attribute is only supplied when a user uses the button. I thought the Z2M code changes should result in the action attributes to be present always, so that the workaround on HA side (topic start) is not needed anymore, or am I wrong? |
Have tested this. This removed the error from HA. PR coming |
Hello, I discovered this error/message with the latest Zigbee2MQTT version 1.20.0 (commit #41b67fd). Z2M Logs show following message:
And every time I set the operation mode to "Heat" in Home Assistant, it will be reset to nothing after a short while. What could I do to get rid off this log messages? |
Maybe anyone could help me with my above problem? Is there a fix I could add to And here published topic as it is logged by zigbee2mqtt:
|
I too was also to resolve these same warnings by following the above suggestion. Warning message:
Resolved by modifying zigbee2mqtt/lib/extension/homeassistant.js and replacing the line:
with
Thanks for everyone's posts in this issue |
I also got a lot of
maybe that falls into the same category? |
Z2M 1.21.0-4. Template variable warning: dict object has no element Undefined when rendering '{% set values = {'idle':'off','heat':'heating','cool':'cooling','fan only':'fan'} %}{{ values[value_json.running_state] }}' |
@Yurhik the same problem. |
…f` for Sinope DM2500ZB (#2896) * Adding configuration to Sinope DM2500ZB status led brightness and minimum brightness * Fix missing tz.effect
i have also the problem: Logger: homeassistant.helpers.template Template variable warning: 'dict object' has no attribute 'valve_detection' when rendering '{{ value_json.valve_detection }}' |
me the same for valve siterwell: Logger: homeassistant.helpers.template Template variable warning: dict object has no element Undefined when rendering '{% set values = {'idle':'off','heat':'heating','cool':'cooling','fan only':'fan'} %}{{ values[value_json.running_state] }}' |
i have also the problem: 2021-10-19 01:39:58 ERROR (MainThread) [homeassistant.components.mqtt.climate] Invalid modes mode: During handling of the above exception, another exception occurred: Traceback (most recent call last): |
Still got it in 1.22.0 as in #6987 (comment) Did I miss something? |
core 12.5 Still has the problem with errors in the log for some devices 2021-12-25 10:31:43 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.battery }}' also for the above attributes I get the dict error: Error parsing value: access to attribute 'update' of 'dict' object is unsafe. |
probably the same error here with a new added Sinterwell GS361A-H04 in Homeassistant: After connection Home Assistant shows some errors:
and mqtt shows the error
and
what did i do wrong? |
I'm still getting these warnings on HA startup.
Am I missing something? |
I can confirm, I jsut got:
this is a brand-new raspberry pi install with only one device connected: https://www.zigbee2mqtt.io/devices/HS2WD-E.html#heiman-hs2wd-e |
What happened
Starting in Home Assistant
2021.4.0
templates referencing an attribute of a dictionary which does not exist generate a warnings like this:I traced these errors back to the source and its a result of the discovery payload sent by Z2M to Home Assistant. The discovery payload sends this as the template to use to parse the value for a sensor out of the JSON payload:
For devices which don't report all their attributes all the time (ex. remotes that report an action on button press) this creates a problem. Anytime a payload is received without the attribute a warning is created. This warning will become an error and a failure starting in
2021.10
(see home-assistant/core#48140 )Fortunately there appears to be a relatively easy fix. If the discovery template is changed to this then all the errors should go away:
It's a bit strange to always default to
''
even for numeric attributes but this is what was occurring before. ReturningNone
as the default also works and does not generate a warning (I tested). That might be more correct but not sure if that has any other consequences downstream. Thetrue
is so it only appllies the default if things truly don't exist and not just if they evaluate tofalse
(see default).What did you expect to happen
Not to see a warning for attribute did not exist
How to reproduce it (minimal and precise)
The error above is showing what can occur if you have a remote type device such as Philips 929002398602 that checks in all the time with basic attributes like battery and linkquality and includes an action on button press. You can also create an error like this with any device by doing the following:
filtered_attributes
to tell Z2M to stop reporting one or more attributesThis creates errors like this:
I realize in this particular use case the right fix is just to disable the sensor in Home Assistant (which is what I did). But I don't know all the devices that report some attributes occaisionally, figured it would be good to have a way to simulate that with any device.
Debug info
Zigbee2MQTT version: 1.18.2
Home Assistant version: 2021.4.0b5
Adapter hardware: Conbee II
Adapter firmware version: 0x264a0700
The text was updated successfully, but these errors were encountered: