I know right? I would expect the same if it works in automation and at a button click.
Sequence from button click:
sequence:
- service: script.1_dm_roll_initial_raise
data: {}
and the same sequence is in the automation…
I even tried the following:
sequence:
- service: script.1_dm_roll_initial_raise
metadata: {}
data: {}
see the extra “metadata:{}”
I noticed that if it has the metadata, it sais “Script ‘1.DM roll initial-raise’ on”
while if it doesn’t, it sais “Call a service ‘Script: 1.DM roll initial-raise’ on”
Complete automation for the button:
alias: 1.DM button
description: ""
use_blueprint:
path: homeassistant/_aqara_t1_mini_button.yaml
input:
button_action_topic: zigbee2mqtt/1.DM button/action
double_press:
- if:
- condition: state
entity_id: light.1_dm_lamp
state: "on"
then:
- service: light.turn_off
metadata: {}
data: {}
target:
entity_id: light.1_dm_lamp
else:
- service: light.turn_on
target:
entity_id:
- light.1_dm_lamp
data: {}
single_press:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.breastfeeding_time
data:
datetime: "{{ now() }}"
hold:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.1_dm_roll_down_contact
state: "off"
sequence:
- service: script.1_dm_roll_initial_raise
data: {}
- conditions:
- condition: state
entity_id: binary_sensor.1_dm_roll_up_contact
state: "off"
sequence:
- service: script.1_dm_roll_initial_descent
data: {}
the blueprint _aqara_t1_mini_button.yaml is:
blueprint:
name: Z2M - Aqara T1 (WXKG11LM) - wireless mini button
description: Scene & device control using Aqara T1 mini button
author: pauldcomanici
domain: automation
input:
button_action_topic:
name: zigbee2mqtt topic with action for aqara button
description: "zigbee2mqtt topic with action for aqara button (example: zigbee2mqtt/0.LV1 button/action)"
selector:
text:
single_press:
name: single press
description: action to run on a single press
default: []
selector:
action: {}
double_press:
name: double press
description: action to run on a double press
default: []
selector:
action: {}
hold:
name: hold
description: action to run when button is held
default: []
selector:
action: {}
release:
name: release
description: action to run when button is released after a hold
default: []
selector:
action: {}
mode: restart
max_exceeded: silent
trigger:
- platform: mqtt
topic: !input "button_action_topic"
condition:
- condition: state
entity_id: input_boolean.manual_override_enabled
state: "off"
- condition: template
value_template: "{{ states('sensor.home_human_presence')=='on' }}"
action:
- variables:
command: "{{ trigger.payload }}"
- choose:
- conditions:
- condition: template
value_template: "{{ command == 'single' }}"
sequence: !input "single_press"
- conditions:
- condition: template
value_template: "{{ command == 'double' }}"
sequence: !input "double_press"
- conditions:
- condition: template
value_template: "{{ command == 'hold' }}"
sequence: !input "hold"
- conditions:
- condition: template
value_template: "{{ command == 'release' }}"
sequence: !input "release"
while the automation that does automatic blinds control:
alias: 1.DM roll-actions
description: ""
trigger:
- platform: state
entity_id:
- alarm_control_panel.home_alarm
to: armed_away
from: disarmed
id: armed_away
- platform: state
entity_id:
- alarm_control_panel.home_alarm
to: armed_night
from: disarmed
id: armed_night
- platform: state
entity_id:
- alarm_control_panel.home_alarm
to: armed_home
from: disarmed
id: armed_home
- platform: state
entity_id:
- alarm_control_panel.home_alarm
to: disarmed
from: armed_night
id: disarmed
- platform: state
entity_id:
- binary_sensor.1_dm_roll_initial_descent
to: "on"
id: initial_descent
- platform: state
entity_id:
- binary_sensor.1_dm_roll_complete_raise
to: "on"
id: complete_raise
condition:
- condition: state
entity_id: input_boolean.manual_override_enabled
state: "off"
- condition: state
entity_id: input_boolean.roll_1_dm_enabled
state: "on"
action:
- choose:
- conditions:
- condition: trigger
id:
- disarmed
- condition: state
entity_id: binary_sensor.1_dm_roll_initial_raise
state: "on"
- condition: state
entity_id: binary_sensor.1_dm_roll_down_contact
state: "off"
sequence:
- service: script.1_dm_roll_initial_raise
data: {}
alias: initial_raise
- conditions:
- condition: trigger
id:
- complete_raise
- condition: state
entity_id: binary_sensor.1_dm_roll_up_contact
state: "on"
sequence:
- service: script.1dm_roll_up
data: {}
alias: complete_raise
- conditions:
- condition: trigger
id:
- initial_descent
- condition: state
entity_id: binary_sensor.1_dm_roll_up_contact
state: "off"
sequence:
- service: script.1_dm_roll_initial_descent
data: {}
alias: initial_descent
- conditions:
- condition: trigger
id:
- armed_away
- armed_home
- armed_night
- condition: state
entity_id: binary_sensor.1_dm_roll_complete_descent
state: "on"
- condition: state
entity_id: binary_sensor.1_dm_door_outside_contact
state: "off"
- condition: state
entity_id: binary_sensor.1_dm_roll_down_contact
state: "on"
sequence:
- service: script.1dm_roll_down
data: {}
alias: complete_descent
mode: single
For context binary_sensor.1_dm_roll_down_contact → is the contact sensor that I added at the bottom of the blinds
Later edit: After posting this, I noticed that my blueprint was with “mode: restart”, and that was the problem … as the aqara button emits the hold event, and when you release the button, it emits the release event … resulting in my automation to restart … changed the mode to “mode: queued” … and yey it works.