MQTT - Dict Object has no attribute

From what I’ve ready, you’ll need to fix this as later this year HA will error rather than issue a warning, so things will stop working then.

yes, but how?
Is there somewere a config file were I can initialize all these attributes?

Don’t think there is much you can do.
I have a Tasmota manually configured in HA, since it is using the thermostat example rule.
That is causing the same errors:

2021-04-21 15:39:32 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'Mem3' when rendering '{{ value_json["Mem3"] }}'
2021-04-21 15:39:32 ERROR (MainThread) [homeassistant.components.mqtt.climate] Could not parse temperature from
2021-04-21 15:39:32 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'Mem1' when rendering '{{ value_json["Mem1"] }}'
2021-04-21 15:39:32 ERROR (MainThread) [homeassistant.components.mqtt.climate] Invalid modes mode:
2021-04-21 15:39:32 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'Mem2' when rendering '{{ value_json["Mem2"] }}'
2021-04-21 15:39:32 ERROR (MainThread) [homeassistant.components.mqtt.climate] Could not parse temperature from
2021-04-21 15:39:32 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'Mem3' when rendering '{{ value_json["Mem3"] }}'

Same issue here… Runnig Mosquitto Broaker and Zigbee2MQTT. I tried to reinstall both, but the error persists.

Logger: homeassistant.helpers.template
Source: helpers/template.py:1335
First occurred: 9:14:02 AM (22 occurrences)
Last logged: 9:22:50 AM

Template variable warning: 'dict object' has no attribute 'operation_mode' when rendering '{{ value_json.operation_mode }}'

What devices ?? can you setup this operation_mode in device setting ??
for example i have this issue when one of my socket did not have the option selected
in my case was
image
when i choose one of this 3 option issue don’t show again

Thank you, snp88. I chose one of the options and solved this problem, but I still have the following:

2021-05-05 12:32:59 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'action' when rendering '{{ value_json.action }}'

This is my device:

The “action” command is only sent when any key is pressed, and that command is “empty” in most mqtt messages.

i also have this issue but for diffrent button (sonoff SNZB-01) but recent update of the Z2M addon fix this.
This issue need to be fix i think in Z2M to not send null value for action attribute

It is unrealistic to expect that all these disparate systems that are generating the MQTT messages, they will all get fixed and generate the missing attributes,
HASS should have an option to assume NULL for missing attributes.
I’m sure this decision was not taken lightly, however the implications are huge.

One workaround would be to push all those messages to another MQTT instance, write a small proxy code that reads those messages and publishes to the main MQTT instance.
Ugly but it should work and you wouldn’t need to understand every system that is creating those messages and modify those, all modifications would be centralized.

Regardless I’d like to understand the reasons behind such strict enforcements.

2 Likes

I have been updating the core with every new releases, but the error still persist. I have no idea how to fix this and it seems I am not the only one.

To make it worse, messages like these don’t give any clues as what system put out that message nor which topic it was in.

2021-05-12 07:15:53 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'Dimmer' when rendering '{{ value_json.Dimmer }}'
2021-05-12 07:15:59 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'Dimmer' when rendering '{{ value_json.Dimmer }}'
2021-05-12 07:16:06 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'Dimmer' when rendering '{{ value_json.Dimmer }}'
2021-05-12 07:16:22 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'Dimmer' when rendering '{{ value_json.Dimmer }}'
2021-05-12 07:16:26 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'Dimmer' when rendering '{{ value_json.Dimmer }}'
2021-05-12 07:16:33 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'Dimmer' when rendering '{{ value_json.Dimmer }}'
2021-05-12 07:16:36 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'Dimmer' when rendering '{{ value_json.Dimmer }}'

It looks like Tasmota when Power is ON Dimmer attribute is set, but when Power is OFF, the Dimmer attribute is not set.

Are we expected to make modifications to Tasmota code?
Even if updated Tasmota would fix an issue, some of these devices are set and forget, and it is a major PITA and risk to update. :frowning:

