I have tried to implement this, but it does not work well. If you want to increase by more then one at time, it will just rubberband to increase by 1. Not sure if we will be able to fix this, its probably limited by integration itself.
It is not working to increase by more than once at the time. Called services are increment and decrement number. If you want to increment more you have to integrate the slider in picture and then call set value. I havenāt figured out how to do this thatās why decided for baby steps.
Great work @Tomaae & @schilea!
I have an idea for an automation:
Sometimes my girlfriend likes to increase the fan speed to fully clean the room before heading to bed at various hours.
Now the automatic adjustment will decrease the fan speed due to PM 2.5 after a short time.
Could it be an idea to add a condition that only changes the speed, if there hasnāt been user input for the last 10 minutes etc?
Hi,
It will only adjust in favorite mode or when turned off. If you select any other mode, it wont be adjusted at all.
That is actually why I build my own PM sensor, so I can place it on other side of the room and get more accurate readings for automation.
New card output below. I am going to do some clean up than I will post the codes here. Please let me know your thoughts.
Off - all greyed out, including numerical info, except off button
On mode - numerical info white bright
Auto
Silent
Fan
Favorite - increment/decrement is one step at the time, this is how integration works
3 colors according to predefined PM2.5 severity level: clean, polluted, critical, not visible when off
Additional info:
Open attributes - Google 3 dots:
PM2.5 history - click on PM2.5 value:
PM2.5 severity level history:
Temperature history:
Humidity history:
Looks really nice. Left side feels bit empty, but that easily solvable. Probably just putting text āPurifierā between off and menu buttons would do it. But that can be experimented with later.
I would also try different background, since pure white is too similar to color of the purifier itself. Thats why I picked one with bit yellowish background. It makes it āpop outā more and is easier on eyes. But thats just pure visual thing.
Hi, I am also thinking on title, but picture-entity is adding it on top and I am not really like this. so it should be added as an object.
I personally prefer bright themes, as having the default one in Assistant, but as you said, it is just a matter of preference. The baseline white can be easily replace in any picture editor app.
Regarding the open space, I reserved it for some additional switches like child lock or display brightness as there were some requests in the past.
Finally. Thanks @Tomaae for initial set up.
- get rid of almost all helpers
- get rid of all automations related to mode, fun level, favorite level
- off - everything grayed out, including PM2.5
- on, all numbers white bright, ring indicating air quality - severity defined as sensor in configuration.yaml. My thresholds are orange above 15 polluted and red above 30 critical. They are different than threshold for ring indicator on the purifier display, 75 and 150.
- favorite level - increase 2 steps, decrease 1 step, user definable step in lovelace.yaml
- there are more sensors defined than requested in configuration.yaml for extra developments
- extra automations could be found above in @Tomaae post 53
- Additional info: open attributes - Google 3 dots:
configuration.yaml
#======================#
# Mi Air Purifier 3H #
#======================#
fan:
- platform: xiaomi_miio
name: "Mi Air Purifier 3H"
host: !secret mi_air_host
token: !secret mi_air_token
model: zhimi.airpurifier.mb3
input_select:
mi_air_purifier_coverage:
name: Coverage
options:
- 2-4 mĀ²
- 5-9 mĀ²
- 7-12 mĀ²
- 12-22 mĀ²
- 14-24 mĀ²
- 14-25 mĀ²
- 16-27 mĀ²
- 17-30 mĀ²
- 18-32 mĀ²
- 19-33 mĀ²
- 20-34 mĀ²
- 22-38 mĀ²
- 23-40 mĀ²
- 26-45 mĀ²
- 28-49 mĀ²
icon: mdi:texture-box
switch:
#======================#
# Mi Air Purifier 3H #
#======================#
- platform: template
switches:
mi_air_purifier_led:
friendly_name: "Display"
value_template: "{{ is_state_attr('fan.mi_air_purifier_3h', 'led', true) }}"
turn_on:
service: xiaomi_miio.fan_set_led_on
data:
entity_id: fan.mi_air_purifier_3h
turn_off:
service: xiaomi_miio.fan_set_led_off
data:
entity_id: fan.mi_air_purifier_3h
icon_template: mdi:lightbulb-outline
mi_air_purifier_child_lock:
friendly_name: "Child lock"
value_template: "{{ is_state_attr('fan.mi_air_purifier_3h', 'child_lock', true) }}"
turn_on:
service: xiaomi_miio.fan_set_child_lock_on
data:
entity_id: fan.mi_air_purifier_3h
turn_off:
service: xiaomi_miio.fan_set_child_lock_off
data:
entity_id: fan.mi_air_purifier_3h
icon_template: "mdi:lock-outline"
mi_air_purifier_buzzer:
friendly_name: "Buzzer"
value_template: "{{ is_state_attr('fan.mi_air_purifier_3h', 'buzzer', true) }}"
turn_on:
service: xiaomi_miio.fan_set_buzzer_on
data:
entity_id: fan.mi_air_purifier_3h
turn_off:
service: xiaomi_miio.fan_set_buzzer_off
data:
entity_id: fan.mi_air_purifier_3h
icon_template: "mdi:volume-high"
sensor:
#======================#
# Mi Air Purifier 3H #
#======================#
- platform: template
sensors:
mi_air_purifier_temp:
friendly_name: "Temperature"
value_template: "{{ state_attr('fan.mi_air_purifier_3h', 'temperature') }}"
unit_of_measurement: "Ā°C"
device_class: "temperature"
mi_air_purifier_humidity:
friendly_name: "Humidity"
value_template: "{{ state_attr('fan.mi_air_purifier_3h', 'humidity') }}"
unit_of_measurement: "%"
device_class: "humidity"
mi_air_purifier_air_quality_pm25:
friendly_name: "Air Quality Index (AQI) PM2.5 (Ī¼g/mĀ³)"
# value_template: "{{ state_attr('fan.mi_air_purifier_3h', 'aqi') }}"
value_template: >-
{% if state_attr('fan.mi_air_purifier_3h', 'aqi') == None %}
{{ 0 }}
{% else %}
{{ state_attr('fan.mi_air_purifier_3h', 'aqi') }}
{% endif %}
unit_of_measurement: " "
# unit_of_measurement: "Ī¼g/mĀ³"
icon_template: "mdi:air-purifier"
mi_air_purifier_pm25_severity:
friendly_name: "PM2.5 severity level"
value_template: >-
{% if state_attr('fan.mi_air_purifier_3h', 'aqi') | int > 30 %}
{{ 'critical' }}
{% elif state_attr('fan.mi_air_purifier_3h', 'aqi') | int > 15 %}
{{ 'polluted' }}
{% else %}
{{ 'clean' }}
{% endif %}
icon_template: "mdi:air-filter"
mi_air_purifier_favorite_level:
friendly_name: "Favorite Level"
value_template: "{{ state_attr('fan.mi_air_purifier_3h', 'favorite_level') }}"
mi_air_purifier_avg_air_quality_pm25:
friendly_name: "Average air quality (AvgAQI) PM2.5"
value_template: "{{ state_attr('fan.mi_air_purifier_3h', 'average_aqi') }}"
unit_of_measurement: "Ī¼g/mĀ³"
icon_template: "mdi:weather-hazy"
mi_air_purifier_use_time:
friendly_name: "Time used"
# value_template: "{{ state_attr('fan.mi_air_purifier_3h', 'use_time') }}"
value_template: >
" {% macro phrase(value, name) %}
{%- set value = value | int %}
{%- set end = 's' if value > 1 else '' %}
{{- '{} {}{}'.format(value, name, end) if value | int > 0 else '' }}
{%- endmacro %}
{% set weeks = (state_attr('fan.mi_air_purifier_3h', 'use_time') | int / 604800) | int %}
{% set days = ((state_attr('fan.mi_air_purifier_3h', 'use_time') | int - (weeks * 604800)) / 86400) | int %}
{% set hours = ((state_attr('fan.mi_air_purifier_3h', 'use_time') | int - (weeks * 604800) - (days * 86400)) / 3600) | int %}
{% set minutes = ((state_attr('fan.mi_air_purifier_3h', 'use_time') | int - (weeks * 604800) - (days * 86400) - (hours * 3600)) / 60) | int %}
{% set seconds = (state_attr('fan.mi_air_purifier_3h', 'use_time') | int - (weeks * 604800) - (days * 86400) - (hours * 3600) - (minutes*60)) | int %}
{{ [ phrase(weeks, 'week'), phrase(days, 'day'), phrase(hours, 'hr'), phrase(minutes, 'min'), phrase(seconds, 'sec') ] | select('!=','') | list | join(', ') }}"
# unit_of_measurement: "sec"
icon_template: "mdi:heart-pulse"
mi_air_purifier_filter_used:
friendly_name: "Filter used"
value_template: "{{ state_attr('fan.mi_air_purifier_3h', 'filter_hours_used') }}"
unit_of_measurement: "hrs"
icon_template: "mdi:heart-off"
mi_air_purifier_filter_remaining:
friendly_name: "Filter remaining"
value_template: "{{ state_attr('fan.mi_air_purifier_3h', 'filter_life_remaining') }}"
unit_of_measurement: "%"
icon_template: "mdi:heart-outline"
mi_air_purifier_purify_volume:
friendly_name: "Purified volume"
value_template: "{{ state_attr('fan.mi_air_purifier_3h', 'purify_volume') }}"
unit_of_measurement: "mĀ³"
icon_template: "mdi:warehouse"
mi_air_purifier_speed:
friendly_name: "Motor speed"
value_template: "{{ state_attr('fan.mi_air_purifier_3h', 'motor_speed') }}"
unit_of_measurement: "rpm"
icon_template: "mdi:speedometer"
mi_air_purifier_led_brightness:
friendly_name: "Led brightness"
value_template: "{{ state_attr('fan.mi_air_purifier_3h', 'led_brightness') }}"
unit_of_measurement: "lx"
icon_template: "mdi:brightness-5"
binary_sensor:
#======================#
# Mi Air Purifier 3H #
#======================#
- platform: template
sensors:
mi_air_purifier_mode_off:
friendly_name: "Purifier Off"
value_template: "{{ is_state('fan.mi_air_purifier_3h', 'off') }}"
mi_air_purifier_mode_auto:
friendly_name: "Purifier Auto mode"
value_template: "{{ is_state_attr('fan.mi_air_purifier_3h', 'mode', 0) and is_state('fan.mi_air_purifier_3h', 'on') }}"
mi_air_purifier_mode_silent:
friendly_name: "Purifier Silent mode"
value_template: "{{ is_state_attr('fan.mi_air_purifier_3h', 'mode', 1) and is_state('fan.mi_air_purifier_3h', 'on') }}"
mi_air_purifier_mode_favorite:
friendly_name: "Purifier Favorite mode"
value_template: "{{ is_state_attr('fan.mi_air_purifier_3h', 'mode', 2) and is_state('fan.mi_air_purifier_3h', 'on') }}"
mi_air_purifier_mode_fan:
friendly_name: "Purifier Fan mode"
value_template: "{{ is_state_attr('fan.mi_air_purifier_3h', 'mode', 3) and is_state('fan.mi_air_purifier_3h', 'on') }}"
mi_air_purifier_mode_fan_1:
friendly_name: "Purifier Fan mode 1"
value_template: "{{ is_state_attr('fan.mi_air_purifier_3h', 'mode', 3) and is_state_attr('fan.mi_air_purifier_3h', 'fan_level', 1) and is_state('fan.mi_air_purifier_3h', 'on') }}"
mi_air_purifier_mode_fan_2:
friendly_name: "Purifier Fan mode 2"
value_template: "{{ is_state_attr('fan.mi_air_purifier_3h', 'mode', 3) and is_state_attr('fan.mi_air_purifier_3h', 'fan_level', 2) and is_state('fan.mi_air_purifier_3h', 'on') }}"
mi_air_purifier_mode_fan_3:
friendly_name: "Purifier Fan mode 3"
value_template: "{{ is_state_attr('fan.mi_air_purifier_3h', 'mode', 3) and is_state_attr('fan.mi_air_purifier_3h', 'fan_level', 3) and is_state('fan.mi_air_purifier_3h', 'on') }}"
scripts.yaml
favorite_up:
sequence:
- service: xiaomi_miio.fan_set_favorite_level
data:
level: '{% if (state_attr(entity_id,''favorite_level'') + step | int) < 14 -%}
{{ state_attr(entity_id, ''favorite_level'') + step | int }} {%- else -%}
{{ 14 }} {%- endif %}'
mode: single
favorite_down:
sequence:
- service: xiaomi_miio.fan_set_favorite_level
data:
level: '{% if (state_attr(entity_id,''favorite_level'') - step | int) > 0 -%}
{{ state_attr(entity_id, ''favorite_level'') - step | int }} {%- else -%}
{{ 0 }} {%- endif %}'
mode: single
automation.yaml
- id: '1234567891011'
alias: AP01 - Air Purifier turn on
description: ''
trigger:
- above: '15'
entity_id: sensor.mi_air_purifier_air_quality_pm25
for: 0:01:00
platform: numeric_state
condition:
- condition: state
entity_id: fan.mi_air_purifier_3h
state: 'off'
action:
- data: {}
entity_id: fan.mi_air_purifier_3h
service: fan.turn_on
- data:
speed: Auto
entity_id: fan.mi_air_purifier_3h
service: fan.set_speed
- service: notify.notify
data:
message: Mi Air Purifier 3H turn on at {{ states('sensor.date_time') }}
mode: single
- id: '1234567891012'
alias: AP02 - Air Purifier set favorite level based on PM2.5
description: ''
trigger:
- platform: state
entity_id: sensor.mi_air_purifier_air_quality_pm25
condition:
- condition: state
entity_id: fan.mi_air_purifier_3h
state: 'on'
- condition: or
conditions:
- condition: and
conditions:
- condition: numeric_state
entity_id: sensor.mi_air_purifier_air_quality_pm25
above: '50'
- condition: not
conditions:
- condition: state
entity_id: sensor.mi_air_purifier_favorite_level
state: '14'
- condition: and
conditions:
- condition: numeric_state
entity_id: sensor.mi_air_purifier_air_quality_pm25
above: '35'
below: '51'
- condition: not
conditions:
- condition: state
entity_id: sensor.mi_air_purifier_favorite_level
state: '12'
- condition: and
conditions:
- condition: numeric_state
entity_id: sensor.mi_air_purifier_air_quality_pm25
above: '20'
below: '36'
- condition: not
conditions:
- condition: state
entity_id: sensor.mi_air_purifier_favorite_level
state: '9'
- condition: and
conditions:
- condition: numeric_state
entity_id: sensor.mi_air_purifier_air_quality_pm25
above: '5'
below: '21'
- condition: not
conditions:
- condition: state
entity_id: sensor.mi_air_purifier_favorite_level
state: '6'
- condition: and
conditions:
- condition: numeric_state
entity_id: sensor.mi_air_purifier_air_quality_pm25
below: '6'
- condition: not
conditions:
- condition: state
entity_id: sensor.mi_air_purifier_favorite_level
state: '4'
action:
- data:
speed: Favorite
entity_id: fan.mi_air_purifier_3h
service: fan.set_speed
- data:
level: '{% if states("sensor.mi_air_purifier_air_quality_pm25") | int > 50 -%}
14 {%- elif states("sensor.mi_air_purifier_air_quality_pm25") | int > 35 -%}
12 {%- elif states("sensor.mi_air_purifier_air_quality_pm25") | int > 20 -%}
9 {%- elif states("sensor.mi_air_purifier_air_quality_pm25") | int > 5 -%}
6 {%- else -%} 4 {%- endif %}'
entity_id: fan.mi_air_purifier_3h
service: xiaomi_miio.fan_set_favorite_level
- data: {}
entity_id: automation.air_purifier_translate_favorite_level_to_coverage
service: automation.turn_on
- data:
message: Mi Air Purifier 3H - PM2.5 = {{ states('sensor.mi_air_purifier_air_quality_pm25')
}} Ī¼g/mĀ³ set favorite level to {{ state_attr('fan.mi_air_purifier_3h', 'favorite_level')
}} (coverage {{ states('input_select.mi_air_purifier_coverage') }}) at {{
states('sensor.date_time') }}
service: notify.notify
mode: single
- id: '1234567891013'
alias: AP03 - Air Purifier turn off
description: ''
trigger:
- entity_id: sensor.mi_air_purifier_air_quality_pm25
for: 0:01:00
platform: numeric_state
below: '5'
condition:
- condition: state
entity_id: fan.mi_air_purifier_3h
state: 'on'
action:
- data: {}
entity_id: fan.mi_air_purifier_3h
service: fan.turn_off
- service: notify.notify
data:
message: Mi Air Purifier 3H turn off at {{ states('sensor.date_time') }}
mode: single
- id: '1234567891014'
alias: AP04 - Air Purifier favorite level to coverage
description: ''
trigger:
- entity_id: fan.mi_air_purifier_3h
attribute: favorite_level
platform: state
condition: []
action:
- data:
option: "{% if is_state_attr('fan.mi_air_purifier_3h','favorite_level', 0) -%}
2-4 mĀ² {%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',
1) -%} 5-9 mĀ² {%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',
2) -%} 7-12 mĀ² {%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',
3) -%} 12-22 mĀ² {%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',
4) -%} 14-24 mĀ² {%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',
5) -%} 14-25 mĀ² {%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',
6) -%} 16-27 mĀ² {%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',
7) -%} 17-30 mĀ² {%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',
8) -%} 18-32 mĀ² {%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',
9) -%} 19-33 mĀ² {%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',
10) -%} 20-34 mĀ² {%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',
11) -%} 22-38 mĀ² {%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',
12) -%} 23-40 mĀ² {%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',
13) -%} 26-45 mĀ² {%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',
14) -%} 28-49 mĀ² {%- else -%} {%- endif %}"
entity_id: input_select.mi_air_purifier_coverage
service: input_select.select_option
mode: single
lovelace.yaml
type: picture-elements
image: local/mi_air_purifier_3h.png
elements:
- type: conditional
conditions:
- entity: sensor.mi_air_purifier_pm25_severity
state: clean
- entity: binary_sensor.mi_air_purifier_mode_off
state: 'off'
elements:
- type: image
entity: sensor.mi_air_purifier_pm25_severity
title: PM2.5 severity level
tap_action:
action: more-info
state_image:
clean: local/mi_air_purifier_3h_clean.png
style:
top: 34%
left: 69%
- type: conditional
conditions:
- entity: sensor.mi_air_purifier_pm25_severity
state: polluted
- entity: binary_sensor.mi_air_purifier_mode_off
state: 'off'
elements:
- type: image
entity: sensor.mi_air_purifier_pm25_severity
title: PM2.5 severity level
tap_action:
action: more-info
state_image:
polluted: local/mi_air_purifier_3h_polluted.png
style:
top: 34%
left: 69%
- type: conditional
conditions:
- entity: sensor.mi_air_purifier_pm25_severity
state: critical
- entity: binary_sensor.mi_air_purifier_mode_off
state: 'off'
elements:
- type: image
entity: sensor.mi_air_purifier_pm25_severity
title: PM2.5 severity level
tap_action:
action: more-info
state_image:
critical: local/mi_air_purifier_3h_critical.png
style:
top: 34%
left: 69%
- type: state-icon
entity: binary_sensor.mi_air_purifier_mode_off
title: 'Off'
icon: 'mdi:power-standby'
tap_action:
action: call-service
service: fan.turn_off
service_data:
entity_id: fan.mi_air_purifier_3h
style:
top: 1%
left: 6%
transform: 'translate(-50%, 0)'
'--paper-item-icon-color': 'rgb(128, 128, 128)'
'--paper-item-icon-active-color': 'rgb(255, 128, 0)'
- type: state-icon
entity: fan.mi_air_purifier_3h
title: More Info
icon: 'mdi:dots-vertical'
tap_action:
action: more-info
style:
top: 1%
left: 36%
transform: 'translate(-50%, 0)'
'--paper-item-icon-color': 'rgb(128, 128, 128)'
'--paper-item-icon-active-color': 'rgb(128, 128, 128)'
- type: conditional
conditions:
- entity: binary_sensor.mi_air_purifier_mode_off
state: 'off'
elements:
- type: state-label
entity: sensor.mi_air_purifier_air_quality_pm25
title: PM2.5
tap_action:
action: more-info
style:
top: 19%
left: 68.5%
min-width: 40px
min-height: 40px
text-align: center
font-size: 400%
transform: 'translate(-50%, 0)'
color: 'rgb(255,255,255)'
- type: state-label
entity: sensor.mi_air_purifier_temp
title: Temperature
tap_action:
action: more-info
style:
top: 32%
left: 64%
min-width: 40px
min-height: 40px
text-align: center
font-size: 75%
transform: 'translate(-50%, 0)'
color: 'rgb(255,255,255)'
- type: state-label
entity: sensor.mi_air_purifier_humidity
title: Humidity
tap_action:
action: more-info
style:
top: 32%
left: 71%
min-width: 40px
min-height: 40px
text-align: center
font-size: 75%
transform: 'translate(-50%, 0)'
color: 'rgb(255,255,255)'
- type: state-icon
entity: switch.mi_air_purifier_led
title: Display
tap_action:
action: toggle
style:
top: 15%
left: 36%
transform: 'translate(-50%, 0)'
'--paper-item-icon-color': 'rgb(128, 128, 128)'
'--paper-item-icon-active-color': 'rgb(255, 128, 0)'
- type: state-icon
entity: switch.mi_air_purifier_buzzer
title: Buzzer
tap_action:
action: toggle
style:
top: 29%
left: 36%
transform: 'translate(-50%, 0)'
'--paper-item-icon-color': 'rgb(128, 128, 128)'
'--paper-item-icon-active-color': 'rgb(255, 128, 0)'
- type: state-icon
entity: switch.mi_air_purifier_child_lock
title: Child lock
tap_action:
action: toggle
style:
top: 1%
left: 26%
transform: 'translate(-50%, 0)'
'--paper-item-icon-color': 'rgb(128, 128, 128)'
'--paper-item-icon-active-color': 'rgb(255, 128, 0)'
- type: state-label
entity: sensor.mi_air_purifier_filter_remaining
title: Filter remaining
tap_action:
action: more-info
style:
top: 10%
left: 92%
min-width: 40px
min-height: 40px
text-align: center
font-size: 80%
color: 'rgb(128,128,128)'
- type: conditional
conditions:
- entity: binary_sensor.mi_air_purifier_mode_off
state: 'on'
elements:
- type: state-label
entity: sensor.mi_air_purifier_air_quality_pm25
title: PM2.5
tap_action:
action: more-info
style:
top: 19%
left: 68.5%
min-width: 40px
min-height: 40px
text-align: center
font-size: 400%
transform: 'translate(-50%, 0)'
color: 'rgb(128, 128, 128)'
- type: state-label
entity: sensor.mi_air_purifier_temp
title: Temperature
tap_action:
action: more-info
style:
top: 32%
left: 64%
min-width: 40px
min-height: 40px
text-align: center
font-size: 75%
transform: 'translate(-50%, 0)'
color: 'rgb(128, 128, 128)'
- type: state-label
entity: sensor.mi_air_purifier_humidity
title: Humidity
tap_action:
action: more-info
style:
top: 32%
left: 71%
min-width: 40px
min-height: 40px
text-align: center
font-size: 75%
transform: 'translate(-50%, 0)'
color: 'rgb(128, 128, 128)'
- type: state-icon
entity: binary_sensor.mi_air_purifier_mode_auto
title: Auto
icon: 'mdi:autorenew'
tap_action:
action: call-service
service: fan.set_speed
service_data:
entity_id: fan.mi_air_purifier_3h
speed: Auto
style:
top: 50%
left: 6%
transform: 'translate(-50%, 0)'
'--paper-item-icon-color': 'rgb(192, 192, 192)'
'--paper-item-icon-active-color': 'rgb(255, 128, 0)'
- type: state-icon
entity: binary_sensor.mi_air_purifier_mode_silent
title: Silent
icon: 'mdi:power-sleep'
tap_action:
action: call-service
service: fan.set_speed
service_data:
entity_id: fan.mi_air_purifier_3h
speed: Silent
style:
top: 50%
left: 16%
transform: 'translate(-50%, 0)'
'--paper-item-icon-color': 'rgb(192, 192, 192)'
'--paper-item-icon-active-color': 'rgb(255, 128, 0)'
- type: state-icon
entity: binary_sensor.mi_air_purifier_mode_fan
title: Fan
icon: 'mdi:fan'
tap_action:
action: call-service
service: fan.set_speed
service_data:
entity_id: fan.mi_air_purifier_3h
speed: Fan
style:
top: 50%
left: 26%
transform: 'translate(-50%, 0)'
'--paper-item-icon-color': 'rgb(192, 192, 192)'
'--paper-item-icon-active-color': 'rgb(255, 128, 0)'
- type: state-icon
entity: binary_sensor.mi_air_purifier_mode_favorite
title: Favorite
icon: 'mdi:heart'
tap_action:
action: call-service
service: fan.set_speed
service_data:
entity_id: fan.mi_air_purifier_3h
speed: Favorite
style:
top: 50%
left: 36%
transform: 'translate(-50%, 0)'
'--paper-item-icon-color': 'rgb(192, 192, 192)'
'--paper-item-icon-active-color': 'rgb(255, 128, 0)'
- type: conditional
conditions:
- entity: binary_sensor.mi_air_purifier_mode_fan
state: 'on'
elements:
- type: state-icon
entity: binary_sensor.mi_air_purifier_mode_fan_1
title: Fan level 1
icon: 'mdi:fan-speed-1'
tap_action:
action: call-service
service: xiaomi_miio.fan_set_fan_level
service_data:
entity_id: fan.mi_air_purifier_3h
level: 1
style:
top: 64%
left: 11%
transform: 'translate(-50%, 0)'
'--paper-item-icon-color': 'rgb(192, 192, 192)'
'--paper-item-icon-active-color': 'rgb(255, 128, 0)'
- type: state-icon
entity: binary_sensor.mi_air_purifier_mode_fan_2
title: Fan level 2
icon: 'mdi:fan-speed-2'
tap_action:
action: call-service
service: xiaomi_miio.fan_set_fan_level
service_data:
entity_id: fan.mi_air_purifier_3h
level: 2
style:
top: 64%
left: 21%
transform: 'translate(-50%, 0)'
'--paper-item-icon-color': 'rgb(192, 192, 192)'
'--paper-item-icon-active-color': 'rgb(255, 128, 0)'
- type: state-icon
entity: binary_sensor.mi_air_purifier_mode_fan_3
title: Fan level 3
icon: 'mdi:fan-speed-3'
tap_action:
action: call-service
service: xiaomi_miio.fan_set_fan_level
service_data:
entity_id: fan.mi_air_purifier_3h
level: 3
style:
top: 64%
left: 31%
transform: 'translate(-50%, 0)'
'--paper-item-icon-color': 'rgb(192, 192, 192)'
'--paper-item-icon-active-color': 'rgb(255, 128, 0)'
- type: conditional
conditions:
- entity: binary_sensor.mi_air_purifier_mode_favorite
state: 'on'
elements:
- type: state-label
entity: sensor.mi_air_purifier_favorite_level
title: Favorite level
tap_action:
action: none
style:
top: 64%
left: 21%
min-width: 40px
min-height: 40px
text-align: center
font-size: 200%
transform: 'translate(-50%, 0)'
color: 'rgb(255, 128, 0)'
- type: icon
icon: 'mdi:plus'
title: Favorite level +
tap_action:
action: call-service
service: script.favorite_up
service_data:
entity_id: fan.mi_air_purifier_3h
step: 2
style:
top: 66%
left: 30%
min-width: 40px
min-height: 40px
transform: 'translate(-50%, 0)'
color: 'rgb(192, 192, 192)'
color_off: 'rgb(255, 128, 0)'
- type: icon
icon: 'mdi:minus'
title: Favorite level -
tap_action:
action: call-service
service: script.favorite_down
service_data:
entity_id: fan.mi_air_purifier_3h
step: 1
style:
top: 66%
left: 16%
min-width: 40px
min-height: 40px
transform: 'translate(-50%, 0)'
color: 'rgb(192, 192, 192)'
color_off: 'rgb(255, 128, 0)'
- type: state-label
entity: input_select.mi_air_purifier_coverage
title: Coverage
tap_action:
action: none
style:
top: 74%
left: 23%
min-width: 40px
min-height: 40px
text-align: center
font-size: 100%
transform: 'translate(-50%, 0)'
color: 'rgb(255, 128, 0)'
pictures to be added in /config/www
Looks really good.
Does it work for you without timers if you have 3H? Mine often blips as unavailable, so automation action wont go through.
by timers you are saying input numbers and select?
Awesome schilea.
Your lovelace background card, did you create in Photoshop etc?
I would love to create a version that fits better with dark themes.
Hi, i have those Errors in log:
Logger: homeassistant.components.input_select
Source: components/input_select/__init__.py:256
Integration: Š”ŠæŠøŃŠ¾Šŗ ([documentation](https://www.home-assistant.io/integrations/input_select), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+input_select%22))
First occurred: 15:37:57 (2 occurrences)
Last logged: 16:08:58
Invalid option: (possible options: 2-4 mĀ², 5-9 mĀ², 7-12 mĀ², 12-22 mĀ², 14-24 mĀ², 14-25 mĀ², 16-27 mĀ², 17-30 mĀ², 18-32 mĀ², 19-33 mĀ², 20-34 mĀ², 22-38 mĀ², 23-40 mĀ², 26-45 mĀ², 28-49 mĀ²)
Logger: homeassistant.helpers.service
Source: helpers/service.py:464
First occurred: 16:01:03 (1 occurrences)
Last logged: 16:01:03
Unable to find referenced entities automation.air_purifier_translate_favorite_level_to_coverage
Copy exactly the automation from my post above 69. The automation you are getting error was renamed.
Still have this error
Logger: homeassistant.components.input_select
Source: components/input_select/__init__.py:256
Integration: Š”ŠæŠøŃŠ¾Šŗ ([documentation](https://www.home-assistant.io/integrations/input_select), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+input_select%22))
First occurred: 15:37:57 (7 occurrences)
Last logged: 16:58:55
Invalid option: (possible options: 2-4 mĀ², 5-9 mĀ², 7-12 mĀ², 12-22 mĀ², 14-24 mĀ², 14-25 mĀ², 16-27 mĀ², 17-30 mĀ², 18-32 mĀ², 19-33 mĀ², 20-34 mĀ², 22-38 mĀ², 23-40 mĀ², 26-45 mĀ², 28-49 mĀ²)
Seems related to the text in the automation.yaml. This is strange also for me as sometimes tested the template in supervisor but then when introducing in yaml I am getting an error. Try to remove " and to allign each command entirely on one single line.
But first test your value template in supervisor.
Try this, if not working replace ā with ".
option: >
{% if is_state_attr('fan.mi_air_purifier_3h','favorite_level', 0) -%}
2-4 mĀ²
{%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',1) -%}
5-9 mĀ²
{%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',2) -%}
7-12 mĀ²
{%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',3) -%}
12-22 mĀ²
{%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',4) -%}
14-24 mĀ²
{%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',5) -%}
14-25 mĀ²
{%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',6) -%}
16-27 mĀ²
{%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',7) -%}
17-30 mĀ²
{%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',8) -%}
18-32 mĀ²
{%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',9) -%}
19-33 mĀ²
{%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',10) -%}
20-34 mĀ²
{%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',11) -%}
22-38 mĀ²
{%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',12) -%}
23-40 mĀ²
{%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level', 13) -%}
26-45 mĀ²
{%- elif is_state_attr('fan.mi_air_purifier_3h','favorite_level',14) -%}
28-49 mĀ²
{%- else -%}
{%- endif %}"
This is how automations looks in my editor
you can test the template in Developer Tools - Templates, but as I said sometimes here is OK, but when introducing in yaml, I am getting an error.
I mean timers like I have on
air_purifier_auto-clean
so it will trigger cleaning even after regular trigger fails doe to connection issue