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.67k stars 664 forks source link

soocare.toothbrush.1501 和yunmi.scales.ms103 无法正常接入ha #1970

Open WillionFe opened 1 day ago

WillionFe commented 1 day ago

Device model / 设备型号

soocare.toothbrush.1501 和yunmi.scales.ms103

Component version / 插件版本

0.7.24

HA core version / HA版本

2024.10.4

Integrated mode / 集成方式

Automatic (自动模式)

The problem / 问题详情

1、soocare.toothbrush.1501 小米电动牙刷T501可以接入,但无法获取电量数据,显示如下: 传感器

Battery Level 不可用

Battery Level event start

Battery Level timestamp 1970-01-01T08:00:00+08:00 2、yunmi.scales.ms103 小米体脂秤S400无法接入

Entity attributes / 实体属性

1、sensor.soocare_1501_5500_battery
unavailable
状态属性:
state_class: measurement
unit_of_measurement: "%"
device_class: battery
friendly_name: Mi Smart Electric Toothbrush T501 Battery Level
supported_features: 0
2、yunmi.scales.ms103 无实体

Home Assistant Logs / 系统日志

home-assistant_2024-11-24T06-39-12.599Z.log

al-one commented 13 hours ago

ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 1047, in _async_update_entity_states await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 960, in async_update_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1130, in _async_write_ha_state self.async_calculate_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1011, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 542, in state value = self.native_value ^^^^^^^^^^^^^^^^^ File "/config/custom_components/xiaomi_miot/sensor.py", line 322, in native_value if not prop.range_min() <= val <= prop.range_max(): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: '<=' not supported between instances of 'int' and 'NoneType'