Until recently, one of the few things I couldn’t control from Home Assistant was the “Smart Home Monitor” (SHM)–or alarm–feature of the Samsung SmartThings platform. With the exception of our locks, controlling this was the only other task that required the provider’s app.
Support for Philips Hue lights is native to Home Assistant, while SmartThings leverages the setup discussed in https://home-assistant.io/blog/2016/02/09/smarter-smart-things-with-mqtt-and-home-assistant/. Fortunately, with the presence of the MQTT bridge and broker configured as part of that tutorial, SHM support is fairly easy.
First, a new SmartApp is created to handle SHM requests. SmartThings doesn’t directly expose the requests this SmartApp uses, so I chose to keep it separate from the permissions-driven integration the rest of my SmartThings devices use.
The Groovy code is available at https://git.ethitter.com/snippets/25 (raw). Add this as a new SmartApp in the SmartThings IDE, then add the SmartApp to your hub from the SmartThings app and choose the existing MQTT bridge.
Your MQTT broker will now receive events when toggling between “Disarm,” “Arm (Stay),” and “Arm (Away)” in SHM. These events match what Home Assistant’s MQTT Alarm Control Panel expects, care of the
switch statement that translates SmartThing’s values.
With the above in place, Home Assistant’s update is quite simple. Add the following to your
alarm_control_panel: platform: mqtt state_topic: "smartthings/alarm system status/alarmSystemStatus" command_topic: "smartthings/alarm system status/alarmSystemStatus" name: "SHM" payload_disarm: "off" payload_arm_home: "stay" payload_arm_away: "away"
Currently, alarm incidents aren’t handled, so it’s not possible to know in Home Assistant when an alarm is triggered. SmartThings doesn’t handle those in the same way it does arming and disarming SHM, and I’ve yet to reliably detect and interact with those events; I hope to resolve this soon. In the meantime, it doesn’t seem unreasonable to address those (hopefully) limited occurrences in the SmartThings app.