MQTT Lorawan Chirpstack downstream connections

Hi All,

I can't seem to find much info on this topic so I thought I'd throw it out there to the community.

I have a Dragino LT-22222-L LoRa I/O Controller connected to a Dragino LPS8v2 Gateway running Chirpstack. I have the device connected and communicating with HA via my MQTT mosquitto broker for upstream sensor information. Currently only AVI1_V Voltage readings.

mqtt:
    sensor:
      - name: "gate_battery_voltage"
        device_class: voltage
        unique_id: "gate_battery_voltage"
        state_topic: "lorawan/bf4d4375-c907-4ebc-9fbe-f819eaf45566/device/a840416e165b9925/event/up"
        unit_of_measurement: "V"
        value_template: "{{ value_json.object.AVI1_V }}"

Now I'm onto controlling the Relays via Downstream connections to RO1 and RO2

Any ideas, examples or links to references would be helpful.

Thanks in advance

Perhaps use mqttexplorer to look for likely topic. Can you flip the relys by another method and see what appears in mqttexplorer.

@Spiro, I have the downstream topic
"lorawan/bf4d4375-c907-4ebc-9fbe-f819eaf45566/device/a840416e165b9925/command/down"

Trouble is there isn't a lot of info out there for downstream to Lorawan devices, let alone YAML config for the devices in HA

I'm getting closer. I am reading the voltage of AVI_1 from the LT-22222-L as well as controlling both RO1 and RO2. Below is the config from the configuration.yaml file.

mqtt:
    sensor:
      - name: "gate_battery_voltage"
        device_class: voltage
        unique_id: "gate_battery_voltage"
        state_topic: "lorawan/bf4d4375-c907-4ebc-9fbe-f819eaf45566/device/a840416e165b9925/event/up"
        unit_of_measurement: "V"
        value_template: "{{ value_json.object.AVI1_V }}"

    switch:
      - name: "gate_relay_RO1"
        unique_id: "gate_relay_RO1"
        state_topic: "lorawan/bf4d4375-c907-4ebc-9fbe-f819eaf45566/device/a840416e165b9925/up"
        command_topic: "lorawan/bf4d4375-c907-4ebc-9fbe-f819eaf45566/device/a840416e165b9925/command/down"
        payload_on: '{"devEui": "a840416e165b9925", "confirmed": true, "fPort": 1, "data": "AwER"}'
        payload_off: '{"devEui": "a840416e165b9925", "confirmed": true, "fPort": 1, "data": "AwAR"}'
        state_on: 'ON'
        state_off: 'OFF'
        value_template: "{{ value_json.object.RO1_status }}"
      - name: "gate_relay_RO2"
        unique_id: "gate_relay_RO2"
        state_topic: "lorawan/bf4d4375-c907-4ebc-9fbe-f819eaf45566/device/a840416e165b9925/up"
        command_topic: "lorawan/bf4d4375-c907-4ebc-9fbe-f819eaf45566/device/a840416e165b9925/command/down"
        payload_on: '{"devEui": "a840416e165b9925", "confirmed": true, "fPort": 1, "data": "AxEB"}'
        payload_off: '{"devEui": "a840416e165b9925", "confirmed": true, "fPort": 1, "data": "AxEA"}'
        state_on: 'ON'
        state_off: 'OFF'
        value_template: "{{ value_json.object.RO2_status }}"

The only thing that isn't working is the state of this switch. Therefore the device in HA is not showing the correct switch Icon and is also not displaying the state.

{"deduplicationId":"08932117-78b3-4624-9ed7-d81f34b6292a","time":"2026-06-07T14:24:44.119294+00:00","deviceInfo":{"tenantId":"2ecbf066-bfa4-4a58-bbe3-640e42dcbd49","tenantName":"TenantName","applicationId":"bf4d4375-c907-4ebc-9fbe-f819eaf45566","applicationName":"GateController","deviceProfileId":"96f655e4-ebda-4d93-99a5-21dbf28b1de7","deviceProfileName":"LT22222-L","deviceName":"GateLT22222-L","devEui":"a840416e165b9925","deviceClassEnabled":"CLASS_A","tags":{}},"devAddr":"005409f1","adr":true,"dr":5,"fCnt":72,"fPort":2,"confirmed":false,"data":"Nx8AAAAAAAA8/0E=","object":{"RO2_status":"OFF","AVI1_V":14.111,"DO2_status":"H","RO1_status":"OFF","Work_mode":"2ACI+2AVI","AVI2_V":0.0,"ACI1_mA":0.0,"ACI2_mA":0.0,"DI1_status":"H","DI2_status":"H","DO1_status":"H","Hardware_mode":"LT22222"},"rxInfo":[{"gatewayId":"a84041fdfe2e1150","uplinkId":4045694344,"gwTime":"2026-06-07T14:24:44.119294+00:00","nsTime":"2026-06-07T14:24:44.121175040+00:00","rssi":-62,"snr":13.0,"channel":4,"rfChain":1,"location":{"latitude":-36.88964369551349,"longitude":144.42493915557864},"context":"EOS0kA==","crcStatus":"CRC_OK"}],"txInfo":{"frequency":917600000,"modulation":{"lora":{"bandwidth":125000,"spreadingFactor":7,"codeRate":"CR_4_5"}}},"regionConfigId":"au915_2"}

All fixed. typo in the state_topic. Below is the working config.

mqtt:
    sensor:
      - name: "gate_battery_voltage"
        device_class: voltage
        unique_id: "gate_battery_voltage"
        state_topic: "lorawan/bf4d4375-c907-4ebc-9fbe-f819eaf45566/device/a840416e165b9925/event/up"
        unit_of_measurement: "V"
        value_template: "{{ value_json.object.AVI1_V }}"

    switch:
      - name: "gate_relay_RO1"
        unique_id: "gate_relay_RO1"
        state_topic: "lorawan/bf4d4375-c907-4ebc-9fbe-f819eaf45566/device/a840416e165b9925/event/up"
        command_topic: "lorawan/bf4d4375-c907-4ebc-9fbe-f819eaf45566/device/a840416e165b9925/command/down"
        payload_on: '{"devEui": "a840416e165b9925", "confirmed": true, "fPort": 1, "data": "AwER"}'
        payload_off: '{"devEui": "a840416e165b9925", "confirmed": true, "fPort": 1, "data": "AwAR"}'
        value_template: "{{ value_json.object.RO1_status }}"
        state_on: "ON"
        state_off: "OFF"
      - name: "gate_relay_RO2"
        unique_id: "gate_relay_RO2"
        state_topic: "lorawan/bf4d4375-c907-4ebc-9fbe-f819eaf45566/device/a840416e165b9925/event/up"
        command_topic: "lorawan/bf4d4375-c907-4ebc-9fbe-f819eaf45566/device/a840416e165b9925/command/down"
        payload_on: '{"devEui": "a840416e165b9925", "confirmed": true, "fPort": 1, "data": "AxEB"}'
        payload_off: '{"devEui": "a840416e165b9925", "confirmed": true, "fPort": 1, "data": "AxEA"}'
        value_template: "{{ value_json.object.RO2_status }}"
        state_on: "ON"
        state_off: "OFF"