MQTT-Smartthings Not Updating Entity State

I’m currently in the process of getting Smartthings setup with MQTT but am running into trouble getting entities to update in Hass. For my configuration, I’m running hass, mqtt, and mqtt-bridge all in docker on an rpi3. As seen by the bridge logs, events are coming through correctly:

mqtt-bridge    | 2018-12-05T22:01:26.068683312Z info: Incoming message from MQTT: smartthings/Living Room Motion Sensor/motion = active
mqtt-bridge    | 2018-12-05T22:01:26.071479020Z info: Skipping duplicate message from: smartthings/Living Room Motion Sensor/motion = active
mqtt-bridge    | 2018-12-05T22:01:30.990645093Z info: Incoming message from SmartThings: smartthings/Living Room Motion Sensor/motion = inactive
mqtt-bridge    | 2018-12-05T22:01:31.001066788Z info: Incoming message from MQTT: smartthings/Living Room Motion Sensor/motion = inactive
mqtt-bridge    | 2018-12-05T22:01:31.002432194Z info: Skipping duplicate message from: smartthings/Living Room Motion Sensor/motion = inactive

However, devices aren’t being updated in Hass UI, they are stuck in the “Off” state. Here’s my configuration.yaml for the broker and the motion sensor from above:

mqtt:
  broker: mqtt

binary_sensor:
  - platform: mqtt    
    state_topic: "smartthings/Living Room Motion Sensor/motion"
    name: "Motion Sensor"
    payload_on: "On"
    payload_off: "Off"
    retain: true
    device_class: "motion"

I’ve been unsuccessful in trying to troubleshoot this issue. I’m using the IP/MAC address of my RPI in the SmartThings device. I’m using docker container names in all other configs. Any help figuring this out would be much appreciated, let me know if I can provide any more info. Thanks!

I’d suggest using an MQTT client to gain a better understanding of what is being transmitted. I use MQTT-Spy (and MQTT.fx) but there are many available. Pick one, get comfortable with it, and it’ll help you track down MQTT issues now and in the future.

Using the client, subscribe to this topic: smartthings/Living Room Motion Sensor/motion. Take note of what is published in its message. If it’s not “On” and “Off” but “active” and “inactive” (or something else) that would explain why it isn’t understood by your binary sensor.

Thanks so much, that helped me fixed it!