Can someone help me understand why I am getting continuous errors in
my HA log? This may be easy to fix but I am out of ideas.
I have a few motion sensors defined in my configuration file
as follows:
mqtt:
- sensor:
- name: "Lab Motion"
state_topic: "tele/utilities/SENSOR"
value_template: '{{ value_json["ZbReceived"]["0x3707"]["Occupancy"] }}'
- name: "Lab Motion Battery"
state_topic: "tele/utilities/SENSOR"
value_template: '{{ (value_json["ZbReceived"]["0x3707"]["BatteryVoltage"]) | float | round(2) }}'
Here are two messages from my tasmotized sonoff hub as displayed
on the tasmota console:
08:44:28.958 MQT: tele/utilities/SENSOR = {"ZbReceived":{"0x3707":{"Device":"0x3707","Name":"Lab-Motion","BatteryVoltage":3.03,"BatteryPercentage":100,"Xiaomi_64":0,"Endpoint":1,"LinkQuality":70}}}
08:45:33.709 MQT: tele/utilities/SENSOR = {"ZbReceived":{"0x3707":{"Device":"0x3707","Name":"Lab-Motion","Occupancy":0}}}
Automations are reliably triggered by the motion and battery voltages
are displayed on my dashboard for each motion sensor. Everything
appears to be normal. Yet the log is filled with:
2023-12-09 19:58:08.666 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'Occupancy' when rendering '{{ value_json["ZbReceived"]["0x3707"]["Occupancy"] }}'
There are no similar warnings for "battery voltage".
Any ideas/help appreciated. Thanks.
K