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

米家p1燃气灶套装,电池电量实体错误 #1630

Open
xtjun opened this issue Apr 17, 2024 · 1 comment
Open

米家p1燃气灶套装,电池电量实体错误 #1630

xtjun opened this issue Apr 17, 2024 · 1 comment

Comments

@xtjun
Copy link

xtjun commented Apr 17, 2024

Device model / 设备型号

cykj.hood.jyj22

Component version / 插件版本

0.7.17

HA core version / HA版本

2024.4.3

Integrated mode / 集成方式

Local (本地模式)

The problem / 问题详情

电量实体一直报错,因为此设备上报燃气灶的电量为normal,而不是数值类型

Entity attributes / 实体属性

实体不可用

Home Assistant Logs / 系统日志

2024-04-17 10:11:43.721 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 663, 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 666, 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 1035, in _update_entity_states
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 969, in async_update_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 670, in state
raise ValueError(
ValueError: Sensor sensor.cykj_jyj22_e9f6_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'>)
2024-04-17 10:11:45.626 ERROR (MainThread) [homeassistant.helpers.entity] Update for light.cykj_jyj22_e9f6_light fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 663, 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 666, 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.py", line 951, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1268, in async_device_update
await self.async_update()
File "/config/custom_components/xiaomi_miot/init.py", line 1524, in async_update
await self.async_update_for_main_entity()
File "/config/custom_components/xiaomi_miot/init.py", line 1565, in async_update_for_main_entity
self._update_sub_entities(
File "/config/custom_components/xiaomi_miot/init.py", line 2101, in _update_sub_entities
self._subs[fnm].update_from_parent()
File "/config/custom_components/xiaomi_miot/init.py", line 2461, in update_from_parent
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 670, in state
raise ValueError(
ValueError: Sensor sensor.cykj_jyj22_e9f6_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'>)

@al-one
Copy link
Owner

al-one commented Apr 30, 2024

尝试master分支。

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

2 participants