1
0
ansible-home-assistant/automations/templates/air-purifier/switch.yaml.j2
2020-11-05 02:05:23 +01:00

41 lines
1.5 KiB
Django/Jinja

{% for airPurifier in airPurifiers %}
# {{ airPurifier.name }}
- platform: template
switches:
{{ airPurifier.componentId }}_led:
friendly_name: "LED"
value_template: "{{ '{{ is_state_attr(\''+ airPurifier.entityId +'\', \'led\', true) }}"' }}
turn_on:
service: xiaomi_miio.fan_set_led_on
data:
entity_id: {{ airPurifier.entityId }}
turn_off:
service: xiaomi_miio.fan_set_led_off
data:
entity_id: {{ airPurifier.entityId }}
icon_template: "mdi:lightbulb-outline"
{{ airPurifier.componentId }}_child_lock:
friendly_name: "Child lock"
value_template: "{{ '{{ is_state_attr(\''+ airPurifier.entityId +'\', \'child_lock\', true) }}"' }}
turn_on:
service: xiaomi_miio.fan_set_child_lock_on
data:
entity_id: {{ airPurifier.entityId }}
turn_off:
service: xiaomi_miio.fan_set_child_lock_off
data:
entity_id: {{ airPurifier.entityId }}
icon_template: "mdi:lock-outline"
{{ airPurifier.componentId }}_buzzer:
friendly_name: "Buzzer"
value_template: "{{ '{{ is_state_attr(\''+ airPurifier.entityId +'\', \'buzzer\', true) }}"' }}
turn_on:
service: xiaomi_miio.fan_set_buzzer_on
data:
entity_id: {{ airPurifier.entityId }}
turn_off:
service: xiaomi_miio.fan_set_buzzer_off
data:
entity_id: {{ airPurifier.entityId }}
icon_template: "mdi:volume-high"
{% endfor %}