Help needed with automation and json template warning

I saw that, but I have no clue where to look to fix this. If I look at my log I see this as an example:

Logger: homeassistant.helpers.template
Source: helpers/template.py:1335 
First occurred: 1:26:44 PM (55 occurrences) 
Last logged: 1:48:05 PM

Template variable warning: 'dict object' has no attribute 'led_indication' when rendering '{{ value_json.led_indication }}'
Template variable warning: 'dict object' has no attribute 'energy' when rendering '{{ value_json.energy }}'
Template variable warning: 'dict object' has no attribute 'temperature' when rendering '{{ value_json.temperature }}'
Template variable warning: 'dict object' has no attribute 'voltage' when rendering '{{ value_json.voltage }}'
Template variable warning: 'dict object' has no attribute 'current' when rendering '{{ value_json.current }}'

This does not tell what entity is reporting the error, so I have no clue where to go and fix it. My guess is, that this is Zigbee2mqtt entity or entities but I have many entities reporting temperature, and voltage as an example.

It’s all handled on the zigbee2mqtt side’s discovery. I don’t know how that works, so I can’t help you.

I can add to this discussion that in my case I’ve scoured all my files (config, automations, sensors, etc.) and cannot find some templates mentionned in the logs…
All the templates I use I have corrected using default value, but there seems to be some entities defined elsewhere (inside plugins ?).
Do we have to wait for the developpers of every plugins to fix them ?

Yes, if they are provided by MQTT discovery and you didn’t manually configure them.

For me, it is caused by Zigbee entities. Zigbee2mqtt.

When I press or hold a button on an IKEA switch:

When power on/off IKEA power outlet:

Is anyone else experiencing a breakdown of functionality for Automations using any z2m entities after 2021.4? All devices can be used from HA directly so communication looks fine.

The Release Notes state that this ‘dict object’ message is a just a warning so I’m not sure if this is the cause or something else. System was rock solid before the upgrade.

I’d upgraded z2m to 1.18.2 at the same time as doing HA to 2021.4; so every possibility that z2m is the real culprit.

Do you still have triggers with a click instead of an action? I think they dropped “click” by default as it was already deprecated some time ago in favour of “action”.

1 Like

All using Action, thanks.

Then I don’t know. I would say, do a full restart and if you still have problems go into detail of one of the automations that does not work. For further help I would open a new topic though.

1 Like

Hi there,
Could you please help and mention where exactly you put this exceptions in HA or Zigbee2mqtt part ?

Thanks

General:

The Warning comes because of a undefined variable from zigbee2mqtt. If I understand well, this is already fixed in the dev and will be in the next minor release in May.

My Code:

I changed the

{% if trigger.event.data.room %}

to:

{% if trigger.event.data.room is defined %}

in every automation, where I need a special room which is not necessarily given or the the satellite name, which always exists.

Kay

Hi to everybody, I’m experiencing the same log warnings which in my case are related to mqtt messages sent by a “tasmotized” PZEM which I mainly use in order to compare the power produced by the solar panels and the in house power consumption. Well no problem until the last HA upgrade while now I’m bombarded with those messages although the power values shown by the PZEM seem to be reasonably correct. I read about the “breaking changes” concerning the templates but I wouldn’t know how to address the problem especially because the mqtt connection between the PZEM and HA is “behind the scene”. Anyone having an idea? Thank you
Federico

Is click really deprecated? I used it everywhere and could not find any info regarding that, also now when searching for it…

I answer my own question just to help someone else who could face the same problem. Not knowing how else to get rid of all those warning I just deleted the device from the mqtt integration and then rebooted it to let it reconnect to HA … it appears for now that the warnings are gone

FYI, I read somewhere that rolling back to Mosquitto 5.1 will help resolve the issues, in my case it didn’t change anything…

With Zigbee2MQTT, you need to add these settings to disable it’s legacy code which causes HA 2021.4 and newer to spew warnings.

advanced:
  legacy_api: false
device_options:
  legacy: false

Refer to Still showing " Template variable warning " in HA with Z2M 1.19.1 · Issue #7824 · Koenkk/zigbee2mqtt (github.com)

2 Likes

i have add those options in the AddOn config Zigbee2Mqtt but no changes…

Perhaps a stupid question : its wrote to add thoses lines in “configuration.yaml”, it is under the AddOn Zigbee2Mqtt configuration or under HassOs /config/configuration.yaml ???

Thanks…i m lost…

1 Like

thanks a lot @dbrunt !

i just realise that this config is different from the AddOn config…i am used to modify the config in the AddOn not under “config/Zigbee2mqtt/configuration.yaml”…

Is it normal that my config there is different to the AddOn’s one please?

EDIT : i put the 2 option legacy but still the warning “Template variable warning: ‘dict object’ has no attribute ‘voltage’ when rendering ‘{{ value_json.voltage }}’” is still there.

That is what I see also but I cannot comment about the differences. I too am using the add-on…