In case anyone is an appdaemon user, I wrote the following to handle all of my Smartthings buttons in lieu of the Node Red setup. Just drop the .py in your apps folder and add the configuration to app.yaml. You can redefine new sections for as many buttons as you have (so change “guest_room_button” below in a second entry).
- Pair your button with zha
- Listen for zha_event under Developer Tools (as described above) and note your device_ieee
- Plug that in for device below.
- List the entity you want (only devices supported by toggle work…probably just switches and lights.) You can probably control multiple entities by separating them by a comma, but I haven’t tried it.
import appdaemon.plugins.hass.hassapi as hass class button_events(hass.Hass): def initialize(self): device = self.args["device"] self.listen_event(self.button_events, "zha_event", device_ieee = device) def button_events(self, entity, data, kwargs): command = data['command'] self.toggle(self.args[command])
guest_room_button: module: zigbee_buttons class: button_events device: 28:6d:97:00:01:09:9c:e1 button_single: light.guest_room_lamps button_double: light.guest_room_recessed_lights button_hold: light.basement_hallway
(Should anyone ever find this that isn’t using the Smarthings button, this will work withy any zigbee button if you modify the “button_single” etc. to match the name of the command being sent when you listen to zha_event.)