stjohnjohnson / smartthings-mqtt-bridge

Bridge between SmartThings and MQTT
https://hub.docker.com/r/stjohnjohnson/smartthings-mqtt-bridge/
MIT License
363 stars 241 forks source link

bridge does not pass data #59

Closed Duoxilian closed 7 years ago

Duoxilian commented 7 years ago

Please see the details below. I believe I have everything set up correctly and have validated:

Is there any way I can debug the bridge itself? I guess I could put a network sniffer on but is there a debugging mode for the bridge where I could monitor the events more detailed than inspecting the events.log file? I should comment that I am assuming that the smartthings is not going outside the network to deliver the events.

Please see more detailed evidence below...

  1. smartthings-mqtt-bridge configuration

mqtt: host: mqtt://192.168.1.100:1883 preface: smartthings port: 8080

  1. Smartthings configuration

Name Type Value ip string 192.168.1.100 mac string aa:bb:cc:dd:ee:ff port string 8080

  1. smartthings-mqtt-bridge connects to mosquitto:

1482027047: New client connected from 192.168.1.100 as mqttjs_6c170d31 (c1, k10). 1482027047: Sending CONNACK to mqttjs_6c170d31 (0, 0) ... 1482027057: Received PINGREQ from mqttjs_6c170d31 1482027057: Sending PINGRESP to mqttjs_6c170d31

  1. hass connects to mosquitto:

1482026247: New connection from 192.168.1.100 on port 1883. 1482026247: New client connected from 192.168.1.100 as hass (c1, k60). 1482026247: Sending CONNACK to hass (0, 0) 1482026247: Received SUBSCRIBE from hass 1482026247: smartthings/Water Leak Sensor/battery (QoS 0) 1482026247: hass 0 smartthings/Water Leak Sensor/battery 1482026247: Sending SUBACK to hass 1482026247: Received SUBSCRIBE from hass 1482026247: smartthings/Water Leak Sensor/temperature (QoS 0) 1482026247: hass 0 smartthings/Water Leak Sensor/temperature 1482026247: Sending SUBACK to hass 1482026247: Received SUBSCRIBE from hass 1482026247: smartthings/Water Leak Sensor/water (QoS 0) 1482026247: hass 0 smartthings/Water Leak Sensor/water 1482026247: Sending SUBACK to hass 1482026247: Received SUBSCRIBE from hass 1482026247: hellomqtt/topic (QoS 0) 1482026247: hass 0 hellomqtt/topic 1482026247: Sending SUBACK to hass ... 1482026307: Received PINGREQ from hass 1482026307: Sending PINGRESP to hass

  1. hass understands mqtt requests:

mosquitto_pub -d -t "smartthings/Water Leak Sensor/temperature" -m '{"temperature":"32"}'

Client mosqpub/10493-extra sending CONNECT Client mosqpub/10493-extra received CONNACK Client mosqpub/10493-extra sending PUBLISH (d0, q0, r0, m1, 'smartthings/Water Leak Sensor/temperature', ... (20 bytes)) Client mosqpub/10493-extra sending DISCONNECT

and in the HASS log:

16-12-17 20:03:19 INFO (MainThread) [homeassistant.core] Bus:Handling <Event mqtt_message_received[L]: qos=0, payload={"temperature":"32"}, topic=smartthings/Water Leak Sensor/temperature>

  1. events are being sent (see live log on smartthings)

    597a1453-dfc5-477c-94a3-24122d86e349 8:10:54 PM: debug Forwarding device event to bridge: {"path":"/push","body":{"name":"Water Leak Sensor","value":"70","type":"temperature"}}

But:

Duoxilian commented 7 years ago

OK, I finally worked it out. For the bridge, both the location and the hub need to be defined in the configuration on smartthings.com. After that, events start flowing across the bridge.