Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT -> SmartThings Suddenly Stopped Working #80

Open
jmc2016 opened this issue Mar 31, 2017 · 17 comments
Open

MQTT -> SmartThings Suddenly Stopped Working #80

jmc2016 opened this issue Mar 31, 2017 · 17 comments

Comments

@jmc2016
Copy link

jmc2016 commented Mar 31, 2017

Has something in either the smartthings code, or the mqtt bridge code changed to cause MQTT messages to SmartThings to stop working? I had this going for months without any issues, just last week I noticed none of my mqtt based temperature sensors were working. I see all the messages from smartthings to MQTT working fine, but nothing going back. Have been using a raspberry pi 3, also tried wiping the SD card and starting from scratch, same result every time. Any ideas?

@jmutnick
Copy link

I'm having the same problem. No errors in Smartthings, but nothing posting on the bridge on my raspberry pi. Started on the evening of 4/3/2017.

@jmutnick
Copy link

I uninstalled and re-installed and it is now working. Sorry for the false alarm.

@stjohnjohnson
Copy link
Owner

I've been running it since I published this module, and it hasn't failed for me yet. One thing I noticed is if the SmartThings hub reboots and is assigned a new IP then connections will fail.

Should SmartThings get a new IP, you need to re-save the Smart App.

I recommend giving both the Raspberry Pi and the SmartThings Hub a static IP from your router.

@mschwartz
Copy link

mschwartz commented Jul 2, 2017

I've got this problem.

I added a new switch and that caused me to turn off the power, and thus to the smartthings hub.

When I powered on, nothing is coming in to mqtt even.

I checked the settings and the IP, etc., is right in the IDE.

I can send mqtt from my PC and the lights go on/off. I'm just not getting data from the bridge/smartthings at all.

I see messages in the IDE log after changing the slider value for the ceiling fan in the iPhone smartthings app:

9:22:24 PM: debug Forwarding device event to bridge: {"path":"/push","body":{"name":"Ceiling Fan","value":"91","type":"level"}}
7ccd047f-9131-491b-ace4-8dc95e2367d3  9:22:24 PM: debug Sending '{"path":"/push","body":{"name":"Ceiling Fan","value":"91","type":"level"}}' to device
86db73ca-ac45-4800-b11c-27ee32ecba4c  9:22:07 PM: debug Forwarding device event to bridge: {"path":"/push","body":{"name":"Ceiling Fan","value":"53","type":"level"}}
7ccd047f-9131-491b-ace4-8dc95e2367d3  9:22:07 PM: debug Sending '{"path":"/push","body":{"name":"Ceiling Fan","value":"53","type":"level"}}' to device

I don't see anything from my mqtt server, though.

I stopped the bridge, removed the logs, state.json, etc.,, and restarted it.

The only file of interest is the events.log which looks like this:

 tail -f events.log
2017-07-02T04:31:04.006Z - info: Starting SmartThings MQTT Bridge - v1.3.3
2017-07-02T04:31:04.012Z - info: Loading configuration
2017-07-02T04:31:04.026Z - info: Loading previous state
2017-07-02T04:31:04.028Z - info: No previous state found, continuing
2017-07-02T04:31:04.028Z - info: Perfoming configuration migration
2017-07-02T04:31:04.034Z - info: Saving current state
2017-07-02T04:31:04.039Z - info: Connecting to MQTT at mqtt://192.168.0.39
2017-07-02T04:31:04.081Z - info: Configuring autosave
2017-07-02T04:31:04.083Z - info: Configuring API
2017-07-02T04:31:04.213Z - info: Listening at http://localhost:8080

Nothing more, even if I use the smartthings app or alexa to turn on/off things.

I checked in the app that there is an app with all my devices checked so the bridge should work.

I checked in the IDE and the settings have the right IP, MAC address, and port.

Next I'm going to try and kill the device and all that's in the IDE and redo it.

Maybe something in the README about how the hub's IP changing affects things?

Thanks for this.

It's making it possible for me to roll my own HA setup.

@stjohnjohnson
Copy link
Owner

@mschwartz Interesting, it shows no previous state? That indicates it has nothing to listen on. Go into the SmartThings UI on your phone, edit the MQTT bridge app configuration, and just save it. It should send a notification to resubscribe.

@mschwartz
Copy link

It shows previous state, but that state never changed.

I did switch from mosca to mosquitto, but everything worked.

I also switched from using my router to assign IP -> mac address to everything on my network to dnsmasq. In doing so, I definitely renumbered things. I use a netmask of 255.0.0.0, which allows me to have 192.168.0.* for my computers, 192.168.1.* for my mobile devices, 192.168.3.* for home automation (echo, nest, smartthings hub, etc.), 192.168.4.* for my home entertainment devices (TV, apple TV, tivo, etc.).

