I am trying for some hours now but I can’t get it to work. To be honest I am not that proficient with yaml.
I copied and pasted most parts in my scripts and automations (changing the light.MY_LIGHT of course).
I am getting no errors but it is not working either.
One thing I noticed is that the new Aqara buttons have different entities and actions than the v1 ones implemented by the OP.
For example, I created an automation for a long press to increase my TV lamp’s brightness so I can see how it is implemented. I got this for the trigger:
- id: '1611265145650'
alias: Aqara Button Long Press
description: ''
trigger:
**- device_id: 026ad770558421bb3af330debf6167b2**
** domain: zha**
** platform: device**
** type: remote_button_long_press**
** subtype: remote_button_long_press**
condition: []
action:
- type: brightness_increase
device_id: d52a35e897fe3f6e804488a1616cc1d8
entity_id: light.tv_lamp
domain: light
mode: single
So the trigger part changes. The original is like this:
trigger:
- platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d00019df218
click_type: long_click_press
The thing is that the Aqara buttons don’t register any binary_sensor.switch.
I someone can help or understand how it can be done then feel free to tell.
my scripts.yaml
dim_light_landing:
sequence:
- condition: state
entity_id: input_boolean.landing_dim
state: 'on'
- service: light.turn_on
entity_id: light.tv_lamp
data_template:
brightness: '{{states.light.tv_lamp.attributes.brightness - 10}}'
- service: script.turn_off
entity_id: script.dim_light_landing
- service: script.turn_on
entity_id: script.dim_light_landing
brighten_light_landing:
sequence:
- condition: state
entity_id: input_boolean.landing_dim
state: 'off'
- service: light.turn_on
entity_id: light.tv_lamp
data_template:
brightness: '{{states.light.tv_lamp.attributes.brightness + 10}}'
- service: script.turn_off
entity_id: script.brighten_light_landing
- service: script.turn_on
entity_id: script.brighten_light_landing
my automation.yaml
-
alias: xiaomi landing brighten on
initial_state: ‘on’
trigger:
- device_id: 026ad770558421bb3af330debf6167b2
domain: zha
platform: device
type: remote_button_long_press
subtype: remote_button_long_press
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.landing_dim
state: ‘off’
- condition: state
entity_id: light.landing_light
state: ‘on’
action:
- service: script.turn_on
entity_id: script.brighten_light_landing
-
alias: xiaomi landing brighten off
initial_state: ‘on’
trigger:
- platform: state
entity_id: binary_sensor.switch_158d00019df218
from: ‘on’
to: ‘off’
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.landing_dim
state: ‘off’
- condition: state
entity_id: light.landing_light
state: ‘on’
action:
- service: input_boolean.turn_on
entity_id: input_boolean.landing_dim
-
alias: xiaomi landing dim on
initial_state: ‘on’
trigger:
- device_id: 026ad770558421bb3af330debf6167b2
domain: zha
platform: device
type: remote_button_long_release
subtype: remote_button_long_release
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.landing_dim
state: ‘on’
- condition: state
entity_id: light.landing_light
state: ‘on’
action:
- service: script.turn_on
entity_id: script.dim_light_landing
-
alias: xiaomi landing brighten off
initial_state: ‘on’
trigger:
- device_id: 026ad770558421bb3af330debf6167b2
domain: zha
platform: device
type: remote_button_long_release
subtype: remote_button_long_release
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.landing_dim
state: ‘on’
- condition: state
entity_id: light.landing_light
state: ‘on’
action:
- service: input_boolean.turn_off
entity_id: input_boolean.landing_dim
my input_boolean
input_boolean:
landing_dim:
name: Landing Dim
initial: off