yes, all those that i want are ticked.
I was never able to get automatic discovery working. I manually added all my devices. It felt like a lot of work at the time but Iâm really a lot happier controlling everything in home Assistant.
All the devices and their states show up every time you subscribe to the topic in another mqtt utility which is helpful.
It doesnât support MQTT Discovery.
Went thru the same thing last night trying to figure it out. I did delete MQTT Configuration from my Home assistant configuration file. Deleted the username/password from Mosquito MQTT add-on but had to add all my devices back in to binary_sensor.yaml file to get them to show up. They will not get discovered.
So, if weâre concluding that it canât discover them, @hongtat what was the mqtt utility you used to see all the devices and states?
You have to add the Smarthings devices into HASS manually.
For example: I have a contact sensor âMain Doorâ in ST, I have to add this in HASS -
- platform: mqtt
name: "Main Door Contact"
state_topic: "smartthings/Main Door/contact"
retain: true
- platform: mqtt
name: "Main Door Contact Temperature"
state_topic: "smartthings/Main Door/temperature"
unit_of_measurement: '°C'
retain: true
- platform: mqtt
name: "Main Door Contact Battery"
state_topic: "smartthings/Main Door/battery"
unit_of_measurement: "%"
retain: true
but how did you know that unit_of_measurement was the syntax to use for that device?
You can find them in ST.
Temperature is either C or F.
Battery is usually in %.
Regarding your question about how to see the device states, I use the mqtt command line tools in the terminal. Iâm using mosquitto, so I type the following:
mosquitto_sub -h localhost -v -t smartthings/#
Make sure to change âlocalhostâ to the ip address of you mqtt server. That should print all of your devices and their current state assuming you didnât uncomment the retain: false
line in the mqtt config.
Figuring out the syntax for different devices took me a while. Often I dug through other peoples config examples until I found the hardware I needed to copy. These might be helpful:
I got a SmartThings hub recently. I have lights and water sensors integrated in via the native app at present.
Iâve been working through getting the mqtt-bridge/smartapp/device handler working for HA integration.
All are running on a single host as docker instances;
I have setup HA, mosquitto as my mqtt-broker, configured HA with mqtt and one light, and configured the mqtt-st-bridge container. Everything up to that point appears to be running fine;
From mosquitto / mqtt-broker I see:
1544115808: New connection from 192.168.1.40 on port 1883.
1544115808: New client connected from 192.168.1.40 as 1ec789e6-1e69-4a26-8eb1-5668be164dde (c1, k60).
1544116003: Socket error on client mqttjs_9af5c13f, disconnecting.
1544116004: New connection from 192.168.1.40 on port 1883.
1544116004: New client connected from 192.168.1.40 as mqttjs_432703d4 (c1, k10).
1544116902: Saving in-memory database to /mosquitto/data/mosquitto.db.
The mqtt-st-bridge is listening on 8081 as I have an ubiquiti dockerized service running on 8080 right now.
info: Starting SmartThings MQTT Bridge - v3.0.0
info: Loading configuration
info: Loading previous state
info: Perfoming configuration migration
info: Saving current state
info: Connecting to MQTT at mqtt://192.168.1.40
info: Configuring autosave
info: Configuring API
info: Listening at http://localhost:8081
info: Saving current state
info: Saving current state
The one challenge Iâm seeing is after adding the mqtt bridge Device in the Smartthings IDE it seems to be stuck in âActiveâ and not âOnlineâ and I never see the ST Hub establish a link to the mqtt-st-bridge;
EDIT: apparently I can only put one image in a post, so take my word on the âActiveâ vs âOnlineâ in the IDE, but we can see that you cannot see any connections to the local docker on 8081 below:
$docker exec -it mqtt-st-bridge /bin/sh
/usr/src/app # netstat -an | grep 8081
tcp 0 0 :::8081 :::* LISTEN
/usr/src/app # ifconfig | grep -e "inet addr\|HWaddr"
<snip>
ens160 Link encap:Ethernet HWaddr 00:0C:29:0F:98:A0
inet addr:192.168.1.40 Bcast:192.168.1.255 Mask:255.255.255.0
inet addr:127.0.0.1 Mask:255.0.0.0
I have it properly configured with the IP address, port and MAC
How can I troubleshoot the connection between the ST hub and the mqtt-st-bridge? I see no logs from the Smartthings IDE, and the only Events on the mqtt-device I created is the original creation message.
Hello, is there a way to configure the bridge in a way so it pushes the state for every device in ST every x minutes? Would be useful for instances where something happens and the retained states are lost (and also for devices that have batteries and youâd have to wait until the percentage drops to know their value so you can configure them).
hello have you ever tried the samsung wifi air conditioners?
Should I be seeing anything in the MQTT logs when a Smartthings sensor is opened/closed? Iâm now seeing it in the logs of the ST bridge as well as the <> portion of HA, but not quite sure what to do next lol.
Are you seeing states updating the dev-states
portion? If youâre seeing things update in there as well as the ST Bridge Logs, you should be pretty much ready to go.
I am seeing activities in the dev-states, so now I guess I just need to figure out what to do with this MQTT stuff
Might be overthinking it then. If you set the Status and Command states properly and youâre seeing updates, it sounds like you only need to send commands from HA and see if it properly updates to ST. MQTT is more of in the background rather than front facing.
So I set this all up last night and Iâm seeing messages going from Smartthings to HA. However I canât seem to get messages to go from HA back to Smartthings. If I watch the logs of the smartthings bridge I can see the message there but smartthings doesnât actually do anything with it.
Iâm just testing it with a light bulb and attempting to toggle it on/off (before I add everything else to HA).
info: Incoming message from SmartThings: smartthings/Master Bedroom Closet/switch = on
info: Incoming message from MQTT: smartthings/Master Bedroom Closet/switch = on
info: Skipping duplicate message from: smartthings/Master Bedroom Closet/switch = on
info: Incoming message from MQTT: smartthings/Master Bedroom Closet/switch = off
That is the log from the smartthings bridge docker (and I can see the MQTT message in an app on my desktop as well)
Any suggestions on next steps to debug the problem would be useful.
I have got my pi 3b+ and setup Hassbian as well as MQTT following the instructions here and on youtube here https://youtu.be/lUsMVrs1ot0
Thanks everyone for the suggestions.
I have exposed 1 switch, 1 motion sensor and 1 contact via the STT SmartApp and I can see state changes in the MQTT log on the piâŚ
smartthings/HallwayMotion1/motion active
smartthings/LandingContact/contact closed
smartthings/LandingContact/contact open
smartthings/HallwayMotion1/motion inactive
smartthings/LandingLights/switch on
smartthings/LandingLights/switch off
I have tried to configure the light switch in configuration.yaml to start but I am not seeing the state changes reflected in Overview; the device is shown but its state is not updated on the Overview. see config below -
switch:
platform: mqtt
name: âLandingLightsâ
state_topic: âsmartthings/LandingLights/switchâ
command_topic: âsmartthings/LandingLights/switchâ
payload_on: âonâ
payload_off: âoffâ
retain: true
Does anyone have any advice suggestions and guidance on why this is not working?
Is there an issue with the connection between MQTT and HA? The MQTT icon is in the left hand pane below COnfigurationâŚ
how should I configure these 3 devices within Home Assistant configuration.yaml please?
I am looking for examples to learn fromâŚ