i have a mqtt binary sensor that im trying to pull data from a json output.
so the output when listening to the sensor is:
Message 1 received on diybms2/rule at 18:32:
{
"0": 0,
"1": 0,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0,
"10": 0,
"11": 0,
"12": 0,
"13": 0,
"14": 0
}
QoS: 0 - Retain: false
Message 0 received on diybms2/output at 18:28:
{
"0": 0,
"1": 0,
"2": 0,
"3": 0
}
QoS: 0 - Retain: false
basically the 0,1,2,3,4 are the json topic and then the 0 is either 1 or 0 depending if the relay or rule is on or off
i have my mqtt binary sensors set up like:
binary_sensor:
- name: Cell Over Volt Alarm
state_topic: "diybms2/rule"
value_template: "{{ value_json.3 }}"
payload_on: "1"
payload_off: "0"
- name: Cell Under Volt Alarm
state_topic: "diybms2/rule"
value_template: "{{ value_json.4 }}"
payload_on: "1"
payload_off: "0"
- name: Cell Over Temp Alarm
state_topic: "diybms2/rule"
value_template: "{{ value_json.7 }}"
payload_on: "1"
payload_off: "0"
- name: Cell Under Temp Alarm
state_topic: "diybms2/rule"
value_template: "{{ value_json.8 }}"
payload_on: "1"
payload_off: "0"
##################Relay Trip Status#################
- name: Shunt Trip Alarm
state_topic: "diybms2/output"
value_template: "{{ value_json.0 }}"
payload_on: "1"
payload_off: "0"
all i seem to get is unknown on the state in home assistant , ive triggered the mqtt to get the outputs to change to 1’s and still unknown
any idea as to why its not working? thanks in advance