Zigbee button not in conditions

Hello everyone,
I have a problem with my zigbee button. I want to create an automation that handles this:

- one button press (short press) = turn on the light on 20%
- second button press (short press) = turn off the light if its on
- double press = turn off the light
- double press = add brightness +40%

There is no problem of programing it, but the problem is that i cannot do it in one Automation.
I can use the double press, long or short press only as a trigger. Why limit our options??

In the conditions or the actions i cant see and use only the battery level of the device.

A little background:
I am a machine programmer and the golden unwritten rule is that you should use outputs on one place and there you should add all triggers or conditions to not have a mess or to not interfere with other programing.

That means i don’t want to create multiple automations to turn on one lamp. I want to have one automation with multiple conditions to handle every situation for that lamp with conditions.

Can anyone tell me to the right direction how to achieve this? Thank you.

You can assign id to each trigger, use it as condition, or in choose block in action.

Of course you can do all of what you listed in one automation.

Unless you haven’t listed all of the requirements.

Which device? The button or the light?

If it is the button, does it provide the battery information to HA? If so then you should be able to use it in a condition. You cant use the button state because a button doesn’t have a state. It only fires an event.

Maybe you should post a more accurate pseudo code of what you are trying to use because I don’t see it in the things you posted above.

Your “golden rule” shouldn’t necessarily be a “rule” but instead a “strong suggestion”.

Sometimes it improves readability to split an automation into more than one even for a very similar set if actions. Of course that is use case dependent.

Simply set all 3 button options you listed above as 3 triggers in the same one automation.

Give each trigger a trigger ID.

Then under actions simply use 3 choose options, one for each of the above trigger ID’s to action.

Thanks, this is the thing i needed and didn’t know about.

Thanks, this is the thing i needed and didn’t know about

1 Like

I understand it, and need it anyway :slight_smile:
I didn’t know that with the trigger IDs. I did it that way. But thanks for response.