Sunricher Friends of Hue (SR-ZGP2801K4-FOH-E) - turn on/off and dimming functionality

Hello guys

I bought this Sunricher switch with four buttons and paired it with my Sonoff Zigbee adapter.
I use Zigbee2mqtt and IKEA lights, and it’s working!
My goal with this switch was to turn on/off lights as well as dim the lightning. I couldn’t find anyone who solved it already ( or maybe my googling skills is kind of bad :slight_smile: )

The thing is with this switch is, that it only sends events, which for me is:
press_1, release_1, press_2 release_2, press_3, release_3, press_4 release_4

But I wanted to know if the button was either short or long pressed.
So I have now created a new component which solves this, I call it dimmer_button for now.
So what it does is, when the event press_1 is pressed, it spawns a new thread and waits for x time before it checks again. If the release_1 was trigged, then we had a shortpress, otherwise the loop sends longpresses which then increase or decrease the lightning in the room.

I just wanted to share this component if someone else is interested in the same functionality.
It’s still a beta release, but please try it out if you have time :slight_smile:

Put this in the configuration.yaml file:

dimmer_button:
  sleep_time: 0.2
  switches:
  - switch:
      no_of_buttons: 4
      entity: sensor.strombrytare_vardagsrum_action
      buttons:
      - button: 1
        target: light.lampor_vardagsrum
        pressed: press_1
        released: release_1
        shortpressed: turn_on
        longpressed: brightness_step_pct=+10
      - button: 2
        target: light.lampor_vardagsrum
        pressed: press_2
        released: release_2
        shortpressed: turn_off
        longpressed: brightness_step_pct=-10
      - button: 3
        target: light.vardagsrummet
        pressed: press_3
        released: release_3
        shortpressed: turn_on
        longpressed: brightness_step_pct=+10
      - button: 4
        target: light.vardagsrummet
        pressed: press_4
        released: release_4
        shortpressed: turn_off
        longpressed: brightness_step_pct=-10
  - switch:
      no_of_buttons: 1
      entity: mybutton2
      buttons:
      - button: 1
        target: light.minlampa2
        pressed: press_1
        released: release_1
        shortpressed: turn_on
        longpressed: brighter

I created a tarball (.tar.gz), on your home assistant instance:
tar zxvf dimmer_button.tar.gz
put it in the:
/root/config/custom_components/dimmer_button
folder if you are running Home Assistant OS.

Dimmer_button can be found here:
https://github.com/payano/core/blob/ea9beeb106e0c8a595d2f1edf26314030f359934/homeassistant/components/dimmer_button.tar.gz

Source code is here:
https://github.com/payano/core/tree/dimmer_button/homeassistant/components/dimmer_button

Please come with feedback. :+1:

For now it’s hardcoded for the press, release events. If you have other events, then I’ll consider to make it configurable.

:slight_smile:

@payano where did you get the SR-ZGP2801K4-FOH-E ?? Looking to get a ZigBee Green Power switch as well.

I bought it from here:

Thank you, $38 USD is not bad but I don’t think they ship to US.
Interesting that they say it has a battery. Does it really has a battery or it does energy harvesting only ?

Mine has a battery, so no energy harvesting here. I read that the feedback when pressing the buttons on a switch with battery is better, so I choosed that one :smiley:

I know this thread is a few months old, but I’m wondering if you can help. I have 10 plus of these switches, and they work great. But they’re connected via a Hue Bridge, and not directly to HA.

I’d love to get them directly into HA (I’ve only kept the Hue Bridge so I can use these switches), but can’t figure out how to pair them. Can you help detail the pairing procedure? I’m using ZigBee2MQTT with a sonoff stick.

Thanks!!

Hello,

Have you tried this instruction for pairing:

It took me a couple of tries before I got it paired up.

Br,
Johan

Hi @payano ,

Thanks a lot for posting this, very helpful!

I was wondering if you can share a bit more details about your setup? Iean, the instructions of using this type of “Green Power” devices say that some kind of translator has to be used. What did you do in your case? Do you have a Philips Hue device in range? Does that also need a Philips Hue Gateway?

Br,
Nikos

Hello Nikos,

