Add aliases to actions in automation blueprints ()

pull/48001/head
Klaas Schoute 2021-03-16 17:14:07 +01:00 committed by GitHub
parent 389891d13d
commit 0097169dd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 8 deletions
homeassistant/components/automation/blueprints
tests/components/automation

View File

@ -38,13 +38,17 @@ trigger:
to: "on" to: "on"
action: action:
- service: light.turn_on - alias: "Turn on the light"
service: light.turn_on
target: !input light_target target: !input light_target
- wait_for_trigger: - alias: "Wait until there is no motion from device"
wait_for_trigger:
platform: state platform: state
entity_id: !input motion_entity entity_id: !input motion_entity
from: "on" from: "on"
to: "off" to: "off"
- delay: !input no_motion_wait - alias: "Wait the number of seconds that has been set"
- service: light.turn_off delay: !input no_motion_wait
- alias: "Turn off the light"
service: light.turn_off
target: !input light_target target: !input light_target

View File

@ -37,7 +37,8 @@ condition:
value_template: "{{ trigger.from_state.state == zone_state and trigger.to_state.state != zone_state }}" value_template: "{{ trigger.from_state.state == zone_state and trigger.to_state.state != zone_state }}"
action: action:
domain: mobile_app - alias: "Notify that a person has left the zone"
type: notify domain: mobile_app
device_id: !input notify_device type: notify
message: "{{ person_name }} has left {{ zone_state }}" device_id: !input notify_device
message: "{{ person_name }} has left {{ zone_state }}"

View File

@ -84,6 +84,7 @@ async def test_notify_leaving_zone(hass):
_hass, config, variables, _context = mock_call_action.mock_calls[0][1] _hass, config, variables, _context = mock_call_action.mock_calls[0][1]
message_tpl = config.pop("message") message_tpl = config.pop("message")
assert config == { assert config == {
"alias": "Notify that a person has left the zone",
"domain": "mobile_app", "domain": "mobile_app",
"type": "notify", "type": "notify",
"device_id": "abcdefgh", "device_id": "abcdefgh",