Hi,
I quite new to HA and clearly a beginner with YAML syntax
I try to grap active energy from this long JSON file :
{"device_id":"32212","deveui":"70b3d5e75e017863","device_name":"Triphaso SSS","datetime":"2024-12-09T10:12:29+00:00","timestamp":"1733739149","payload_deciphered":"710A800A000041200035D25400000016001A03A90001B6970000020D000000000000014800000006","data":{"columns":["type","ref","value"],"values":[["Meter","Multi_Fluid|3|IEaPInst",3527.252],["Meter","Multi_Fluid|3|IEaNInst",0.022],["Meter","Multi_Fluid|3|IErPInst",1704.873],["Meter","Multi_Fluid|3|IErNInst",112.279],["Meter","Multi_Fluid|3|IPaP",0.525],["Meter","Multi_Fluid|3|IPaN",0],["Meter","Multi_Fluid|3|IPrP",0.328],["Meter","Multi_Fluid|3|IPrN",0.006]]},"customElement":[]} %}
Could you please help me value_template configuration ?
here is my code but it doesn’t work.
mqtt:
sensor:
# ---------------------------------------
# Triphas'o
# ---------------------------------------
- name: "Triphaso Test"
unique_id: 70b3d5e75e017863
state_topic: "Wiotys/70b3d5e75e017863"
value_template: >
{% set values = value_json.data.values %}
{% for item in values %}
{% if item[1] == 'Multi_Fluid|3|IEaPInst' %}
{{ item[2] }}
{% endif %}
{% endfor %}
unit_of_measurement: "kWh"
state_class: "measurement"
device_class: "energy"