ha_xiaomi_home
ha_xiaomi_home copied to clipboard
[Bug]: 单位 'μS/cm' 转换为 UnitOfConductivity 类中的一个属性 MICROSIEMENS_PER_CM 但是抛出了 AttributeError(我是一个小学生)
Describe the bug / 描述问题
具体是它尝试将单位 'μS/cm' 转换为 UnitOfConductivity 类中的一个属性 MICROSIEMENS_PER_CM。但是,在这个类中找不到对应的属性,导致抛出了 AttributeError。
To Reproduce / 复现步骤
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/xiaomi_home/init.py", line 265, in async_setup_entry raise err File "/config/custom_components/xiaomi_home/init.py", line 140, in async_setup_entry device.spec_transform() File "/config/custom_components/xiaomi_home/miot/miot_device.py", line 531, in spec_transform service_entity = self.parse_miot_service_entity( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/xiaomi_home/miot/miot_device.py", line 478, in parse_miot_service_entity prop.external_unit = self.unit_convert(prop.unit) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/xiaomi_home/miot/miot_device.py", line 630, in unit_convert unit_map['μS/cm'] = UnitOfConductivity.MICROSIEMENS_PER_CM ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: type object 'UnitOfConductivity' has no attribute 'MICROSIEMENS_PER_CM' 2024-12-18 13:32:45.951 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 你猜我是谁: 263986907 [中国大陆] for xiaomi_home Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/xiaomi_home/init.py", line 265, in async_setup_entry raise err File "/config/custom_components/xiaomi_home/init.py", line 140, in async_setup_entry device.spec_transform() File "/config/custom_components/xiaomi_home/miot/miot_device.py", line 531, in spec_transform service_entity = self.parse_miot_service_entity( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/xiaomi_home/miot/miot_device.py", line 478, in parse_miot_service_entity prop.external_unit = self.unit_convert(prop.unit) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/xiaomi_home/miot/miot_device.py", line 630, in unit_convert unit_map['μS/cm'] = UnitOfConductivity.MICROSIEMENS_PER_CM ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expected behavior / 预期结果
成功添加实体设备
Home Assistant Logs / 系统日志
No response
Home Assistant Core version / Home Assistant Core 版本
2024.8.2
Home Assistant Operation System version / Home Assistant Operation System 版本
20240809.0
Xiaomi Home integration version / 米家集成版本
v0.1.2
Additional context / 其他说明
No response