Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

小米净烟机S2套装的灶具电量实体类型错误 #1874

Open
zhu opened this issue Sep 25, 2024 · 2 comments
Open

小米净烟机S2套装的灶具电量实体类型错误 #1874

zhu opened this issue Sep 25, 2024 · 2 comments

Comments

@zhu
Copy link

zhu commented Sep 25, 2024

Device model / 设备型号

xiaomi.hood.jyjss2

Component version / 插件版本

0.7.20

HA core version / HA版本

2024.9.3

Integrated mode / 集成方式

Automatic (自动模式)

The problem / 问题详情

No response

Entity attributes / 实体属性

restored: true
state_class: measurement
friendly_name: Mijia Smart Purifying Range Hood S2 Battery Level
supported_features: 0

Home Assistant Logs / 系统日志

日志记录器: homeassistant
来源: components/sensor/init.py:664
首次出现: 21:15:31 (260 次总计出现)
上次记录: 22:22:44

Error doing job: Task exception was never retrieved (None)
Error doing job: Exception in callback Entity._async_write_ha_state_from_call_soon_threadsafe() (None)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 657, in state
numerical_value = int(value)
^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'normal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 660, in state
numerical_value = float(value)
^^^^^^^^^^^^
ValueError: could not convert string to float: 'normal'

The above exception was the direct cause of the following exception:

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 664, in state
raise ValueError(
ValueError: Sensor sensor.xiaomi_jyjss2_0f04_battery_level has device class 'None', state class 'measurement' unit 'None' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'normal' (<class 'str'>)

@zhu
Copy link
Author

zhu commented Sep 25, 2024

把device_class改成enum就不会报错了。

@zhu
Copy link
Author

zhu commented Sep 25, 2024

另外好像还有很多实体没加载出来。
https://home.miot-spec.com/spec/xiaomi.hood.jyjss2
比如联动的灶具的状态等。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant