I made a very easy customizable Blueprint for the Philips Hue 4 Button Dimmer Switch.
Requirements:
Running MQTT Broker & MQTT Integration in Home Assistant
Running Zigbee2MQTT
Philips Hue Dimmer Switch
The Blueprint is using MQTT instead of HA Entity Attributes because it is faster.
You can give every button custom commands.
It is also possible to still use the dimmer function.
just giving the ‘hold’ action, the service ‘Light: Turn on’, choose your light entity & set ‘Brightness step’ to 20 and it will make it brighter the longer you hold.
You can also set it to ‘-20’ to dim the lights.
Have fun with it and be creative!
blueprint:
name: Easy Customizable Controller Automation Blueprint for Hue Dimmer Switch in Zigbee2MQTT
description:
Controller automation for easy customizable Buttons with Philips Hue Dimmer Switch.
----------------------------------------------------------------------
__--------> !!!!!!!!! FRUSTRATION CAUTION !!!!!!!!! <--------__
----------------------------------------------------------------------
_______________________________██████
_______________________________██████
_______________________________██████
___________________________███████████
______________________________███████
__________________________________██
__Only define the 'Pressed' action when you need to!__
__Use the 'Released' action instead!!!__
__The 'pressed' action will also activate on 'Held'__
domain: automation
# Input from MQTT
input:
controller:
name: (Zigbee2MQTT) Controller Name
description: The name of the controller/Dimmer-Switch in Zigbee2MQTT (Not the name of your Home-Assistent Entity)
default: ""
base_topic:
name: Root/Base mqtt topic from Zigbee2MQTT
description: The Root/base topic as configured in Zigbee2MQTT (If you dont configured it you can leave the default --> "zigbee2mqtt")
default: zigbee2mqtt
# Define Actions to the Buttons
on_press:
name: Button On Pressed
description: Action set to run, when the Button On is pressed even when hold.
default: []
selector:
action: {}
on_held:
name: Button On Held
description: Action set to run, when the Button On is held.
default: []
selector:
action: {}
on_released:
name: Button On released
description: Action set to run, when the Button On is released.
default: []
selector:
action: {}
on_hold_released:
name: Button On Hold released
description: Action set to run, when the Button On is pressed and is released after long press.
default: []
selector:
action: {}
up_pressed:
name: Up Pressed
description: Action set to run, when the Up pressed even when hold.
default: []
selector:
action: {}
up_held:
name: Up Held
description: Action set to run, when the Up is held.
default: []
selector:
action: {}
up_released:
name: Up released
description: Action set to run, when the Up is released.
default: []
selector:
action: {}
up_hold_released:
name: Button Up Hold released
description: Action set to run, when the Button Up is pressed and is released after long press.
default: []
selector:
action: {}
down_pressed:
name: Down Pressed
description: Action set to run, when the Down is pressed even when hold.
default: []
selector:
action: {}
down_held:
name: Down Held
description: Action set to run, when the Down is held.
default: []
selector:
action: {}
down_released:
name: Down released
description: Action set to run, when the Down is released.
default: []
selector:
action: {}
down_hold_released:
name: Button Down Hold released
description: Action set to run, when the Button Down is pressed and is released after long press.
default: []
selector:
action: {}
off_pressed:
name: Off Pressed
description: Action set to run, when the Off is pressed even when hold. (Off is also the "hue" button)
default: []
selector:
action: {}
off_held:
name: Off Held
description: Action set to run, when the Off is held. (Off is also the "hue" button)
default: []
selector:
action: {}
off_released:
name: Off released
description: Action set to run, when the Off is released. (Off is also the "hue" button)
default: []
selector:
action: {}
off_hold_released:
name: Button Off Hold released
description: Action set to run, when the Button Off is pressed and is released after long press. (Off is also the "hue" button)
default: []
selector:
action: {}
# Link the Defined Action to the Buttons
mode: parallel
max: 6
trigger_variables:
base_topic: !input base_topic
controller: !input controller
trigger:
- platform: mqtt
topic: "{{ base_topic ~ '/' ~ controller }}"
action:
- variables:
controller: !input controller
- choose:
- conditions: "{{('hold' in trigger.payload_json.action) or ('release' in trigger.payload_json.action) or 'press' in trigger.payload_json.action}}"
sequence:
- choose:
- conditions: '{{ trigger.payload_json.action == "on_press" or trigger.payload_json.action == "on-press" }}'
sequence: !input on_press
- conditions: '{{ trigger.payload_json.action == "up_press" or trigger.payload_json.action == "up-press" }}'
sequence: !input up_pressed
- conditions: '{{ trigger.payload_json.action == "down_press" or trigger.payload_json.action == "down-press" }}'
sequence: !input down_pressed
- conditions: '{{ trigger.payload_json.action == "off_press" or trigger.payload_json.action == "off-press" }}'
sequence: !input off_pressed
- conditions: '{{ trigger.payload_json.action == "on_hold" or trigger.payload_json.action == "on-hold" }}'
sequence: !input on_held
- conditions: '{{ trigger.payload_json.action == "up_hold" or trigger.payload_json.action == "up-hold" }}'
sequence: !input up_held
- conditions: '{{ trigger.payload_json.action == "down_hold" or trigger.payload_json.action == "down-hold" }}'
sequence: !input down_held
- conditions: '{{ trigger.payload_json.action == "off_hold" or trigger.payload_json.action == "off-hold" }}'
sequence: !input off_held
- conditions: '{{ trigger.payload_json.action == "on_press_release" or trigger.payload_json.action == "on-press-release" }}'
sequence: !input on_released
- conditions: '{{ trigger.payload_json.action == "up_press_release" or trigger.payload_json.action == "up-press-release" }}'
sequence: !input up_released
- conditions: '{{ trigger.payload_json.action == "down_press_release" or trigger.payload_json.action == "down-press-release" }}'
sequence: !input down_released
- conditions: '{{ trigger.payload_json.action == "off_press_release" or trigger.payload_json.action == "off-press-release" }}'
sequence: !input off_released
- conditions: '{{ trigger.payload_json.action == "on_hold_release" or trigger.payload_json.action == "on-hold-release" }}'
sequence: !input on_hold_released
- conditions: '{{ trigger.payload_json.action == "up_hold_release" or trigger.payload_json.action == "up-hold-release" }}'
sequence: !input up_hold_released
- conditions: '{{ trigger.payload_json.action == "down_hold_release" or trigger.payload_json.action == "down-hold-release" }}'
sequence: !input down_hold_released
- conditions: '{{ trigger.payload_json.action == "off_hold_release" or trigger.payload_json.action == "off-hold-release" }}'
sequence: !input off_hold_released
Here is my automation for my Hue remote. Short press toggles bedroom lamps. Color & brightness controls bedroom lamps. Long press of on/off toggles ensuite bathroom lights.
Hi. Just bought this switch and I’m loving it. Deployed this blueprint and it works fantastic! I’m very new to HA so apologies if this question is a bit on the basic side.
I’ve programmed holding the the brightness buttons to increase and decrease the brightness accordingly. I was wondering if it was possible to decrease the time it would take in between brightness changes. Currently if I hold the brightness up button, the brightness increases in noticeable steps (about every 1 second or so) until max brightness. What I would like is for this brightness jump to be less noticeable for every time it fires but for the service/action (brightness change) to happen more rapidly.
I hope I’m making sense. This is the yaml for this automation in case it would help:
I tried fooling around on that specific setting page that you sent but it’s not working. Does a blueprint override the Settings of a specific z2m device? It seems like the case for this one. I’ve set it to the lowest interval and a different delta from the brightness change in the blueprint, but it seems like its following the blueprint.
Hmm hard to tell. I think it is more related to how often mqtt is sending. If you only want to bind this dimmer Switch to one zogbee light or
one zigbee group you can do this with z2m too.
I think you habe 2 options.
Setting the interval not shorter but on larger steps.
@pOpY@bt1v1
Hmmm… I think this is mainly caused by the sluggishness of the automation and the too fast reset of the payload from the device.
NoneType is maybe bc the payload is already vanished when it tries to compare the payload with the values in the automation.
Simplified ~~~> a timing issue.
In z2mqtt I think you have an option to retain a payload for longer.
Can you try it? I sadly can’t now cause the remotes are in the rooms where my people are already sleeping
Sorry, don’t using the blueprint anymore.
Had it just for one automation, which throwed the warning. Since I removed it, the warnings are gone.
Sadly can’t test it anymore.
First of all, thanks for this blueprint!
I’m all new to HA and still trying to figure my devices out. I just came from enOcean PTM 215Z switch configuration and when setting up that i had some “problems” with the dimming decrease and increase wasn’t too smooth. I found some code inside that topic which led me to a smoother dimming.
So when I found this blueprint I used the same code for the hold function, but here it’s stepping. Its like it decrease or increase brightness for 3 seconds, then hold a very short pause and then do it again for 3 seconds until light is either off or on full brightness. Can anyone maybe tell me what the problem could be and a possible solution?
I’ve also tried another code but it is still stepping in the brightness not that much but does still occurs. I can get it smoother if i put a higher transition value, but stepping is never fully removed.
If I look at the topic settings (settings>> MQTT>> basic topic) it says zigbee2mqtt so that is default like the blueprint.
Then I entered the friendly name of the device (in this case, Dimmer livingroom)
And then in entered a very normal call service toggle light option in the “release” section. But nothing happens.