Hello to the community
I am running HomeAssistant on Ubuntu through a VM, with a Sonoff USB 3 Cordinator integrated into Zigbee2MQTT. I have the Philips HUE dimmer switch v2 device connected to MQTT through HomeAssistant.
I am using the Controller - Philips 929002398602 Hue Dimmer switch v2 blueprint found here:
Using the code below, all other buttons/actions work ok, except the on_long button.
Expected behaviour:
When the light is on and while holding it down, I want it to change the color temperature .
Actual behaviour:
First it turns off, then it turns on and proceeds to change the temperature. The off_long button (HUE button at bottom does not do that and works as expected).
Tried:
Accessing the action through just ‘device’ initially but couldnt access the temperature state changes. Toggle didnt work naturally.
It feels like it is detecting the short action on the button first. Is there a way around this? I have checked the forums but cannot find a similar issue but will keep looking.
alias: Philips Hue Dimmer Switch
description: ""
use_blueprint:
path: EPMatt/philips_929002398602.yaml
input:
integration: Zigbee2MQTT
controller_entity: sensor.0x001788010e89d471_action
helper_last_controller_event: input_text.input_text
action_button_on_short:
- if:
- condition: state
entity_id: light.gld312ha
attribute: brightness
state: null
then:
- service: light.toggle
target:
entity_id:
- light.gld312ha
data:
brightness: 250
kelvin: 6500
else:
- service: light.turn_off
target:
entity_id:
- light.gld312ha
data: {}
action_button_up_short:
- service: light.turn_on
target:
entity_id: light.gld312ha
data:
brightness_step: 4
action_button_down_short:
- service: light.turn_on
target:
entity_id: light.gld312ha
data:
brightness_step_pct: -4
action_button_up_long:
- service: light.turn_on
target:
entity_id: light.gld312ha
data:
brightness_step_pct: 12
action_button_down_long:
- service: light.turn_on
target:
entity_id: light.gld312ha
data:
brightness_step_pct: -12
action_button_on_long:
- service: light.turn_on
data:
color_temp_kelvin: "{{ state_attr('light.gld312ha', 'color_temp_kelvin')|int + 500}}"
brightness: "{{ state_attr('light.gld312ha', 'brightness')|int + 20}}"
target:
entity_id: light.gld312ha
action_button_off_short:
- service: light.turn_on
data:
color_temp_kelvin: "{{ state_attr('light.gld312ha', 'color_temp_kelvin')|int - 450}}"
brightness: "{{ state_attr('light.gld312ha', 'brightness')|int - 20}}"
target:
entity_id: light.gld312ha
action_button_off_long:
- service: light.turn_on
data:
color_temp_kelvin: "{{ state_attr('light.gld312ha', 'color_temp_kelvin')|int - 800}}"
target:
entity_id: light.gld312ha
I am attempting to use a timer from the following post but am struggling getting the code to work https://community.home-assistant.io/t/long-and-short-button-pressing-automation/466916/12. My idea is to have the action_short_press turn off only if it is pressed for less than 500milliseconds, and action_on_long press for temperature if more than (using part of the code in the link, more specifically:
condition:
- condition: template
value_template: >-
{{ trigger.to_state.last_updated - trigger.from_state.last_updated <
as_timedelta("00:00:01") }}
Will keep working on this but if others have managed this, any guidance appreciated
Thanks