MQTT device_tracker? Smartthings to HASS

I have Smartthings-MQTT-Bridge setup and the ST presence detection setup to track if I’m home or not. It can publish present/not present status to MQTT. I don’t see how to properly setup the payload in HASS.

device_tracker:
  - platform: mqtt
    devices:
      my_iphone: smartthings/My iPhone/presence

Where do I put the payload?
present
not present

The payloads required by HASS for presence detection are different than those supplied by the smartthings-to-mqtt bridge. So I have an automation like this to handle that translation…

- alias: Smartthings Presence Detection
  trigger:
    platform: mqtt
    topic: 'smartthings/+/presence/state'
  action:
    - service: mqtt.publish
      data_template:
        topic: >
          location/{{ trigger.topic.split('/')[1] }}
        payload: >
          {% if trigger.payload == "present" %}home{% else %}not_home{% endif %}

The end result of this is that I have another MQTT topic at /location/Daniel that has the expected HASS payloads in it. The rest of my HASS setup uses /location/Daniel instead of /smartthings/Daniel/presence/state.

My device tracker config then looks like this:

device_tracker:
  - platform: mqtt
    devices:
      daniel: location/Daniel
2 Likes

I can’t get this to work. I added the automation piece and that shows automation.smartthings_presence_detection on. Also I can see smartthings/John’s Phone/presence/cmd and smartthings/John’s Phone/presence/set_state in the subscribing logs, but the sensor never shows in HA. Any ideas?

- platform: mqtt
  devices:
   John’s Phone: location/john

This is likely due to the apostrophe in your device name. try johns_phone instead.