I’m trying to parse multiple values from a single MQTT packet, but I’m not having any luck. So far, only the very last value is populating. What am I doing wrong?
mqtt:
sensor:
-
name: ‘Fresh Water’
unique_id: freshwater
state_topic: ‘home/TheengsGateway/BTtoMQTT/00A0500C499A’
value_template: >
{% set tankidf = value_json.manufacturerdata[12:13] | int %}
{% set tanklevelf = value_json.manufacturerdata[14:18] %}
{% if tankidf == 0 %}
{{ tanklevelf }}
{% else %}
{% endif %} -
name: ‘Black Water’
unique_id: blackwater
state_topic: ‘home/TheengsGateway/BTtoMQTT/00A0500C499A’
value_template: >
{% set tankidb = value_json.manufacturerdata[12:13] | int %}
{% set tanklevelb = value_json.manufacturerdata[14:18] %}
{% if tankidb == 1 %}
{{ tanklevelb }}
{% else %}
{% endif %} -
name: ‘Gray Water’
unique_id: graywater
state_topic: ‘home/TheengsGateway/BTtoMQTT/00A0500C499A’
value_template: >
{% set tankidg = value_json.manufacturerdata[12:13] | int %}
{% set tanklevelg = value_json.manufacturerdata[14:18] %}
{% if tankidg == 2 %}
{{ tanklevelg }}
{% else %}
{% endif %}
`