Integration of diybms and victron via MQTT

Hi, i am new to HA and have issues with integrating may Victron stuff aswell as my diybms.
both sending MQTT messages, which i can find if i listen to “#” in the MQTT broker integration.

if i add the relays like that into the configuration.yaml:

  - platform: mqtt
    state_topic: "diybms/output"
    name: "diybms_relay1"

then the output is this:
Entity: “sensor.diybms_relay1”
State, not Attribute: “{“0”:0,“1”:0,“2”:1,“3”:1}”

if i add them like that:

 - platform: mqtt
    state_topic: "diybms/output"
    name: "diybms_relay2"
    value_template: '{{ value_json.1 }}'

the state is empty.

any advice, which documents/tutorials would guide me to the right place?

Seems like there is a problem with the JSON MQTT message.
another message from the same client:
diybms/status = {“banks”:2,“cells”:4,“uptime”:151126,“commserr”:0,“sent”:78522,“received”:78518,“badcrc”:0,“ignored”:0,“oos”:2,“roundtrip”:1640}
is working!

  - platform: mqtt
    state_topic: "diybms/status"
    name: "diybms_roundtrip"
    value_template: '{{ value_json.roundtrip }}'

Btw the message of the first post is
diybms/output = { “0”: 0, “1”: 0, “2”: 1, “3”: 1}


value_template: '{{ value_json["1"] }}'

@tom_l thanks a lot
Can you explain me the logic behind? i am curious.

This '{{ value_json.1 }}' asks for the second item of the list in value_json (it starts counting from 0, so 1 is the 2nd item) , where as this '{{ value_json["1"] }}' asks for the value of the key called “1”.

1 Like