Open tube0013 opened 8 years ago
Do you have an MQTT client that you could use to connect directly to the MQTT broker and look at the values? It would be useful to see what is making it to the broker.
I just installed the chrome mqtt lens app, pointed to the mqtt host and had it subscribe to smartthings/Back Door/temperature. but am not seeing any thing.
You should be able to subscribe to smartthings/#
to see every message that comes from the SmartThings bridge.
If you look in the installation directory for mqtt-bridge (possibly /opt/mqtt-bridge), what files do you see? You should see the following if everything is working:
access.log
config.yml
events.log
state.json
Can you paste the contents of everything you see in that directory?
I see:
access.log config.yml events.log state.json error.log
in error.log:
2016-04-28T16:40:13.473Z - error: middlewareError date=Thu Apr 28 2016 16:40:13 GMT+0000 (UTC), pid=18, uid=0 , gid=0, cwd=/usr/src/app, execPath=/usr/local/bin/node, version=v4.4.3, argv=[/usr/local/bin/node, /usr/src/ app/server.js], rss=48738304, heapTotal=35288672, heapUsed=31038392, loadavg=[0.515625, 0.5576171875, 0.55468 75], uptime=304465, trace=[column=null, file=null, function=Object.parse, line=null, method=parse, native=tru e, column=17, file=/usr/src/app/node_modules/body-parser/lib/types/json.js, function=parse, line=88, method=n ull, native=false, column=18, file=/usr/src/app/node_modules/body-parser/lib/read.js, function=null, line=116 , method=null, native=false, column=16, file=/usr/src/app/node_modules/body-parser/node_modules/raw-body/inde x.js, function=invokeCallback, line=262, method=null, native=false, column=7, file=/usr/src/app/node_modules/ body-parser/node_modules/raw-body/index.js, function=done, line=251, method=null, native=false, column=7, fil e=/usr/src/app/node_modules/body-parser/node_modules/raw-body/index.js, function=IncomingMessage.onEnd, line= 308, method=onEnd, native=false, column=13, file=events.js, function=emitNone, line=67, method=null, native=f alse, column=7, file=events.js, function=IncomingMessage.emit, line=166, method=emit, native=false, column=12 , file=_stream_readable.js, function=endReadableNT, line=913, method=null, native=false, column=9, file=node. js, function=nextTickCallbackWith2Args, line=442, method=null, native=false], stack=[SyntaxError: Unexpected token w, at Object.parse (native), at parse (/usr/src/app/node_modules/body-parser/lib/types/json.js: 88:17), at /usr/src/app/node_modules/body-parser/lib/read.js:116:18, at invokeCallback (/usr/src/app/ node_modules/body-parser/node_modules/raw-body/index.js:262:16), at done (/usr/src/app/node_modules/body- parser/node_modules/raw-body/index.js:251:7), at IncomingMessage.onEnd (/usr/src/app/node_modules/body-pa rser/node_modules/raw-body/index.js:308:7), at emitNone (events.js:67:13), at IncomingMessage.emit (e vents.js:166:7), at endReadableNT (_stream_readable.js:913:12), at nextTickCallbackWith2Args (node.js :442:9)], url=/subscribe, accept=*/*, user-agent=Linux UPnP/1.0 SmartThings, host=192.168.1.212:8080, content -type=application/json, content-length=879, method=POST, httpVersion=1.1, originalUrl=/subscribe
In the smartthings IDE live log, I see the following un MQTT:
5d13b7ac-2dd4-47e2-9eb1-b24cfbb95fe9 1:25:08 PM: debug Parsing 'index:17, mac:60A44C428799, ip:C0A801D4, port:1F90, requestId:7edb6392-a1d2-4472-bc0f-ad39c17ba2ef, headers:SFRUUC8xLjEgMjAwIE9LDQpYLVBvd2VyZWQtQnk6IEV4cHJlc3MNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA0KQ29udGVudC1MZW5ndGg6IDE1DQpFVGFnOiBXLyJmLURIZHBsNU0rdGdnenMzdnE5RGdVeUEiDQpEYXRlOiBGcmksIDI5IEFwciAyMDE2IDE3OjI1OjA4IEdNVA0KQ29ubmVjdGlvbjoga2VlcC1hbGl2ZQ==, body:eyJzdGF0dXMiOiJPSyJ9' 5d13b7ac-2dd4-47e2-9eb1-b24cfbb95fe9 1:25:07 PM: debug Sending '{"path":"/subscribe","body":{"devices":{"notify":["Contacts","System"],"acceleration":[],"alarm":[],"battery":[],"presence":[],"button":[],"carbonDioxide":[],"carbonMonoxide":[],"hue":[],"saturation":[],"color":[],"colorTemperature":[],"consumable":[],"contact":[],"door":[],"energy":[],"illuminance":[],"image":[],"level":[],"lock":[],"activities":[],"currentActivity":[],"motion":[],"status":[],"trackDescription":[],"trackData":[],"mute":[],"pH":[],"power":[],"humidity":[],"switch":[],"shock":[],"lqi":[],"rssi":[],"sleeping":[],"smoke":[],"sound":[],"steps":[],"goal":[],"soundPressureLevel":[],"tamper":[],"temperature":[],"heatingSetpoint":[],"coolingSetpoint":[],"thermostatSetpoint":[],"thermostatMode":[],"thermostatFanMode":[],"thermostatOperatingState":[],"threeAxis":[],"timeRemaining":[],"sessionStatus":[],"touch":[],"voltage":[],"water":[],"windowShade":[]}}}' to device
And under MQTT Bridge:
720f430e-2c55-4f16-81b5-e0b299b51b1d 1:25:06 PM: debug Updating subscription: {"path":"/subscribe","body":{"devices":{"notify":["Contacts","System"],"acceleration":[],"alarm":[],"battery":[],"presence":[],"button":[],"carbonDioxide":[],"carbonMonoxide":[],"hue":[],"saturation":[],"color":[],"colorTemperature":[],"consumable":[],"contact":[],"door":[],"energy":[],"illuminance":[],"image":[],"level":[],"lock":[],"activities":[],"currentActivity":[],"motion":[],"status":[],"trackDescription":[],"trackData":[],"mute":[],"pH":[],"power":[],"humidity":[],"switch":[],"shock":[],"lqi":[],"rssi":[],"sleeping":[],"smoke":[],"sound":[],"steps":[],"goal":[],"soundPressureLevel":[],"tamper":[],"temperature":[],"heatingSetpoint":[],"coolingSetpoint":[],"thermostatSetpoint":[],"thermostatMode":[],"thermostatFanMode":[],"thermostatOperatingState":[],"threeAxis":[],"timeRemaining":[],"sessionStatus":[],"touch":[],"voltage":[],"water":[],"windowShade":[]}}}
Is there content in state.json and access.log? The state file should indicate whether or not the bridge has received state information from SmartThings. Access.log would indicate that there is some form of communication happening from SmartThings.
Also, could you subscribe to smartthings/#
in your mqtt client to see if anything ever shows up under smartthings/ at all?
Sorry it's not working for you yet, but we should be able to sort it out.
thank you.
my state.json file contains the following:
more state.json { "subscriptions": [ "smartthings/Contacts/notify", "smartthings/System/notify" ], "callback": "192.168.1.128:39500", "history": {}, "version": "1.3.3" }
The access.log is filled with entries like this.
2016-05-01T02:17:39.952Z - info: HTTP POST /inform statusCode=404, url=/inform, host=192.168.1.212, connection=Close, user-agent=AirControl Agent v1.0, content-type=application/x-binary, content-length=3992, method=POST, httpVersion=1.1, originalUrl=/inform, , responseTime=35
this is apparently coming from my Ubiquity access point or the Unifi controller software... I shut down the controller, and still getting it, so I think its coming from the access point.
When I use a mqtt client and subscribe to smartthings/# I don't get any thing at all.
So now I went into the mobile app and dug into the smartapp in smartthings, and went through and ticked off all my devices I want to pass through to HA. I think this was a missed step. now I started to see a few things in the mqtt client.
I then decided to try and clean up the access.log by changing the port that mqtt-bridge is running on so I changed the port to 8089 in the config.yml file. but when I try to restart the docker image, it is still trying to bind to 8080. (my configs are in the default /opt/mqtt-bridge/)
Oh this is great. So I imagine that after you ticked off the items in the app, values start showing up directly in Home Assistant?
Hmmm I haven't seen it binding to the wrong port before. If you want it to bind to a different port on the host, you would have to change that in your docker run command though. Are you using docker-compose by chance, or individual docker run commands?
I'm running individual docker commands. I figured out that I had to issue a new run command and got it to bind to a new port. I think now my biggest issue is just the learning curve to understand the configuration of devices. The MQTT client is showing me most of the activity I'm expecting. It's just a matter of adding that into HA's config now. I mostly have contact sensors, tilt sensor for garage and a custom http device to control a relay on a pi for the garage door opener. I don't have a lot of time so I've just been trying to find examples. I still am not getting a reading a temperature from the original sensor I tried to set up, but I don't know if it's functioning correctly. I did add a binary sensor for another door, and it seems to be working. just not sure how to get to say open/closed instead of on/off.
This issues can probably be closed. The biggest hurdle not in the documentation for the bridge integration was needing to enable each device in the new smartapp on the ST side.
Following up on this. I power cycled the sensor I was trying to bring into HA, and it's now updating in Smartthings, and I see it in the MQTT client. Yet for HA, it is not showing the temperature value.
theis is from the log mqtt client log, it was last night and I can't see the actual payload now, but it was showing as a realistic temperature in F.
2016-05-04 21:42:50,889 INFO --- MqttFX ClientModel : messageArrived for: smartthings/Back Door/temperature 2016-05-04 21:42:50,890 INFO --- MqttFX ClientModel : messageArrived: 2641
In the HA Config I have the following:
`sensor:
I see the logbook in HA sees the update
But the state never gets the value from the payload:
Remove the value template. That's for parsing json in the mqtt message. Smartthings only publishes a value, not json. On Thu, May 5, 2016 at 06:34 tube0013 notifications@github.com wrote:
Following up on this. I power cycled the sensor I was trying to bring into HA, and it's now updating in Smartthings, and I see it in the MQTT client. Yet for HA, it is not showing the temperature value.
theis is from the log mqtt client log, it was last night and I can't see the actual payload now, but it was showing as a realistic temperature in F.
2016-05-04 21:42:50,889 INFO --- MqttFX ClientModel : messageArrived for: smartthings/Back Door/temperature 2016-05-04 21:42:50,890 INFO --- MqttFX ClientModel : messageArrived: 2641
In the HA Config I have the following:
`sensor:
- platform: mqtt state_topic: "smartthings/Back Door/temperature" name: "Back Door Temperature" qos: 0 unit_of_measurement: "∞F" value_template: '{{ value.x }}'`
I see the logbook in HA sees the update
[image: screen shot 2016-05-05 at 9 30 37 am] https://cloud.githubusercontent.com/assets/11084412/15044712/638a05c8-12a4-11e6-9e52-939d291f0614.png
But the state never gets the value from the payload:
[image: screen shot 2016-05-05 at 9 31 10 am] https://cloud.githubusercontent.com/assets/11084412/15044724/73fa7564-12a4-11e6-9260-2cba95ba1b42.png
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/stjohnjohnson/smartthings-mqtt-bridge/issues/39#issuecomment-217155682
-St. John
Thank you!
Do you have any guidance for how to get HA to reflect Open/Closed state for a contact sensor in ST?
binary_sensor:
platform: mqtt
state_topic: "smartthings/Front Door/contact"
name: "Front Door"
qos: 0
payload_on: "open"
payload_off: "closed"
sensor_class: opening
Hmm, it should be open, closed like you said. http://docs.smartthings.com/en/latest/capabilities-reference.html#contact-sensor
I haven't used the contact sensor in SmartThings, but I have used the Binary Sensor in Home Assistant:
My config:
- platform: mqtt
state_topic: "camera/Door/motion"
name: Door Motion
payload_on: "active"
payload_off: "inactive"
Hmm, I take that back. I currently do use a door sensor:
sensor:
- platform: mqtt
state_topic: "smartthings/Screen Door/contact"
name: Nursery Door
Hi - I am hitting an issue where smartthings is reporting changes in value to the mqtt bridge (its showing up in the bridge logs). However, HA does not seem to be picking the values up. This is for multiple switches configured in SmartThings.
Here's whats in my yaml:
switch gazebo_lights:
Thanks for helping!
I am able to control the switches from HA all is good. however, if I change something directly in SmartThings, that state is not reflected in Home Assistant
Sorry to drag up an old thread, but this one seems relevant.
My MQTT bridge does not appear to receive updates for temperature. I have a Honeywell thermostat and a a Sylvania Smart Sensor (PIR and temp) that should be reporting temp and appear to do so, at least in the event logs. The humidity data from the thermostat is received by the bridge and published in mosquitto. The PIR sensor is also being published in mosquitto. The logs in the ST web interface indicate that temperature events are being generated but I don't see a corresponding event in the MQTT bridge device.
So far I haven't found any clues as to why humidity is being published but not temperature. Please let me know if you have any ideas.
Thanks!
In Smartthings, I have a contact sensor that also reports temperature.
I've tried to pull the temperature into HA as my first test of this bridge but I'm not having any luck.
this is what I have in the configuration.yaml, and I get a little temperature indicator in HA, but it is not getting a value, it just reports unknown.
any help would be appreciated.
In SmartThings, it gives the following states:
Current States: temperature: 57 battery: 77 contact: closed
sensor: platform: mqtt state_topic: "smartthings/Back Door/temperature" name: "Back Door Temperature" qos: 0 unit_of_measurement: "∞F" value_template: '{{ value.x }}'