Closed TheCellMC closed 7 years ago
Part 1.
Hi, I have having the same problem and have at this point achieved some but not total success. I would thank the code authors for some great work. However there does not seem like there is much in the way of diagnostics if things aren't working after a person follows direction in getting things installed. I am a newbie to Linex, SmartThings, Raspberry Pi, and Networking, which is also a problem
So here are some of approaches I used to trouble shoot. First, get the various pieces running on different computers. I installed Mosquito on my windows PC, along with a free Microsoft Networking Monitoring Tool. I installed Ubuntu Linux on an old laptop, and then the Docker Utility, and finally the Mqtt-Bridge itself. I also installed a free networking monitoring utility called Wireshark. Then I left the HomeAssistant running on the RPi.
After that I was able to work on the HA config and Mosquito config to verify that Mosquito was working and talking to HA. This took some trial and error, as getting the HA config file working was problematic for me. Note there is also several free iOS applications that I was able to download on my iPad to test out the MQTT itself. Finally it was instructive to watch the network traffic back and forth on the network monitor (Microsoft Network Monitor).
I will continue in part 2. After a break.
Part 2.
Per my count there are 5 significant software pieces to this system:
1) HA on the RPi 2) Mosquito MQTT Broker (temporarily running on a windows PC) 3) MQTT-Bridge (temporarily running on an old laptop with UBantu) 4) MQTT-Bridge and associated device (on the ST Hub) 5) MQTT-Smart App (on the ST Hub)
I believe that it qualifies as a complex system.
I have renamed the ST hub pieces to reduce ambuiguity. The MQTT-Bridge I remamed the MQTT-Bridge-Driver, and the associated device that showed up in ST app I call the MQTT-Bridge-Device. The name for the smart app seems good but one can make some minor code edits to get this to show up in the ST web development pages.
Next I worked on getting the ST to MQTT interface working. For a while it seemed that the ST hub was not sending out messages. As I changed the IP address in ST to send test messages to my PC where I had the network monitor, and there weren't any received packets. Then I commented out the call to "hubAction" at the end of the driver code and experimented with my own test hubAction calls and finally got the hub to send out TCP messages.
At this point I installed the MQTT-Bridge on the old laptop with UBantu and found that the Bridge was sending back error messages to the ST hub. (I was now monitoring the network with the wireshark program). My substitute call to the hubAction routine was not sending out proper messages. I went back and tried the original code for hubAction and found it was now working and in fact everything was working. I don't know why things weren't working in the first place.
My next steps will be to try and integrate everything onto the RPi.
Note: one possible problem may be (not sure of this) that during the first call to set things up in Docker one needs to specify a port. Subsequently one also needs to specify a port in the MQTT-Bridge configuration file. I suspect that the docker port and the bridge port refer to different config values, however they must be the same for things to work. I changed the bridge port to 9090 because other software uses 8080. But the Docker startup value was still 8080 in the RPi setup. On the UBantu laptop I was careful to use 9090 in both places. Another potential problem is that the raspberry pi Docker file is different from the regular Docker file on gitHub. I am pretty sure I used the regular Docker file when I was first started out with the RPi. Later I tried the correct file, but still it was not working at that point.
So my purpose in writing this is not really to give information on installation points that may be wrong, but to suggest some tools that a person could use to do some trouble shooting.
Another note: sometimes the MQTT-Bridge was sending messages to the Docker website. I think this may have been when things weren't working. This is probably harmless, but may be a privacy concern to some.
@TheCellMC Did you ever get this working? Figure out what you did wrong? I am having the same issue
I followed these instructions: https://github.com/gilhaz/HomeAssistant_SmarthThings_Homebridge
However, I recently stopped using SmartThings and got an Aeon Labs ZWave stick. I left Smartthings because of the fact that SmartApps can’t run locally. This created delays and meant that my Alarm wouldn’t work without and internet connection.
Yes I did finally get it to work quite a while ago. I believe the secret is to get experience with the individual pieces so that you can troubleshoot the communication problems. I would recommend starting with the mosquitto MQTT. There are some utilities out there (some can run on my iPad) that can manually send and receive messages. Make sure your HA setup is sending out and receiving the verification messages when you switch something.
I would note that I have stopped using the raspberry pi as it started to have some reliability problems (especially with the flash). I now use an Intel nuc running UBuntu, and I have been much more happy with that.
Here are all the steps I did to try to get this working. Would someone mind telling me what I did wrong?
(Also please note that, as I am based in the UK, I use the
graph-eu01-euwest1
SmartThings API.)Setup
I started off by installing the sd card flashed with the Hassbian image.
Then I did:
Then to install MQTT:
I then installed node.js
Then installed smarthings-mqtt-bridge via NPM
And then installed pm2 via NPM
I then edited the smartthings-mqtt-bridge config
I then setup the Device Handler and SmartApp following: https://github.com/stjohnjohnson/smartthings-mqtt-bridge
And then added this to the HA configuration.yaml
And then added a switch to the configuration.yaml
Then
I also did a reboot at the end and checked that both services were running
Logs
So here are the SmartThings logs when the switch is turned on (the smarttapp logs):
And here are the SmartThings logs when the switch is turned on (the device logs):
The HA log:
And the pm2 logs:
So what should I do to fix this? I see the switch in the HA UI but turning it on or off does nothing (same if I turn it on or off via the SmartThings app) As I already said at the begging: as I am based in the UK, I use the graph-eu01-euwest1 smartthings api. So if any of the scripts use the datbase I might need to change the api? Also there is no portforwarding to do if I am correct?