1
0
ansible-home-assistant/automations/templates/air-purifier/automations.yaml.j2

44 lines
1.7 KiB
Plaintext
Raw Normal View History

2020-11-04 00:31:46 +00:00
{% for airPurifier in airPurifiers %}
# {{ airPurifier.name }}
- alias: '[{{ airPurifier.name }} Air Purifier] mode change'
trigger:
entity_id: input_select.{{ airPurifier.componentId }}_mode
platform: state
action:
service: fan.set_speed
data_template:
entity_id: {{ airPurifier.entityId }}
speed: {{ '\'{{ states.input_select.' + airPurifier.componentId + '_mode.state }}\'' }}
id: {{ airPurifier.componentId }}_mode_change
- alias: '[{{ airPurifier.name }} Air Purifier] mode changed'
trigger:
platform: state
entity_id: {{ airPurifier.entityId }}
action:
service: input_select.select_option
entity_id: input_select.{{ airPurifier.componentId }}_mode
data_template:
option: {{ '\'{{ states.' + airPurifier.entityId + '.attributes.speed }}\'' }}
id: {{ airPurifier.componentId }}_mode_changed
- alias: '[{{ airPurifier.name }} Air Purifier] favorite level change'
trigger:
entity_id: input_number.{{ airPurifier.componentId }}_favorite_level
platform: state
action:
service: xiaomi_miio.fan_set_favorite_level
data_template:
entity_id: {{ airPurifier.entityId }}
level: {{ '\'{{ states.input_number.' + airPurifier.componentId + '_favorite_level.state | int }}\'' }}
id: {{ airPurifier.entityId }}_favorite_level
- alias: '[{{ airPurifier.name }} Air Purifier] favorite level changed'
trigger:
platform: state
entity_id: {{ airPurifier.entityId }}
action:
service: input_number.set_value
entity_id: input_number.{{ airPurifier.componentId }}_favorite_level
data_template:
value: {{ '\'{{ states.' + airPurifier.entityId + '.attributes.favorite_level }}\'' }}
id: {{ airPurifier.entityId }}_favorite_level_changed
{% endfor %}