home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.64k stars 29.94k forks source link

Xiaomi Air Humidifier 2 no water level attribute #46585

Closed georgekucher closed 3 years ago

georgekucher commented 3 years ago

The problem

'water_level' attribute is absent in "zhimi.humidifier.ca4" entity

What is version of Home Assistant Core has the issue?

core-2021.2.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Xiaomi Miio

Link to integration documentation on our website

https://www.home-assistant.io/integrations/xiaomi_miio/#xiaomi-air-purifier-and-humidifier

Example YAML snippet

# Put your YAML below this line
default_config:

frontend:
  themes:
    light:
      primary-color: white
    dark:
      primary-color: black

config:
automation: !include automations.yaml
mqtt:
  broker: 192.168.0.100

logger:
  default: critical
  logs:
    # log level for HA core
    homeassistant.core: fatal

    # log level for MQTT integration
    homeassistant.components.mqtt: debug

sensor:
  - platform: mqtt
    name: "out_temp"
    unit_of_measurement: '°C'
    state_topic: "raw/out/temperature"
    icon: mdi:thermometer

  - platform: mqtt
    name: "out_humidity"
    unit_of_measurement: '%'
    state_topic: "raw/out/humidity"
    icon: mdi:water-percent

  - platform: mqtt
    name: "out_pressure"
    unit_of_measurement: 'hPa'
    state_topic: "raw/out/pressure"
    icon: mdi:gauge

  - platform: mqtt
    name: "out_vcc"
    unit_of_measurement: 'V'
    state_topic: "raw/out/vcc"
    icon: mdi:battery

  - platform: mqtt
    name: "in_temp"
    unit_of_measurement: '°C'
    state_topic: "raw/in/temperature"
    icon: mdi:thermometer

  - platform: mqtt
    name: "in_humidity"
    unit_of_measurement: '%'
    state_topic: "raw/in/humidity"
    icon: mdi:water-percent

  - platform: mqtt
    name: "in_pressure"
    unit_of_measurement: 'hPa'
    state_topic: "raw/in/pressure"
    icon: mdi:gauge

  - platform: mqtt
    name: "in_vcc"
    unit_of_measurement: 'V'
    state_topic: "raw/in/vcc"
    icon: mdi:battery

  - platform: mqtt
    name: "in_co2"
    unit_of_measurement: 'ppm'
    state_topic: "raw/in/co2"
    icon: mdi:molecule-co2

  - platform: mqtt
    name: "in_pm1"
    unit_of_measurement: 'μg/m3'
    state_topic: "raw/in/pm/1"
    icon: mdi:factory

  - platform: mqtt
    name: "in_pm2.5"
    unit_of_measurement: 'μg/m3'
    state_topic: "raw/in/pm/2.5"
    icon: mdi:factory

  - platform: mqtt
    name: "in_pm10"
    unit_of_measurement: 'μg/m3'
    state_topic: "raw/in/pm/10"
    icon: mdi:factory

switch:
  - platform: xiaomi_miio
    host: 192.168.0.214
    token: <token>

fan:
  - platform: xiaomi_miio
    host: 192.168.0.215
    token: <token>
    model: zhimi.humidifier.ca4
    name: Air Humidifier 2

Anything in the logs that might be useful for us?

# Put your logs below this line

Screenshot_2

probot-home-assistant[bot] commented 3 years ago

Hey there @rytilahti, @syssi, @starkillerog, mind taking a look at this issue as its been labeled with an integration (xiaomi_miio) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

rytilahti commented 3 years ago

Yes, it's a known issue. No new state attributes are allowed, the integration needs to be refactored to separate the sensors before this can be fixed, see the discussion at https://github.com/home-assistant/core/pull/44252#discussion_r544210553 .

georgekucher commented 3 years ago

@rytilahti Thanks! Good to know. But seems like nobody is in hurry to do that((

starkillerOG commented 3 years ago

@georgekucher actually I am working on changing the whole Miio integration to config flow, which is the first step towards seperating the state attributes to entities. See PR: https://github.com/home-assistant/core/pull/46179

You are welcome to help.

georgekucher commented 3 years ago

@starkillerOG, Nice! Thank you! I could test it. When will it be available for Docker?

b0g3r commented 3 years ago

Faced with the same issue — ca4 in HA doesn't have a water level parameter. Currently, I'm using the workaround with Xiaomi Raw HACS:

sensor:
  - platform: xiaomi_miio_raw
    name: Humidifier LR 1
    host: 192.168.X.X
    token: t0k3n
    max_properties: 15
    default_properties_getter: get_properties
    default_properties:
      - "{ 'siid': 2, 'piid': 1, 'did': 'power' }"
      - "{ 'siid': 2, 'piid': 2, 'did': 'fault' }"
      - "{ 'siid': 2, 'piid': 5, 'did': 'mode' }"
      - "{ 'siid': 2, 'piid': 6, 'did': 'target_humidity' }"
      - "{ 'siid': 2, 'piid': 7, 'did': 'water_level' }"
      - "{ 'siid': 2, 'piid': 8, 'did': 'dry' }"
      - "{ 'siid': 2, 'piid': 9, 'did': 'use_time' }"
      - "{ 'siid': 2, 'piid': 10, 'did': 'button_pressed' }"
      - "{ 'siid': 2, 'piid': 11, 'did': 'speed_level' }"
      - "{ 'siid': 3, 'piid': 7, 'did': 'temperature' }"
      - "{ 'siid': 3, 'piid': 8, 'did': 'fahrenheit' }"
      - "{ 'siid': 3, 'piid': 9, 'did': 'humidity' }"
      - "{ 'siid': 4, 'piid': 1, 'did': 'buzzer' }"
      - "{ 'siid': 5, 'piid': 2, 'did': 'led_brightness' }"
      - "{ 'siid': 6, 'piid': 1, 'did': 'child_lock' }"
      - "{ 'siid': 7, 'piid': 1, 'did': 'actual_speed' }"
      - "{ 'siid': 7, 'piid': 3, 'did': 'power_time' }"
      - "{ 'siid': 7, 'piid': 5, 'did': 'clean_mode' }"
  - platform: template
    sensors:
      humudifier_lr_1_water_level:
        friendly_name: "Уровень воды"
        unit_of_measurement: "%"
        value_template: "{{ ((state_attr('sensor.humidifier_lr_1', 'water_level')/128)*100)|round|int }}"
snp88 commented 3 years ago

core-2021.4.3 still persist image

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.