marcoleder / cpa4-mushroom Goto Github PK
View Code? Open in Web Editor NEWXIAOMI smart air purifier 4 compact compatible with mushroom fan card HOME ASSISTANT
License: MIT License
XIAOMI smart air purifier 4 compact compatible with mushroom fan card HOME ASSISTANT
License: MIT License
Hey mate,
I'm trying to get this to work with 4 lite, but having some issues :D
I'm not very good with yaml, so might be something is wrong in my code. Could you please check?
# Shows powerState, speed, mode
- platform: template
sensors:
bedroom_fan_combined:
friendly_name: "Bedroom Fan Combined"
value_template: "{{ states('fan.zhimi_rmb1_b30a_air_purifier') }},
{{ states.fan.bedroom_fan.attributes.percentage }}%,
{{ states.input_select.air_purifier_mode.state }}"
# Fan oscillation modes (without sleep mode)
input_select:
air_purifier_mode:
name: Air Purifier Mode
options:
- "Auto"
- "Favorite"
initial: "Auto"
# Actual entity for smart air purifier
fan:
- platform: template
fans:
bedroom_fan:
friendly_name: "Bedroom fan"
value_template: "{{ is_state('fan.zhimi_rmb1_b30a_air_purifier', 'on') }}"
percentage_template: >-
{% if is_state('input_select.air_purifier_mode', 'Auto') %}
{{ ((state_attr('fan.zhimi_rmb1_b30a_air_purifier', 'custom_service.moto_speed_rpm') - 400)
/ (2050 - 400)) * 100 | round(0, 'floor') }}
{% else %}
{{ (states('number.zhimi_rmb1_b30a_air_purifier_favorite_level') | int) * (100/14) }}
{% endif %}
preset_mode_template: "{{ states('input_select.air_purifier_mode') }}"
oscillating_template: "{{ states('input_select.air_purifier_mode') }}"
turn_on:
service: fan.turn_on
target:
entity_id: fan.zhimi_rmb1_b30a_air_purifier
turn_off:
service: fan.turn_off
target:
entity_id: fan.zhimi_rmb1_b30a_air_purifier
set_percentage:
service: number.set_value
target:
entity_id: number.zhimi_rmb1_b30a_air_purifier_favorite_level
data:
value: "{{ (percentage * 14) / 100 | round(0, 'floor') }}"
set_oscillating:
- service: input_select.select_next
target:
entity_id: input_select.air_purifier_mode
- service: fan.set_preset_mode
target:
entity_id: fan.zhimi_rmb1_b30a_air_purifier
data_template:
preset_mode: "{{ states('input_select.air_purifier_mode') }}"
speed_count: 15
preset_modes:
- 'Auto'
- 'Favorite'
Basically it doesn't let me change the fan speed in Favorite mode, only in Auto(which. obviously, doesn't work).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.