Hi All,
Looking for your help again.
My Tasmota flashed switch sends me periodic MQTT message on
“sonoff/tele/SENSOR”
The payload looks like
{
“Time” : “2019-04-10T21:27:23”,
“ENERGY” : {
“TotalStartTime” : “2019-04-08T17:35:14”,
“Total” : 1.717,
“Yesterday” : 0.88,
“Today” : 0.837,
“Power” : 0,
“ApparentPower” : 0,
“ReactivePower” : 0,
“Factor” : 0.0,
“Voltage” : 232,
“Current” : 0.0
}
}
out of which I want to extract the value of Current.
As this is nested JSON and Assuming “Template” is the way forward, I have added value_template: “{{ value_json[‘ENERGY’][‘Current’] }}” in my configuration. So configuration looks like,
switch:
- platform: mqtt
name: SomeThing
command_topic: “sonoff/cmnd/Power”
state_topic: “sonoff/stat/POWER”
payload_on: “ON”
payload_off: “OFF”
json_attributes_topic: “sonoff/tele/SENSOR”
value_template: “{{ value_json[‘ENERGY’][‘Current’] }}”
retain: true
Still HA, is not able to extract the data. In my configuration I see error
Error parsing value: ‘value_json’ is undefined (value: ON, template: {{ value_json[‘ENERGY’][‘Current’] }})
Any idea what am I doing wrong…