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

Expose support for Routines and Modes #122

Open robross0606 opened 6 years ago

robross0606 commented 6 years ago

All device types seem to be exposed to MQTT, but not routines, scenes or modes. It would be really useful to be able to use MQTT output to trigger routines or scenes (functionally similar to momentary switches or buttons), as well as use MQTT input/output to work with Mode (DYNAMIC_ENUM).

stjohnjohnson commented 6 years ago

Hmm, that would be pretty cool. I don't use modes or routines right now, most of my automation is around manipulating devices that only work on SmartThings. If you're interested in contributing it, I'm happy to review a pull-request and give feedback.

almostserious commented 6 years ago

Somebody already made an extra Smartapp to add Smart Home Monitor modes: https://ethitter.com/2016/08/smartthings-smart-home-monitor-shm-mqtt-home-assistant/

Maybe this can be used to add it here as well

mschwartz commented 6 years ago

I wrote my own Home Automation system (github.com:mschwartz/RoboDomo) that interacts with SmartThings via MQTT-Bridge (thanks for this!) and with my TVs (direct/WiFi API) and Nest (directly with Nest.com/API), Harmony Hub/Remote via Harmony servers' API, etc.

I wrote my own macros (scenes/routines, whatever you want to see them as). For example, Macro "Pause TV" (so you can go get a drink or to the restroom) tells Harmony to pause (that will pause any device Harmony knows about) and turns on the kitchen and bathroom lights. A related macro, "resume TV" tells harmony to play and turns off those lights. All my stuff is done via MQTT, similar to this MQTT-Bridge. A macro is simply an array or list of sequential topics/messages to send.

Currently, I can use Alexa to control Harmony or SmartThings because there are already existing skills.

What I'd love to be able to do is to create SmartThings skills that basically do nothing. If I can get MQTT messages that these "nothing" are to be run, I would trigger my own Macros. The amount of work for me would be minimal.

I'd love to be the "help wanted," but I know virtually nothing about SmartThings programming. Given that you already have done this MQTT Bridge, it seems to me it might be a really easy thing to add. The messages are generated and sent to the bridge in the SmartThings cloud. If the activities/scenes messages are identifiable, your IDE program would simply relay to MQTT like a switch or whatever.

raman325 commented 4 years ago

Not sure how to add routines support to this yet, but I added support for hub modes here: https://github.com/raman325/smartthings-mqtt-bridge (I also added some error handling that will reset the state of a topic in case you attempt to publish an invalid message. The errors are logged in the IDE)

raman325 commented 4 years ago

Added support for routines as well. The message format for routines is slightly different from typical device states/attributes but I think it helps keep the messages more organized. Check out the new section in the README to see how to use it: https://github.com/raman325/smartthings-mqtt-bridge#routines

robross0606 commented 4 years ago

This was so long ago, I don't remember how I intended to use it! šŸ¤£ Awesome work though. Can't wait to try it... on... something...

raman325 commented 4 years ago

I needed it myself so that I could experiment with moving some of my automation logic into HA, and I figured it would be a fun challenge šŸ¤·ā€ā™‚

mschwartz commented 4 years ago

A funny thing...

I ended up moving my devices to a Hubitat hub, implemented my own MQTT bridge for it, and now use virtual devices to trigger my custom automations.

The MQTT bridge for Hubitat took me a half hour to implement.

FWIW, Hubitat runs groovy code thatā€™s 99.9% compatible with SmartThings, but Iā€™ve not had to install any custom groovy. The performance is impressive, since thereā€™s no cloud involved. From motion sensor to light on is instant instead of seconds.

I still have a small number of devices on the SmartThings hub, so I still use this bridge. Iā€™m thankful that it exists.