# Philips Hue Button

**URL:** <https://discourse.nodered.org/t/philips-hue-button/75085>\
**Category:** General\
**Created:** [12 February 2023 18:34 UTC](https://discourse.nodered.org/t/philips-hue-button/75085 "2023-02-12T18:34:46Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisF](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@ChrisF](https://discourse.nodered.org/u/ChrisF)\
**Post date:** [12 February 2023 18:34 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/1 "2023-02-12T18:34:46Z")

</div>

Hello all,  
I have a Philips hue button that I have integrated into Node Red and I want to convert the dimming values into a number.  
With a debug node I get the following values:

```auto
object
topic: "zigbee2mqtt/Hue Button Eingang"
changed: object
old: object
action: "press"
battery: 100
linkquality: 168
update: object
update_available: false
new: object
action: "brightness_step_down"
action_step_size: 30
action_transition_time: 0.09
battery: 100
linkquality: 168
update: object
update_available: false
payload: object
action: "brightness_step_down"
action_step_size: 30
action_transition_time: 0.09
battery: 100
linkquality: 168
update: object
update_available: false
payload_raw: object
action: "brightness_step_down"
action_step_size: 30
action_transition_time: 0.09
battery: 100
linkquality: 168
update: object
update_available: false

```

with a short button press I can switch on and off without problems.  
with long keypress / hold I always get only brightness\_step\_up or brightness\_step\_down.  
But I need a number to be able to use it on the slider.  
Can someone help with this or had someone already integrated the hue button?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Falfango](https://avatars.discourse-cdn.com/v4/letter/f/5e9695/32.png) [@Falfango](https://discourse.nodered.org/u/Falfango)\
**Post date:** [12 February 2023 20:00 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/2 "2023-02-12T20:00:24Z")

</div>

"incrementBrightness" (int / boolean): Specifies by how many percent the light should be made brighter or `true` to make the light brighter in 10% steps|

"decrementBrightness" (int / boolean): Specifies the percentage by which the light should be made darker or `true` to make the light darker in 10% steps|

---

<div class="post-metadata">

**Author:** ![ChrisF](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@ChrisF](https://discourse.nodered.org/u/ChrisF)\
**Post date:** [12 February 2023 20:04 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/3 "2023-02-12T20:04:48Z")

</div>

I can't find these values 🙁🙁

I have the Hue button connected not via a bridge but via zigbee2mqtt.

---

<div class="post-metadata">

**Author:** ![Falfango](https://avatars.discourse-cdn.com/v4/letter/f/5e9695/32.png) [@Falfango](https://discourse.nodered.org/u/Falfango)\
**Post date:** [12 February 2023 20:16 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/4 "2023-02-12T20:16:51Z")

</div>

Thats a parameter of the lamp in case its also a hue. If its a different brand, you have to look which parameter it uses. The slider itself should be changed by the output of the lamp.

---

<div class="post-metadata">

**Author:** ![ChrisF](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@ChrisF](https://discourse.nodered.org/u/ChrisF)\
**Post date:** [12 February 2023 20:28 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/5 "2023-02-12T20:28:05Z")

</div>

It is a Philips hue button and turn the light on / off and dim when long button press.

> **[Hue Smart Button | Philips Hue DE](https://www.philips-hue.com/de-de/p/hue-smart-button/8719514342668?origin=p72980901872&gclid=CjwKCAiAuaKfBhBtEiwAht6H7yYtOKLSX3iCccXLczzNWUtioK26PLGIaMlpb0v3gVnJoA09uMDiMRoCB6EQAvD_BwE&gclsrc=aw.ds)**
>
> Dieser kleine Smart Button hat eine große Wirkung. Steuere Deine Lampen mit einem einfachen Klick. Drücke und halte den Button, um sie zu dimmen oder heller zu stellen. Noch besser: Deine Lampen stellen sich automatisch anhand der Tageszeit auf die...

---

<div class="post-metadata">

**Author:** ![Falfango](https://avatars.discourse-cdn.com/v4/letter/f/5e9695/32.png) [@Falfango](https://discourse.nodered.org/u/Falfango)\
**Post date:** [12 February 2023 20:42 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/6 "2023-02-12T20:42:53Z")

</div>

From interest ist the device, which you want to control with the slider. If you only want to control the slider itself, you have to make your own routine, which has to store the actual value and you add/substract a specific value from this with each action. After that you can forward the new value to the slider and store this value as actual value.

---

<div class="post-metadata">

**Author:** ![ChrisF](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@ChrisF](https://discourse.nodered.org/u/ChrisF)\
**Post date:** [13 February 2023 05:08 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/7 "2023-02-13T05:08:04Z")

</div>

I want to use the button but I also want to use the slider on a display.  
I would like to control the light with the button but also see the change on the display.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [13 February 2023 05:28 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/8 "2023-02-13T05:28:49Z")

</div>

There is no "current value". There is only brightness up/down, when you hold it, it will perform a stepsize `action_step_size: 30`. The button itself is agnostic as you can hold it forever.

So you either request the current brightness of the device that you want to control or you control the range manually.

The ikea dimmers work in a similar way, although they also show when you release the button.  
~~I cannot find your button on the [zigbee2mqtt](https://www.zigbee2mqtt.io/supported-devices/) site~~, but there it should explain what it exposes to mqtt.

Is it [this button](https://www.zigbee2mqtt.io/devices/8718699693985.html) ?

How are you receiving the events ? Directly via mqtt ?

---

<div class="post-metadata">

**Author:** ![ChrisF](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@ChrisF](https://discourse.nodered.org/u/ChrisF)\
**Post date:** [13 February 2023 06:34 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/9 "2023-02-13T06:34:16Z")

</div>

> [@bakman2](#):
>
> The ikea dimmers work in a similar way, although they also show when you release the button.  
> ~~I cannot find your button on the [zigbee2mqtt](https://www.zigbee2mqtt.io/supported-devices/) site~~, but there it should explain what it exposes to mqtt.
> 
> Is it [this button](https://www.zigbee2mqtt.io/devices/8718699693985.html) ?
> 
> How are you receiving the events ? Directly via mqtt ?

Hello,  
thank you for your answer.  
So this is not possible as I imagine?  
The button always sends 7x step up and then 7x step down.  
It must be possible to convert this into a function, but maybe it works with the step size... There the device sends at the beginning a 56 and then 6x 30

I installed Zigbee2Mqtt on the PI and then learned the button via a Sonoff dongle.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [13 February 2023 06:38 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/10 "2023-02-13T06:38:24Z")

</div>

Could you please answer:

> Is it [this button](https://www.zigbee2mqtt.io/devices/8718699693985.html) ?

> How are you receiving the events ? Directly via mqtt ?

Do you only receive the step up/down ? No stop event ?

---

<div class="post-metadata">

**Author:** ![ChrisF](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@ChrisF](https://discourse.nodered.org/u/ChrisF)\
**Post date:** [13 February 2023 06:47 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/11 "2023-02-13T06:47:37Z")

</div>

ob man das so in einer function node verweden kann:

```auto
var brightness = 0;
var step = 0;

if (msg.payload.action === "brightness_step_up") {
    if (step === 0) {
        brightness += msg.payload.action_step_size;
        step = msg.payload.action_step_size;
    } else {
        brightness += step;
    }
    step = 30;
} else if (msg.payload.action === "brightness_step_down") {
    if (step === 0) {
        brightness -= msg.payload.action_step_size;
        step = msg.payload.action_step_size;
    } else {
        brightness -= step;
    }
    step = 30;
}

if (brightness > 100) {
    brightness = 100;
} else if (brightness < 0) {
    brightness = 0;
}

msg.payload = brightness;
return msg;

```

I would need a function that distinguishes between brightness\_step\_up and down and then increases the values accordingly (the first time always by 56 and then 6x by 30).

---

<div class="post-metadata">

**Author:** ![ChrisF](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@ChrisF](https://discourse.nodered.org/u/ChrisF)\
**Post date:** [13 February 2023 07:11 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/12 "2023-02-13T07:11:43Z")

</div>

> [@bakman2](#):
>
> > Is it [this button](https://www.zigbee2mqtt.io/devices/8718699693985.html) ?
> 
> yes this is the button
> 
> > How are you receiving the events ? Directly via mqtt ?
> 
> yes via mqtt
> 
> Do you only receive the step up/down ? No stop event ?

with a short keypress I get on / off  
with long keypress step up / step down.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [13 February 2023 07:23 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/13 "2023-02-13T07:23:45Z")

</div>

The button should produce:

> The possible values are: `on`, `off`, `skip_backward`, `skip_forward`, `press`, `hold`, `release`.

---

<div class="post-metadata">

**Author:** ![ChrisF](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@ChrisF](https://discourse.nodered.org/u/ChrisF)\
**Post date:** [13 February 2023 07:27 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/14 "2023-02-13T07:27:10Z")

</div>

> [@bakman2](#):
>
> `on, off, press`, `hold`, `release`.

yes i a in a separate message.  
okay i thought you need up / down

`skip_backward` , `skip_forward`

I haven't found, or that is up / down

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [13 February 2023 07:34 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/15 "2023-02-13T07:34:19Z")

</div>

I don't how this button works, but I assume you can twist and push ?

---

<div class="post-metadata">

**Author:** ![ChrisF](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@ChrisF](https://discourse.nodered.org/u/ChrisF)\
**Post date:** [13 February 2023 07:36 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/16 "2023-02-13T07:36:36Z")

</div>

only push.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [13 February 2023 07:40 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/17 "2023-02-13T07:40:37Z")

</div>

So how does it produce "brightness\_step\_down" and "brightness\_step\_up" ? That is not coming from mqtt. Is that your own function ?

First you need to determine what messages are being send when pushed, hold, released.  
How would you determine what direction it should go (up/down) ?

---

<div class="post-metadata">

**Author:** ![ChrisF](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@ChrisF](https://discourse.nodered.org/u/ChrisF)\
**Post date:** [13 February 2023 09:30 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/18 "2023-02-13T09:30:36Z")

</div>

> [@bakman2](#):
>
> So how does it produce "brightness\_step\_down" and "brightness\_step\_up" ? That is not coming from mqtt. Is that your own function ?

that ist coming from the device / mqtt.  
I've installed the zigbee2mqtt

when pressed for a long time, the device sends `brightness_step_up` or down / `hold` and `release`

 ![587a22dd007e06ecf85351f0df5ce5769a86960e](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/8/587a22dd007e06ecf85351f0df5ce5769a86960e.png)

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [13 February 2023 09:46 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/19 "2023-02-13T09:46:58Z")

</div>

Could you try it with an mqtt-in node instead ? topic most likely: zigbee2mqtt/# connect a debug and press/hold the buttons.

---

<div class="post-metadata">

**Author:** ![ChrisF](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@ChrisF](https://discourse.nodered.org/u/ChrisF)\
**Post date:** [13 February 2023 12:09 UTC](https://discourse.nodered.org/t/philips-hue-button/75085/20 "2023-02-13T12:09:35Z")

</div>

i'll try it and let you know.

[Next page](https://discourse.nodered.org/t/philips-hue-button/75085.md?page=2)
