Philips Hue Button

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:

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

"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|

I can't find these values :slightly_frowning_face::slightly_frowning_face:

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

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.

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

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.

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.

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 site, but there it should explain what it exposes to mqtt.

Is it this button ?

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.

Could you please answer:

Is it this button ?

How are you receiving the events ? Directly via mqtt ?

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

ob man das so in einer function node verweden kann:

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).

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

The button should produce:

The possible values are: on, off, skip_backward, skip_forward, 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

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

only push.

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) ?

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

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

i'll try it and let you know.