Add air purifiers
This commit is contained in:
parent
b6a2fe33a5
commit
c3777c971a
@ -1,41 +0,0 @@
|
||||
- alias: '[Living Room Air Purifier] mode change'
|
||||
trigger:
|
||||
entity_id: input_select.xiaomi_airpurifier_mode
|
||||
platform: state
|
||||
action:
|
||||
service: fan.set_speed
|
||||
data_template:
|
||||
entity_id: fan.xiaomi_miio_device
|
||||
speed: '{{ states.input_select.xiaomi_airpurifier_mode.state }}'
|
||||
id: xiaomi_airpurifier_mode_change
|
||||
- alias: '[Living Room Air Purifier] mode changed'
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: fan.xiaomi_miio_device
|
||||
action:
|
||||
service: input_select.select_option
|
||||
entity_id: input_select.xiaomi_airpurifier_mode
|
||||
data_template:
|
||||
option: '{{ states.fan.xiaomi_miio_device.attributes.speed }}'
|
||||
id: xiaomi_airpurifier_mode_changed
|
||||
- alias: '[Living Room Air Purifier] favorite level change'
|
||||
trigger:
|
||||
entity_id: input_number.xiaomi_airpurifier_favorite_level
|
||||
platform: state
|
||||
action:
|
||||
service: xiaomi_miio.fan_set_favorite_level
|
||||
data_template:
|
||||
entity_id: fan.xiaomi_miio_device
|
||||
level: '{{ states.input_number.xiaomi_airpurifier_favorite_level.state | int
|
||||
}}'
|
||||
id: xiaomi_airpurifier_favorite_level
|
||||
- alias: '[Living Room Air Purifier] favorite level changed'
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: fan.xiaomi_miio_device
|
||||
action:
|
||||
service: input_number.set_value
|
||||
entity_id: input_number.xiaomi_airpurifier_favorite_level
|
||||
data_template:
|
||||
value: '{{ states.fan.xiaomi_miio_device.attributes.favorite_level }}'
|
||||
id: xiaomi_airpurifier_favorite_level_changed
|
@ -3,3 +3,7 @@
|
||||
template:
|
||||
src: lights.yaml.j2
|
||||
dest: build/lights.yaml
|
||||
- name: Build air purifiers automations
|
||||
template:
|
||||
src: air-purifier.yaml.j2
|
||||
dest: build/air-purifier.yaml
|
44
automations/templates/air-purifier.yaml.j2
Normal file
44
automations/templates/air-purifier.yaml.j2
Normal file
@ -0,0 +1,44 @@
|
||||
{% 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 %}
|
@ -36,3 +36,10 @@ lights:
|
||||
name: Kitchen 13
|
||||
- entityId: light.kitchen_14
|
||||
name: Kitchen 14
|
||||
airPurifiers:
|
||||
- entityId: fan.xiaomi_miio_device
|
||||
componentId: xiaomi_miio_device
|
||||
name: Living Room
|
||||
- entityId: fan.bedroom_air_purifier
|
||||
componentId: bedroom_air_purifier
|
||||
name: Bedroom
|
Loading…
Reference in New Issue
Block a user