Everything was working fine until I turned the power off at the circuit breaker to install a new smart switch. When I turned the breaker on agian, the smartthings hub almost certainly got its new assigned IP.

I was able to get it working again. I removed everything in the IDE and reinstalled it all and carefully did the device configuration.

If you want to see screen shots of my HA software, let me know.

I could post them here.

@haXs
Copy link

haXs commented Jul 21, 2017

I think I am also having this issue but I have just done a fresh install, when something happens in Smart Things I can see the message in the bridge log and the state updates in Home Assistant but nothing works the other way, I turn "Plug" off, I see the message in the bridge log but nothing happens after that

@heyjva
Copy link

heyjva commented Jul 27, 2017

I'm running into the same issue. I just installed hass.io and installed the smartthings mqtt bridge add-on. My bridge gets updates from smartthings and home assistant updates accordingly but when I use a switch in home assistant smartthings doesn't receive it. The bridge seems to see it but the smartthings hub doesn't?

@haXs
Copy link

haXs commented Jul 27, 2017

So I managed to fix my issue - for me, I was running the bridge as a docker container and I used the MAC from the docker container but it turns out you have to use the MAC address of the physical host, after I changed that and re-added the app in Smart Things two way traffic started working

@heyjva
Copy link

heyjva commented Jul 28, 2017

I think that was it for me too. I just switched to Hass.io which puts home assistant in a docker and I was using the docker MAC address too. Thanks for your help!!

@mschwartz
Copy link

If he docker container is exposing a port to the network, you clearly/obviously need to use the host's MAC address.

For example, the container exposes port 8080 for HTTP server/access, you'll be able to hit the host that's running the container, port 8080 and get the WWW server.

If the docker container is using docker network between containers only, then the MAC of the container matters (but I've not seen where anyone should care about the container's MAC anyhow...)

@haXs
Copy link

haXs commented Jul 28, 2017

@mschwartz I don't think its fair to say "Clearly/Obviously" as testified by the fact that other people have made this mistake too, If you are new to Docker as I was, having a container in bridge mode and seeing it have a MAC address I believed that was the MAC to use, it was only trial and error that identified my mistake.

@mschwartz
Copy link

I left an explanation for the next people to have the issue so they understand why. It should help with future additions to your set up as you expand it.

@heyjva
Copy link

heyjva commented Jul 28, 2017

Yeah that makes sense @mschwartz. Thanks for the technical explanation. I think what messed me up really was that I was using my router to find the MAC address and it was only showing me the docker MAC. I had to find the pi MAC address somewhere else.

@mschwartz
Copy link

If you don't mind some more technical information...

I turned off dhcp in my router and set up dnsmasq on one of the computers on my LAN. The dnsmasq server does both DHCP and DNS. Since doing this and having DHCP/dnsmasq set DNS server for everything on my LAN to my dnsmasq server, my web browsing and other network activity is much much faster. There's quite a lag, in general, if you're doing DNS lookup over the internet all the time. It's also a lot cleaner than editing your /etc/hosts file on all your computers to have symbolic name to IP address lookup for your LAN.

I have three tips that may help someone.

First, I set my NETMASK to 255.255.0.0. Most people probably just use up to 254 IP addresses for their LAN. This NETMASK allows you to use any IP address in the 192.168.. range. That is, 192.168.0., 192.168.1., 192.168.2.*, and so on. You now have 65536 IP addresses to assign as you see fit.

Second, I set up dnsmasq to assign a static IP to absolutely every device that's normally in my home. That includes my TVs, my harmony hubs, the TiVo DVRs and set top boxes, my phones and tablets, my SmartThings hub... EVERY device!

Third, in order to have a lot of flexibility to adding devices of a particular type (home theater, mobile devices, etc.), I assign a block of 255 IPs to the categories:

  • 192.168.0.* - my router/gateway, my time capsule, etc.
  • 192.168.1.* - my computers and laptops
  • 192.168.2.* - my mobile devices (phones, tablets)
  • 192.168.3.* - my home automation devices (amazon echo, ring doorbell, smartthings hub, thermostat, fitbit scale, etc.)
  • 192.168.4.* - my home entertainment devices (smart tvs, TiVo defices, harmony remotes, roku, apple tv, audo receivers, etc.)

@f00j00
Copy link

f00j00 commented Sep 25, 2017

Hello,

After like...48 hours of configurations, i'm very new to HA, finally, i was able to get it working ST -> HA but not the other way around, in my IDE the MAC there is the PIs, im not using docker...

if i change a light state its reflected on HA but not the other way around...

any help is appreciated.

@f00j00
Copy link

f00j00 commented Sep 26, 2017

anyone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants