My issues resolved themselves today after I updated hass to 0.18 and flipped some switches as a test. Not sure if its related to the hub update today, but it might be a reasonable explanation.
Has anyone experienced issues with simulated contact sensors not updating in ST? Iām posting it into mosquitto and can see it received, then the bridge passes it on and I can see it in the Live Log but nothing happens.
Hoping it is just a bugā¦ this is stopping my garage door project from taking offā¦
Sensor status: Garage Door Sensor - Large (closed)
Mosquitto publish/MQTT command:
$ mosquitto_pub -d -t "smartthings/Garage Door Sensor - Large/contact" -m "open" Received CONNACK Sending PUBLISH (d0, q0, r0, m1, 'smartthings/Garage Door Sensor - Large/contact', ... (4 bytes))
Received by Mosquitto/MQTT:
Received PUBLISH (d0, q0, r0, m0, 'smartthings/Garage Door Sensor - Large/contact', ... (4 bytes)) open
Received by bridge:
smartthings-mqtt-bridge-0 info: Incoming message from MQTT: smartthings/Garage Door Sensor - Large/contact = open
Received by ST:
Parsing 'index:00, mac:<mac_addr>, headers:UE9TVCAvIEhUVFAvMS4xDQpob3N0OiAxOTIuMTY4LjAuMTMzOjM5NTAwDQphY2NlcHQ6IGFwcGxpY2F0aW9uL2pzb24NCmNvbnRlbnQtdHlwZTogYXBwbGljYXRpb24vanNvbg0KY29udGVudC1sZW5ndGg6IDY5DQpDb25uZWN0aW9uOiBjbG9zZQ==, body:eyJuYW1lIjoiR2FyYWdlIERvb3IgU2Vuc29yIC0gTGFyZ2UiLCJ0eXBlIjoiY29udGFjdCIsInZhbHVlIjoib3BlbiJ9' Received device event from bridge: [name:Garage Door Sensor - Large, value:open, type:contact]
Ideas? The contact sensor on my phone just sits there. If I manually click it then it opens/closes just fineā¦ Iāve been banging my head for two days trying to figure this outā¦
Well after some digging around in the SmartThings docs it appears that the contact sensor is read only. It does have one attribute but it isnāt something that can be set. Looks like Iāll have to use another way to track the door.
Anyone have any ideas on this? Still experiencing this behavior.
For the life of me I canāt figure out why I canāt send messages to ST. It seems iām running into similar issues from people above but do not see a solution.
Here is my environment:
Mac Mini running OS X El Capitan
Mosquitto 1.4.8 installed using brew
Node v4.2.1
MQTT broker and Smartthings-MQTT-Bridge are running on the same server
The bridge starts up and i see events coming in from ST:
info: Starting SmartThings MQTT Bridge - v1.2.0
info: Loading configuration
info: Loading previous state
info: Perfoming configuration migration
info: Saving current state
info: Connecting to MQTT at mqtt://localhost:1883
info: Configuring autosave
info: Configuring API
info: Listening at http://localhost:8080
info: Incoming message from MQTT: smartthings/2nd Floor Average Temp/temperature = 20.7
info: Incoming message from MQTT: smartthings/Indoor (1st Floor)/temperature = 23.3
info: Incoming message from MQTT: smartthings/Jasmineās Room Motion/temperature = 20.18
Then I send a message to Mosquitto using the following command and get the following response:
mosquitto_pub -d -t āsmartthings/Guest Bedroom Heater/switchā -m āoffā
Client mosqpub/7454-Donatello. sending CONNECT
Client mosqpub/7454-Donatello. received CONNACK
Client mosqpub/7454-Donatello. sending PUBLISH (d0, q0, r0, m1, āsmartthings/Guest Bedroom Heater/switchā, ā¦ (3 bytes))
Client mosqpub/7454-Donatello. sending DISCONNECT
And I see the following message in the bridge:
info: Incoming message from MQTT: smartthings/Guest Bedroom Heater/switch = off
But nothing happens on the ST side. I installed mosquitto using brew and canāt seem to find where the logs are being outputted everything seams to work expect for the fact that I canāt update ST from MQTT
Iāve checked the ST Device and NetworkID and MAC seem to be correct etc. Any help would be appreciated.
I keep having the issue that no matter what I put into the config.yml the bridge wonāt connect to the mosquitto broker running on the same local host (raspberry pi)ā¦
Iāve tried all of the following combinations:
host: 192.168.1.124 ā local IP address of this RaspberryPi
host: 192.168.1.124:1883
host: localhost
host: localhost:1883
host: 127.0.0.1
host: 127.0.0.1:1883
But every time the pm2 logs show an endless loop of āConnecting to MQTT at mqtt://mqttā
root@raspberrypi:/home/pi# pm2 logs smartthings-mqtt-bridge
[PM2] Tailing last 20 lines for [smartthings-mqtt-bridge] process
smartthings-mqtt-bridge-0 (out): info: Saving current state
smartthings-mqtt-bridge-0 (out): info: Connecting to MQTT at mqtt://mqtt
smartthings-mqtt-bridge-0 (out): info: Starting SmartThings MQTT Bridge - v1.3.3
smartthings-mqtt-bridge-0 (out): info: Loading configuration
smartthings-mqtt-bridge-0 (out): info: Loading previous state
smartthings-mqtt-bridge-0 (out): info: Perfoming configuration migration
smartthings-mqtt-bridge-0 (out): info: Saving current state
smartthings-mqtt-bridge-0 (out): info: Connecting to MQTT at mqtt://mqtt
smartthings-mqtt-bridge-0 (out): info: Starting SmartThings MQTT Bridge - v1.3.3
smartthings-mqtt-bridge-0 (out): info: Loading configuration
smartthings-mqtt-bridge-0 (out): info: Loading previous state
smartthings-mqtt-bridge-0 (out): info: Perfoming configuration migration
smartthings-mqtt-bridge-0 (out): info: Saving current state
smartthings-mqtt-bridge-0 (out): info: Connecting to MQTT at mqtt://mqtt
smartthings-mqtt-bridge-0 (out): info: Starting SmartThings MQTT Bridge - v1.3.3
smartthings-mqtt-bridge-0 (out): info: Loading configuration
smartthings-mqtt-bridge-0 (out): info: Loading previous state
smartthings-mqtt-bridge-0 (out): info: Perfoming configuration migration
smartthings-mqtt-bridge-0 (out): info: Saving current state
smartthings-mqtt-bridge-0 (out): info: Connecting to MQTT at mqtt://mqtt
try this
ā
mqtt: # Specify your MQTT Broker's hostname or IP address here host: mqtt://192.168.0.90:1883 # Preface for the topics $PREFACE/$DEVICE_NAME/$PROPERTY preface: smartthings
I had a similar issueā¦ I had to do what Atomicpapa did and use the IP address. Worked fine after that.
There are also a known issue with the older version of Node.js that Ubuntu (and possibly Raspbian) come with in the repos. Youāll need to perform an update for the bridge to properly connect. I donāt think that is related to your direct issue though.
It appears that you have the ST -> Bridge -> MQTT link setup correctly and vice versa going the other way. I noticed that in your initial āincoming messagesā section, where it lists the status of each item added to the bridge, that āGuest Bedroom Heaterā is not listed. Did you make sure that it is added to the bridge as a āswitchā? Even though youāre publishing the message to MQTT, the ST bridge may not know to look for those messages if not added.
oh yeah itās there, what i posted was just a sample as i have over 80 devices sending messages to MQTT via the Bridge. I still havenāt been able to make changes to ST via MQTT Publish. But I can subscribe and see all the events update for sensors and switches etc. Not sure where to go from here
I guess I was a bit too fast about what this smartapp and setup does. I was hoping I could get MQTT sensor values into SmartThings and that does not seem to be the case, or am I missing something?
Anyone have suggestions on how to add life 360 support to this bridge? Iād like to pass on location and battery info to mqtt.
just add the Life360 info in the Bridge smartapp under Presence Sensorā¦
[edited for clarity and to add picture]
Looks like life360 connect is not showing lat lon, battery, charging, etc. It just shows, home and away.
Hi again. I now have two way communication on a switch between ST and MQTT. I have MQTT temperature sensors I would like to be visible inside ST, how can I do that? I tried @ncherry v_Temperature device handler as well as the simulated temperature sensor by SmartThings but can not get it to work like I want (MQTT temp values will update the temperature state of the ST device).
I publish a new temp value by doing:
mosquitto_pub -h localhost -p 1883 -t 'smartthings/TestTemp/temperature' -m '17'
And I can see that the MQTT bridge is getting it:
Received device event from bridge: [name:TestTemp, value:17, type:temperature]
But nothing happens and it does not seem like the TestTemp virtual sensor is getting anything. I guess I should see the virtuall temp sensor device handler getting a parse call or? I am a newbie with device handlers so not sure what to expect.
Am I on the right path or are temperature sensors (even virtual or simulated) read only and can not go through the MQTT bridge?
Hi Klas, I havenāt really look at it recently but just noticed that the value posted to the virtual devices doesnāt show in the ST App. But MQTT does reflect the changes that the ST App shows (Up/Down. Iāll need to look at that. Sorry
Oh, I can control the lights and switches from mqtt, that I do quite often (weird).
Thanks Neil. I guess a switch is something with a controllable state so it makes sense it can work both directions. I have also seen state info coming to MQTT but it seems reflecting changes back to ST is the tricky part. Maybe a temp sensor with thermostat capabilities that are linked could be a way to āfixā that but it sounds like a bit of a Franken-sensor to me
Iāve upgraded to the latest STJ code (thanks STJ & Jeremiah) and finally figured out how to set a presence virtual device via mqtt (yea). I added that code to the MQTT Smart App (SA) code. I found the one thing that drove me nuts, the presence device code lacked the commands code. I added this to the device code and MQTT SA. I saw the same debug message so I suspect that there is a bit of code missing Iāll try this a bit later today and Iāll report back afterwards.
Just so the curious have something to look at:
and the vPresence code (donāt bother with the other presence code). I also need to clean up the codeā¦
Iāve done a bit more work on the device types (temperature and humidity) and MQTT code. I can now get my values from mqtt topics for my arduino DHT (temperature and humidity). I discovered that I canāt get the barometerās values (unless I used the temperature DT). Iāve learned a lot about the DTs.
So this would now work:
mosquitto_pub -h localhost -p 1883 -t āsmartthings/TestTemp/temperatureā -m ā17ā
with the mqtt and device type changes.