vkorn / hassio-addons

Hass.io add-ons
58 stars 73 forks source link

SmartThingsBridge one way traffic #19

Open mikecairns1 opened 5 years ago

mikecairns1 commented 5 years ago

I hope that this is a simple solution, but I have been trying to fix it for several weeks now.

First, I am using Hass.io plugin

  1. Inbound events are making it from Smartthings to MQTT (Mosquitto) Logs

    info: Incoming message from SmartThings: smartthings/Office/switch/state = on

  2. Sending MQTT published events are making it to the bridge Logs

    info: Incoming message from MQTT: smartthings/Office/switch/cmd = off info: Incoming message from MQTT: smartthings/Office/switch/cmd = off

  3. Commands are not being forwarded to smart things when I use My configuration.yaml entry

    light:

    • platform: mqtt command_topic: "smartthings/Office/switch/cmd" state_topic: "smartthings/Office/switch/state" payload_on: "on" payload_off: "off"

My problem is that I can't control Smartthings devices from MQTT as I would like. Any ideas on what could be wrong?

vkorn commented 5 years ago

Most likely MAC address configured in your custom device is different from the one you have on the device, where bridge is running.

mikecairns1 commented 5 years ago

How would I check that? I did a ifconfig and just grabbed the mac address right off of the device. Does the MAC address need to be in a specific format?

vkorn commented 5 years ago

In your bridge device in SmartThings IDE check

mac | string | B8:27:EB:64:25:29

It has to be capitalized and match your actual device. You can check actual advertising MAC using arping, for example

arping -C 1 192.168.0.111
ARPING 192.168.0.111
60 bytes from b8:27:eb:64:25:29 (192.168.0.111): index=0 time=91.361 msec

--- 192.168.0.111 statistics ---
1 packets transmitted, 1 packets received,   0% unanswered (0 extra)
rtt min/avg/max/std-dev = 91.361/91.361/91.361/0.000 ms
mikecairns1 commented 5 years ago

core-ssh:~# ifconfig eth0 Link encap:Ethernet HWaddr 02:42:AC:1E:21:01 inet addr:172.30.33.1 Bcast:0.0.0.0 Mask:255.255.254.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:54300 errors:0 dropped:0 overruns:0 frame:0 TX packets:16852 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:3958141 (3.7 MiB) TX bytes:1078112 (1.0 MiB)

lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:4 errors:0 dropped:0 overruns:0 frame:0 TX packets:4 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:268 (268.0 B) TX bytes:268 (268.0 B)

core-ssh:~# arping -c 1 192.168.15.17 ARPING to 192.168.15.17 from 172.30.33.1 via eth0 Unicast reply from 192.168.15.17 [02:42:a2:c0:da:e4] 0.086ms Sent 1 probe(s) (1 broadcast(s)) Received 1 replies (0 request(s), 0 broadcast(s))

I added the 02:42:A2:C0:DA:E4 to the preference on the HA device in smartthings with no luck. Any other ideas?

vkorn commented 5 years ago

In you hub device you have something like this, correct?

Device Network Id : 0242A2C0DAE4

And Preferences:

Name Type Value
ip string 192.168.15.17
mac string 02:42:A2:C0:DA:E4
port string 8080

If IP and MAC addresses configured correctly for the hub device, it should just work for regular setup. In general issue you're facing is related to MAC missmatch. I'm no longer using HASSIO, so I don't know whether they've introduced any changes on network level, you should probably try using HASS forum for advice.

mikecairns1 commented 5 years ago

ok thanks. Your work is much appreciate. This is a much needed feature. I will try the HASS forum. My config matches that exactly. I will keep playing around with it an post the answer here when I find it.

vkorn commented 5 years ago

Btw, I think I recall one more possible issue I've read on SmartThings Hub repo: they're suggesting to try and re-publish both App and Handler through the IDE after changing settings. Not sure if it helps, but you can try.

YellowGTO commented 5 years ago

I reread your post and you're correct. Under My Devices the ID must be the mac address with no colons. My Devices > edit > Device Network Id. Under preferences > edit the mac address must be separated by colons.

~~I'm having this exact same issue. Whats interesting is, I set this up 2 days ago on my V1 hub and then my girlfriend reminded me I had bought a V2 hub. So I deleted my hub and added my V2 hub, and could only get one way ST >HA. I figured it was some residual setting and nuked HA and ST starting over from scratch, unfortunately I'm stuck.

The only difference I noticed is the IDE address is different now graph-na04-useast2.api.smartthings.com~~

YellowGTO commented 5 years ago

I lied the issue it back again. Was working when I left, came back and its one way communication again. HA logs look correct. In the ST logs I get a lot of things that look like

14e5e26a-a72d-49e1-9478-REMOVED 2:02:03 PM: debug Parsing 'index:04, mac:00155DFRMV, ip:0A000RMV, port:514C, requestId:bab23849-74fa REMOVED headers:SFRUUC8xLjEgMjAwIE9LDQpYLVBvd2VyZWQtQnk6IEV4cHJlc3MNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA0KQ29udGVudC1MZW5ndGg6IDE1DQpFVGFnOiBXLyJmLXYvWTFKdXNDaFR4clFVelB0TkFLeWNvb09UQSINCkRhdGU6IEZyaSwgMTggSmFuIDIwMTkgMTk6MDI6MDMgR01UDQpDb25uZWN0aW9uOiREMOVED, body:eyJzdGF0dXMREMOVED'

I removed parts of that message. Not really sure what it means so I didn't want to give out sensitive information.

YellowGTO commented 5 years ago

I solved my issue at the bottom of this thread. https://github.com/stjohnjohnson/smartthings-mqtt-bridge/issues/188

Basically you need to make multiple bridges from the ST side.

moishap commented 5 years ago

I saw the bridge would say so, but would not subscribe to the topics and similarly to @YellowGTO, I created separate ST apps.