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

MQTT To SmartThings #137

Closed fnkh closed 6 years ago

fnkh commented 6 years ago

I have been trying out home assistant <-> SmartThings connectivity using the smartthings-mqtt-bridge. For most part, it is working with two way communication. I was able to get a virtual switch as well as virtual motion sensor to talk with each other.

I see a problem with Virtual Contact Sensor. I was able to get the status of the sensor into home assistant but could get it working other way around and set it into the SmartThings. Looking around the forums, I figured that the Virtual Contact Sensor is a read-only device and as such might not work for my purpose in its current state.

I did some debug to see how far along my mqtt requests travel through. I can see the request getting properly received at the mqtt-bridge; however, the bridge isn't sending out the request at port 8080. I do see corresponding incoming traffic and outgoing traffic for other bidirectional virtual types at the port. It appears mqtt-bridge somehow drops the request which is why it is also not being logged at the smartApp.

My question is if I want to enable Virtual Contact Sensor to be able to receive and set its state through mqtt - how would I achieve that? Would I need to edit the mqtt-bridge besides device handler/smartApp. Or do you suggest using some other sensor for the purpose?

mbaran5 commented 6 years ago

Did you determine a fix for this? I also need a virtual contact sensor and can't find one that can be set.

fnkh commented 6 years ago

I am using this for both my motion and contact sensors. Should be able to use it for other types as well, but I have not yet tried.

https://community.smartthings.com/t/release-universal-virtual-device-type-and-translator/47836

mbaran5 commented 6 years ago

Question, if you dont mind answering. How are you issuing the contact sensor commands. Do you issue on/off and have it update the contact? The DTH says it accepts open/close but I can't seem to get that working.

I can however get it to change the open/closed status based on sending a "switch on/off" I suppose either way it doesn't matter, but I would like it to respond to "contact open/closed" I am not sure what capability it likes for open/closed though.

Do you mind sharing your config a bit. Thanks a ton!

edit: looking at the code, it looks like it either accept on/off or locked/unlocked. I will just proceed that way.

fnkh commented 6 years ago

Yes, I am using switch on/off too.