Code Monkey home page Code Monkey logo

cpa4-mushroom's People

Contributors

marcoleder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cpa4-mushroom's Issues

Compatibility with Xiaomi Air Purifier 4 Lite

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).

Also, some errors I've got:
image

Also, FWIW
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.