forked from syssi/xiaomi_airpurifier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dmaker.airfresh.a1.yaml
167 lines (148 loc) · 6.09 KB
/
dmaker.airfresh.a1.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
fan:
- platform: xiaomi_miio_airpurifier
name: Xiaomi Fresh Air Ventilator
host: <IP>
token: <TOKEN>
model: dmaker.airfresh.a1
switch:
- platform: template
switches:
xiaomi_fresh_air_ventilator_display:
friendly_name: Display
value_template: "{{ is_state_attr('fan.xiaomi_fresh_air_ventilator', 'display', True) }}"
turn_on:
service: xiaomi_miio_airpurifier.fan_set_display_on
data:
entity_id: fan.xiaomi_fresh_air_ventilator
turn_off:
service: xiaomi_miio_airpurifier.fan_set_display_off
data:
entity_id: fan.xiaomi_fresh_air_ventilator
icon_template: mdi:lightbulb-outline
xiaomi_fresh_air_ventilator_child_lock:
friendly_name: Child lock
value_template: "{{ is_state_attr('fan.xiaomi_fresh_air_ventilator', 'child_lock', True) }}"
turn_on:
service: xiaomi_miio_airpurifier.fan_set_child_lock_on
data:
entity_id: fan.xiaomi_fresh_air_ventilator
turn_off:
service: xiaomi_miio_airpurifier.fan_set_child_lock_off
data:
entity_id: fan.xiaomi_fresh_air_ventilator
icon_template: mdi:lock-outline
xiaomi_fresh_air_ventilator_buzzer:
friendly_name: Buzzer
value_template: "{{ is_state_attr('fan.xiaomi_fresh_air_ventilator', 'buzzer', True) }}"
turn_on:
service: xiaomi_miio_airpurifier.fan_set_buzzer_on
data:
entity_id: fan.xiaomi_fresh_air_ventilator
turn_off:
service: xiaomi_miio_airpurifier.fan_set_buzzer_off
data:
entity_id: fan.xiaomi_fresh_air_ventilator
icon_template: mdi:volume-high
xiaomi_fresh_air_ventilator_ptc:
friendly_name: PTC
value_template: "{{ is_state_attr('fan.xiaomi_fresh_air_ventilator', 'ptc', True) }}"
turn_on:
service: xiaomi_miio_airpurifier.fan_set_ptc_on
data:
entity_id: fan.xiaomi_fresh_air_ventilator
turn_off:
service: xiaomi_miio_airpurifier.fan_set_ptc_off
data:
entity_id: fan.xiaomi_fresh_air_ventilator
icon_template: mdi:fire
sensor:
- platform: template
sensors:
xiaomi_fresh_air_ventilator_co2:
friendly_name: CO²
value_template: '{{ states.fan.xiaomi_fresh_air_ventilator.attributes.co2 }}'
unit_of_measurement: 'ppm'
icon_template: mdi:molecule-co2
xiaomi_fresh_air_ventilator_pm25:
friendly_name: PM2.5
value_template: '{{ states.fan.xiaomi_fresh_air_ventilator.attributes.pm25 }}'
unit_of_measurement: 'µg/m³'
icon_template: mdi:grain
xiaomi_fresh_air_ventilator_temperature:
friendly_name: Temperature
value_template: '{{ states.fan.xiaomi_fresh_air_ventilator.attributes.temperature }}'
unit_of_measurement: '°C'
icon_template: mdi:thermometer
xiaomi_fresh_air_ventilator_current_speed:
friendly_name: Current speed
value_template: '{{ states.fan.xiaomi_fresh_air_ventilator.attributes.control_speed }}'
icon_template: mdi:speedometer
xiaomi_fresh_air_ventilator_favorite_speed:
friendly_name: Favorite speed
value_template: '{{ states.fan.xiaomi_fresh_air_ventilator.attributes.favorite_speed }}'
icon_template: mdi:speedometer
xiaomi_fresh_air_ventilator_ptc_status:
friendly_name: PTC status
value_template: '{{ states.fan.xiaomi_fresh_air_ventilator.attributes.ptc_status }}'
icon_template: mdi:lightning-bolt
xiaomi_fresh_air_ventilator_dust_filter_life_remaining:
friendly_name: Dust filter life remaining
value_template: '{{ states.fan.xiaomi_fresh_air_ventilator.attributes.dust_filter_life_remaining }}'
unit_of_measurement: '%'
icon_template: mdi:air-filter
xiaomi_fresh_air_ventilator_dust_filter_life_remaining_days:
friendly_name: Dust filter life remaining days
value_template: '{{ states.fan.xiaomi_fresh_air_ventilator.attributes.dust_filter_life_remaining_days }}'
icon_template: mdi:air-filter
input_number:
xiaomi_fresh_air_ventilator_favorite_speed:
name: Favorite speed
icon: mdi:weather-windy
min: 60
max: 150
step: 2
input_select:
xiaomi_fresh_air_ventilator_mode:
name: Operation mode
options:
- Auto
- Sleep
- Favorite
automation:
- alias: Select favorite speed by slider
trigger:
platform: state
entity_id: input_number.xiaomi_fresh_air_ventilator_favorite_speed
action:
- service: xiaomi_miio_airpurifier.fan_set_favorite_speed
data_template:
entity_id: fan.xiaomi_fresh_air_ventilator
speed: '{{ states.input_number.xiaomi_fresh_air_ventilator_favorite_speed.state|int }}'
- alias: Monitor favorite speed and update slider
trigger:
platform: state
entity_id: sensor.xiaomi_fresh_air_ventilator_favorite_speed
action:
service: input_number.set_value
entity_id: input_number.xiaomi_fresh_air_ventilator_favorite_speed
data_template:
value: '{{ states.fan.xiaomi_fresh_air_ventilator.attributes.favorite_speed }}'
- alias: Select operation mode by input select
trigger:
entity_id: input_select.xiaomi_fresh_air_ventilator_mode
platform: state
action:
service: fan.set_preset_mode
data_template:
entity_id: fan.xiaomi_fresh_air_ventilator
preset_mode: '{{ states.input_select.xiaomi_fresh_air_ventilator_mode.state }}'
- alias: Monitor operation mode and update input select
trigger:
platform: state
entity_id: fan.xiaomi_fresh_air_ventilator
action:
service: input_select.select_option
entity_id: input_select.xiaomi_fresh_air_ventilator_mode
data_template:
option: >
{% if states.fan.xiaomi_fresh_air_ventilator.attributes.preset_mode %} {{ states.fan.xiaomi_fresh_air_ventilator.attributes.preset_mode }} {% else %}Auto{% endif %}