image

Same here with Tuya TS0601_thermostat.

2021-05-14 17:45:24 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'battery' when rendering '{{ value_json.battery }}'
2021-05-14 17:45:25 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'valve_detection' when rendering '{{ value_json.valve_detection }}'
2021-05-14 17:45:25 WARNING (MainThread) [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’m getting the same messages with Tuya Temp/Humidty sensor that I convert with a value template

Template variable error: 'dict object' has no attribute '105' when rendering '{{ (value_json.TuyaReceived['105'].DpIdData | int(base=16)/10) | round(1) }}'
Template variable error: 'dict object' has no attribute '106' when rendering '{{ value_json.TuyaReceived['106'].DpIdData | int(base=16) | round(1) }}'

The values come out of Tasmota so I also am unable to ensure it always sends all values.

Just getting this block of text over and over in the log file… And I only have a few Zigbee devices oaths new instance of Home Assistant.

2021-05-18 02:42:33 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'click' when rendering '{{ value_json.click }}'
2021-05-18 02:42:33 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'action' when rendering '{{ value_json.action }}'
2021-05-18 02:48:37 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-05-18 02:54:44 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-05-18 03:01:09 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-05-18 03:09:00 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-05-18 03:14:52 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-05-18 03:22:24 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-05-18 03:29:21 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-05-18 03:36:58 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-05-18 03:42:43 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'

Is there a reasonable solution or do we just have to turn off the logs completely for homeassistant.helpers.template ?

Following this as my logs are filling up with these as well

2021-06-03 15:20:27 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'click' when rendering '{{ value_json.click }}'
2021-06-03 15:20:27 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'action' when rendering '{{ value_json.action }}'
2021-06-03 15:21:48 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 15:23:10 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 15:23:10 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 15:23:10 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 15:23:20 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 15:29:14 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 15:29:38 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 15:32:19 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'click' when rendering '{{ value_json.click }}'
2021-06-03 15:32:19 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'action' when rendering '{{ value_json.action }}'
2021-06-03 15:35:13 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 15:37:00 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 15:42:05 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 15:43:39 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 15:48:29 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 15:51:02 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 15:55:20 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 15:56:14 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 16:02:42 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 16:03:04 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 16:09:03 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
2021-06-03 16:09:36 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'click' when rendering '{{ value_json.click }}'

Hi everyone, I have just updated my Core to 2021.6.4 and zigbee2mqtt to 1.19.1-1. These are the latest version as of now. And I’m getting similar error flooding the log and seems as of now, we don’t have any solution to resolve this, right?

Please advise.

Logger: homeassistant.helpers.template
Source: helpers/template.py:1366
First occurred: 10:54:12 AM (617 occurrences)
Last logged: 3:25:27 PM

Template variable warning: 'dict object' has no attribute 'linkquality' when rendering '{{ value_json.linkquality }}'
Template variable warning: 'dict object' has no attribute 'power_outage_memory' when rendering '{{ value_json.power_outage_memory }}'
Template variable warning: 'dict object' has no attribute 'temperature' when rendering '{{ value_json.temperature }}'
Template variable warning: 'dict object' has no attribute 'update_available' when rendering '{{ value_json.update_available}}'
Template variable warning: 'dict object' has no attribute 'click' when rendering '{{ value_json.click }}'

Assuming it is expected that those attributes are missing from the json sometimes, you could do, e.g.,

{% if "linkquality" in value_json %}
  {{ value_json.linkquality }}
{% else %}
  0
{% endif %}

May i know where can i define the condition to set some default values?

I know those errors are generated from zigbee2mqtt as some attributes are null values. But not sure if we can set some dummy values for those attributes because the zigbee2mqtt are doing the broadcast.

Heh?

Those lines replace

{{ value_json.linkquality }}

What you do in case those attributes are missing (i.e. the “0” part) is up to you

Hi, I understood the condition. But should I create an automation for that? Or script? Or something else?