al-one / hass-xiaomi-miot

Automatic integrate all Xiaomi devices to HomeAssistant via miot-spec, support Wi-Fi, BLE, ZigBee devices. 小米米家智能家居设备接入Hass集成
https://miot-spec.com
Apache License 2.0
4.33k stars 609 forks source link

zhimi.airp.va2 pm2.5 entity no longer updates #1717

Open Viss opened 2 months ago

Viss commented 2 months ago

Device model / 设备型号

zhimi.airp.va2

Component version / 插件版本

0.7.18

HA core version / HA版本

2024.6.2

Integrated mode / 集成方式

Automatic (自动模式)

The problem / 问题详情

the zhimi.airp.va2 "air filter pro 4" air purifier usually reports a pm2.5 value. it seems to have stopped. power cycling the air filter will update the number to whatever it's first read is, but then it never updates again. I noticed when the value hadnt changed at all in a few days. having a look at the history:

image

i can see that on approx 1am may 4th the integration just stopped updating and seemed to only update when home assistant was restarted.

Entity attributes / 实体属性

preset_modes: Auto, Sleep, Favorite, Manual percentage: 33 percentage_step: 33 preset_mode: Auto model: zhimi.airp.va2 lan_ip: 10.0.2.196 mac_address: CC:B5:D1:1A:30:6F entity_class: MiotFanEntity miot_type: urn:miot-spec-v2:device:air-purifier:0000A007:zhimi-va2:1 air_purifier.on: true air_purifier.fault: 0 air_purifier.mode: 0 air_purifier.fan_level: 1 air_purifier.anion: false rfid.rfid_tag: 90:f:a3:aa:f1:ce:4 aqi.purify_volume: 1666887 custom_service.favorite_level: 3 custom_service.manual_level: 2 custom_service.iic_error_count: 23 screen.brightness: 2 physical_controls_locked: false alarm: false filter.filter_life_level: 0 filter.filter_used_time: 8709 filter.filter_left_time: 0 environment.relative_humidity: 56 environment.pm2_5_density: 5 environment.temperature: 25.3 state_updater: cloud rfid.rfid_factory_id: 0:0:41:50 rfid.rfid_product_id: 0:0:31:35 rfid.rfid_time: 0:22:10:21 rfid.rfid_serial_num: 0:19:57:34 aqi.average_aqi: 3 aqi.aqi_state: 0 aqi.aqi_updata_heartbeat: 0 custom_service.moto_speed_rpm: 488 custom_service.favorite_speed: 900 custom_service.motor_set_speed: 490 custom_service.buttom_door: false custom_service.reboot_cause: 0 sub_entities: environment-3.relative_humidity-1, environment-3.pm2_5_density-4, environment-3.temperature-7, filter-4.filter_life_level-1, air_purifier-2.on-1, air_purifier-2.anion-6, alarm-6.alarm-1, filter-4.filter_used_time-3, filter-4.filter_left_time-4, physical_controls_locked-8.physical_controls_locked-1 friendly_name: Xiaomi Smart Air Purifier 4 Pro Air Purifier supported_features: 9

Home Assistant Logs / 系统日志

image
SodaWithoutSparkles commented 1 month ago

Try reloading the integration and/or restarting the purifier. fixed it for me.

SodaWithoutSparkles commented 1 month ago

it seems that the integration forgets to refresh the status for the sensor. I can see that the attribute for pm2.5 in the main fan entity was updated, but not the dedicated sensor.

It seems that this issue affects xiaomi.airp.mp4 as well.

@al-one 帮忙看一下为什么净化器的代码里面,就算pm2.5的attribute更新了,也没有更新 pm2.5 实体。就是从开发者工具里面看到environment.pm2_5_density 更新了,但是sensor.xiaomi_mp4_pm25_density 还是没有更新。

SodaWithoutSparkles commented 3 weeks ago

Temporary mitigated by using a template sensor to read the attribute from the main fan entity.

state_attr('fan.purifier', 'environment.pm2_5_density')