My HOWTO: Smartthings Zigbee Button

Tags: #<Tag:0x00007f7c67070e28>

Here’s how I have a Zigbee smartthings button (GP-U999SJVLEAA) working with Home Assistant. You do not need a Smartthings hub or integration! This is a cheap, attractive button that not only provides 3 states (single press, double press, and long press) but also the current room temperature.

You’ll need:

  • Home Assistant
  • MQTT (I use the Hassio addon)
  • Zigbee Adapter (I use the husbz-1)
  • Smartthings Button (the GP-U999SJVLEAA)

Setup:

  1. Add you smartthings button to the zigbee network (Configuration | ZHA | Add Devices) - it should add a zha, binary_sensor, and sensor with “samjin” in the name
  2. Subscribe and listen to “zha_event” in the “Events” section of the developer tools (ex. http://your-ha/dev-event)
  3. Press the smartthings button and write down the “device_ieee” value displayed:
  4. Add the following HA automation, replacing all “<BLAH_HERE>” values accordingly (ex. replace “<YOUR_TOPIC_HERE>” with “buttons/pressed/st1”):
automation:
  - id: <ANY_ID_YOU_WANT_HERE>
    alias: <ANY_ALIAS_YOU_WANT_HERE>
    trigger:
      - event_data:
          command: button_single
          device_ieee: <YOUR_DEVICE_IEEE_HERE>
        event_type: zha_event
        platform: event
      - event_data:
          command: button_double
          device_ieee: <YOUR_DEVICE_IEEE_HERE>
        event_type: zha_event
        platform: event  
      - event_data:
          command: button_hold
          device_ieee: <YOUR_DEVICE_IEEE_HERE>
        event_type: zha_event
        platform: event          
    condition: []
    action:
      service: mqtt.publish
      data_template:
        topic: >
          <YOUR_TOPIC_HERE>
        payload: >
          {{trigger.event.data['command']}}
  1. Add a node-red MQTT listener to your desired flow with the proper server and topic name:
  2. Connect it to a switch, property of msg.payload, and ports “button_single”, “button_double”, and “button_hold”:
  3. Connect the switch ports to your desired nodes (ex. to turn on a light):
  4. You’re done!
5 Likes

Awesome!!! Useless device that was waiting for a solution till your advice!!!

Actually we don’t need MQTT to use it. I was lacking the part of your solution that resides on the trigger of the automation. The IEEE I caught on the states page of HA.

trigger:
  platform: event
  event_type: zha_event
  event_data:
    device_ieee: XX:XX:XX:XX:XX:XX:XX:XX
    command: button_single

You can create other automations using button_double and button_hold … The rest of the automation is up to you …

Thank you! Have a nice day!

Awesome, glad to help.

Yes you can skip the mqtt thing and just add actions directly in the automation. But I try to put everything in node red (it’s so much better than ha automations), hence the mqtt to node red.

Just wanted to add that I have mine working via node red listening for the same event without using MQTT. Just use the Events node with a switch looking for device ID before the switch that looks for which type of button press you use. I did run into an issue where the firmware on 2 out of the 3 of my buttons was older and this event was NOT being sent for those until I updated the firmware using the SmarThings hub.

Example flow you can paste in below:

[{“id”:“a592f64.9cf6b08”,“type”:“switch”,“z”:“bf70d280.fe9f4”,“name”:“Device ID Office Button”,“property”:“payload.event.device_ieee”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“28:6d:97:00:01:03:d2:43”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:1,“x”:390,“y”:1380,“wires”:[[“daedcd02.523b9”]]},{“id”:“daedcd02.523b9”,“type”:“switch”,“z”:“bf70d280.fe9f4”,“name”:“Button Click Type”,“property”:“payload.event.command”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“button_single”,“vt”:“str”},{“t”:“eq”,“v”:“button_double”,“vt”:“str”},{“t”:“eq”,“v”:“button_hold”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:3,“x”:650,“y”:1380,“wires”:[[“ce85594c.2f9c88”],[],[]]},{“id”:“ce85594c.2f9c88”,“type”:“api-call-service”,“z”:“bf70d280.fe9f4”,“name”:“Toggle Office Lights”,“server”:“713b7b8a.d07fd4”,“service_domain”:“light”,“service”:“toggle”,“data”:"{“entity_id”:“group.officel”}",“mergecontext”:"",“output_location”:"",“output_location_type”:“none”,“x”:870,“y”:1360,“wires”:[[]]},{“id”:“d2251f04.c2b4a”,“type”:“server-events”,“z”:“bf70d280.fe9f4”,“name”:“Samsung Button 2”,“server”:“713b7b8a.d07fd4”,“event_type”:“zha_event”,“x”:130,“y”:1380,“wires”:[[“a592f64.9cf6b08”]]},{“id”:“713b7b8a.d07fd4”,“type”:“server”,“z”:"",“name”:“Home Assistant”,“legacy”:false,“hassio”:true,“rejectUnauthorizedCerts”:true,“ha_boolean”:“y|yes|true|on|home|open”,“connectionDelay”:false}]

OMG - This is awesome. I’m going to switch over to your method for both my Samsung buttons and my Aeotec Wallmote. Thanks

I hate the double click option on this button because it makes a single click super slow to respond.

Yea definitely took me a while to figure that one out… Turns out its much easier than I thought. Learning more about node red just about every day. The easiest way to identity the location of the value you want is to click this little button when the debugging output is used.

This little button copies the path for this data:
image

So: payload.event.command

I picked up a Smart Things Button and set it up using your instructions, currently I have 3 separate automatons setup for single tap, double tap & hold.

I have an automation which runs at 11:30 pm each day called Bedtime, how do configure the 3rd automation (hold) to run the bedtime automation?

Thanks in advance

I haven’t used it, but I would try the automation.trigger service. I haven’t used it before, but that is what I see that looks promising in the services tab of the developer tools section of the front end UI.

My guess would be something like this:

  action:
    service: automation.trigger
    entity_id: automation.bedtime

That worked perfectly,

I didn’t think to look for a service called automation trigger

Thank you again