I just completed setting up my bridge which by all indication works fine. My problem comes up when I try to add devices. I can’t get a clear picture on how to do it via the MQTT docs.
For example, I want to integrate a Smartthings leak sensor into HA but don’t know what syntax to use to get it to show up.
The IDE page gives this info which I don’t know how to use:
Name Water Leak Sensor
Label AC Leak Sensor
Type SmartSense Moisture Sensor
Current States
temperature: 74 F
battery: 78
water: dry
checkInterval: 720
Question: how to you derive your state topic? For example, you end it with “/water”. Where do that come from? Also, is it considered a binary sensor, because it just has “wet” and “dry” options, I.E. one option or another?
The MQTT bridge sends them as prefix/device name/property where the prefix is what you configured in the smartthings mqtt bridge’s config.yml file. It’s ‘smartthings’ by default. The property is any of the attributes that the device type can have. To figure that out you have a few options:
Check out the capability reference for SmartThings. You can see the ‘attributes’ section there for each type along with that it will send for values. I don’t think all device capabilities can be sent through on the bridge but it should be obvious by which ones you could choose in the SmartApp configuration in SmartThings. This is the most useful for finding the values to put in those payload attributes in my example (wet/dry for the water sensor).
Watch the MQTT events yourself. I use the chrome app MQTTLens to subscribe to smarthings/# (anything starting with smartthings/# effectively) on my Home Assistant’s MQTT server and then you can see all the messages flowing through. It can get a bit chatty but you can narrow your subscriptions down too with smarthings/Name of Device/# to see just those.
And yes, I set it up as a binary sensor as it just has two possible states. Wet/dry, open/close, etc.
You can also probably grab the temperature your sensor is sending too with just a ‘sensor’ if it is sending that attribute through on MQTT. Example below of one of my z-wave motion detectors that does temperature too:
sensor:
- platform: mqtt
name: "Upstairs Hall Temperature"
state_topic: "smartthings/Upstairs Hall Sensor/temperature"
unit_of_measurement: "°C"