1
0

Add more configuration for air-purifier

This commit is contained in:
pgrondek 2020-11-05 02:05:23 +01:00
parent 8875c3ec2b
commit 67dd0ba00b
10 changed files with 140 additions and 11 deletions

View File

@ -8,23 +8,23 @@
- service: light.turn_on - service: light.turn_on
data: data:
flash: long flash: long
brightness: 120 brightness: 200
rgb_color: rgb_color:
- 0 - 0
- 0 - 0
- 255 - 255
entity_id: light.computer_cave_2 entity_id: light.desk_lamp
mode: single mode: single
- id: daily_off - id: daily_off
alias: Daily notificaion off alias: Daily notificaion off
trigger: trigger:
- platform: time - platform: time
at: '10:55' at: '11:25'
condition: [] condition: []
action: action:
- service: light.turn_on - service: light.turn_on
data: data:
kelvin: 3200 kelvin: 3200
entity_id: light.computer_cave_2 entity_id: light.desk_lamp
mode: single mode: single

View File

@ -0,0 +1,30 @@
---
- name: Build air purifiers automations
template:
src: air-purifier/automations.yaml.j2
dest: build/automations/air-purifier.yaml
- name: Build air purifiers fan
template:
src: air-purifier/fan.yaml.j2
dest: build/fan/air-purifier.yaml
- name: Build air purifiers switch
template:
src: air-purifier/switch.yaml.j2
dest: build/switch/air-purifier.yaml
- name: Build air purifiers inputs
template:
src: air-purifier/input_number.yaml.j2
dest: build/input_number/air-purifier.yaml
- name: Build air purifiers inputs
template:
src: air-purifier/input_select.yaml.j2
dest: build/input_select/air-purifier.yaml
- name: Build air purifiers sensor
template:
src: air-purifier/sensor.yaml.j2
dest: build/sensors/air-purifier.yaml

View File

@ -2,8 +2,6 @@
- name: Build lights automations - name: Build lights automations
template: template:
src: lights.yaml.j2 src: lights.yaml.j2
dest: build/lights.yaml dest: build/automations/lights.yaml
- name: Build air purifiers automations
template: - include_tasks: air-purifier.yaml
src: air-purifier.yaml.j2
dest: build/air-purifier.yaml

View File

@ -0,0 +1,7 @@
{% for airPurifier in airPurifiers %}
# {{ airPurifier.name }}
- platform: xiaomi_miio
host: {{ airPurifier.ip }}
token: '{{ airPurifier.token }}'
name: '{{ airPurifier.name }} Purifier'
{% endfor %}

View File

@ -0,0 +1,10 @@
{% for airPurifier in airPurifiers %}
# {{ airPurifier.name }}
{{ airPurifier.componentId }}_favorite_level:
name: "Favorite level"
initial: 0
min: 0
max: 14
step: 1
icon: "mdi:weather-windy"
{% endfor %}

View File

@ -0,0 +1,10 @@
{% for airPurifier in airPurifiers %}
# {{ airPurifier.name }}
{{ airPurifier.componentId }}_mode:
name: Mode
options:
- Auto
- Silent
- Favorite
icon: "mdi:animation-outline"
{% endfor %}

View File

@ -0,0 +1,30 @@
{% for airPurifier in airPurifiers %}
# {{ airPurifier.name }}
- platform: template
sensors:
{{ airPurifier.componentId }}_temp:
friendly_name: "Temperature"
value_template: {{ '"{{ state_attr(\''+ airPurifier.entityId +'\', \'temperature\') }}"' }}
unit_of_measurement: "°C"
device_class: "temperature"
{{ airPurifier.componentId }}_humidity:
friendly_name: "Humidity"
value_template: {{ '"{{ state_attr(\''+ airPurifier.entityId +'\', \'humidity\') }}"' }}
unit_of_measurement: "%"
device_class: "humidity"
{{ airPurifier.componentId }}_air_quality_pm25:
friendly_name: "Air quality"
value_template: {{ '"{{ state_attr(\''+ airPurifier.entityId +'\', \'aqi\') }}"' }}
unit_of_measurement: "μg/m³"
icon_template: "mdi:weather-fog"
{{ airPurifier.componentId }}_speed:
friendly_name: "Fan speed"
value_template: {{ '"{{ state_attr(\''+ airPurifier.entityId +'\', \'motor_speed\') }}"' }}
unit_of_measurement: "rpm"
icon_template: "mdi:speedometer"
{{ airPurifier.componentId }}_filter_remaining:
friendly_name: "Filter remaining"
value_template: {{ '"{{ state_attr(\''+ airPurifier.entityId +'\', \'filter_life_remaining\') }}"' }}
unit_of_measurement: "%"
icon_template: "mdi:heart-outline"
{% endfor %}

View File

@ -0,0 +1,41 @@
{% 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 %}

View File

@ -1,6 +1,5 @@
--- ---
# vars file for automations # vars file for automations
lights: lights:
- entityId: light.tv_left - entityId: light.tv_left
name: TV Left name: TV Left
@ -40,6 +39,10 @@ airPurifiers:
- entityId: fan.xiaomi_miio_device - entityId: fan.xiaomi_miio_device
componentId: xiaomi_miio_device componentId: xiaomi_miio_device
name: Living Room name: Living Room
ip: 192.168.60.6
token: 66e56ff414f359b371b2d0b86e3d37d4
- entityId: fan.bedroom_air_purifier - entityId: fan.bedroom_air_purifier
componentId: bedroom_air_purifier componentId: bedroom_air_purifier
name: Bedroom name: Bedroom
ip: 192.168.60.5
token: a32c6e74647ac03ad79afaa590b5203c