I have a Philips hue bridge but I didn’t pair it to that. I use zigbee2mqtt. I have a sonoff Zigbee dongle and this is how the device looks in zigbee2mqtt:

Thanks Johan,

I guess I need to try myself and see if it works with my setup. It’s because I don’t have any Hue products at all, so I’m a bit concerned by this conversion thing.

I don’t think you need any Philips Hue products, do you have a zigbee stick with Zigbee2MQTT installed? I think that should be sufficient.

That’s exactly what I have! And in fact I’m using the same Texas chip as you do. But based on the docs for Green Power devices this is mot enough. A Hue device or in some cases IKEA needs to be in range. Perhaps your Hue hub is doing the job, even if you don’t actively use it. Or maybe an IKEA bulb. Otherwise I suppose the docs are wrong, which in this case would make me happy :grin:. Or could also be that your dongle is doing the job!

EDIT: I actually found a source that states that your dongle indeed supports the Green Power devices (Zigbee 3.0 USB Dongle Plus–ZBDongle-E – ALPATARO), so it must be this!

I don’t think that my Philips hue bridge is doing the job. I paired with hue first but then I rejoined the switch with my Zigbee dongle instead. As far as I know the hue switch isn’t aware of the switch, it can’t be controlled with the hue GUI. Which dongle are you using, mine is:
dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20220817103024-if00

That looks like my dongle! :smile:

Hi Johan, thanks for the link. I found that for mine, it was actually this procedure I needed to follow (215Z version).

And thanks for the new component you created, it works great!

However, I was wondering if it’s possible to make the following changes (or if you could explain to me, how I can make the following changes).

  • When turning a light on, how can I ensure it turns on to a set brightness? It seems that the lights always turn on to 10% brightness, regardless of previous state.
  • How can I stop it from turning the light off, when dimming? I would like it to dim all the way down to 1%, but then stop dimming, and not turn the light off.

If I can solve these two things, then I can finally be completely free of my Hue bridge :slight_smile:

Hello, nice that you have tried out my integration.

  1. To set another value for increasing or decreasing the brightness, have you tried changing:

longpressed: brightness_step_pct=+10

To maybe +1 instead?

  1. For my setup with Ikea lights it doesn’t turn the light off if I longpress it. Are you using the Philips hue integration to communicate with your lamps?

The brightness_step is a home Assistant framework call. It was introduced here:

Do you want to be able to set a min and a max value in the configuration instead of relying on the home Assistant framework?

  1. You said when you turn it on, you want to set the brightness, try shortpressed: brightness=125

Not sure if it works, I’m on vacation right now and can test and update the integration when I’m home again.

I have one other bug which I also need to address :smiley:

All the commands in the yaml for short and longpress are home Assistant framework calls :smiley:

Hi Johan, thanks so much for the reply, and I hope you’re having a great holiday.

My set up today is like this. I have a Hue bridge, where I have about 10+ switches, and around 30 bulbs controlled by the bridge. I am using the Hue integration to control them. So far, I have only swapped two switches over to your integration, but not any of the bulbs yet (my plan is to move everything over to HA, then ditch the Hue bridge), so perhaps that is what I need to do, to ensure that the lights don’t turn off when long pressing. I’ll report back, once I start moving the bulbs over.

Perhaps this will also change the way the brightness step behaves…

Thanks again, and happy new year to you and your family :smiley:

Hi again Johan,

I just wanted to confirm, I have now removed some Hue bulbs from the Hue bridge, integrated them in Z2M, and the bulbs still turn off when dimming down to 1%. Is it possible to find out why they turn off?

Another minor thing, if possible to change. Is it possible to make the dimming actions smoother (on the GU10 bulbs, the only bulb I’ve moved over to Z2M so far, they hack quite a bit when dimming)? For now, I have only added FOH switches to HA, where we don’t tend to dim the bulbs often, as I already know now, that if I moved the switches we dim often (from Hue bridge to HA) the wife will definitely say something about the hacking while dimming :rofl:

Thanks, you too!
Happy new year to you and your family :slight_smile:

Can you also try to change the sleep_time to maybe 0.1 or 0.05 or something, hopefully it will be a smoother experience. But I’ll test it more when I get back!

Have a nice New Years Eve!