You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
我dump debug log如下
2024-05-17 14:23:53.479 DEBUG (MainThread) [custom_components.panasonic_smart_app] Finished fetching Panasonic Smart Application data in 10.019 seconds (success: True)
2024-05-17 14:23:53.480 DEBUG (MainThread) [custom_components.panasonic_smart_app] [客廳冷氣機 本月耗電量] state: 18.3
2024-05-17 14:23:53.480 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 492, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1069, in __async_calculate_state
if state_attributes := self.state_attributes:
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 446, in state_attributes
raise ValueError(
ValueError: Entity sensor.ke_ting_leng_qi_ji_ben_yue_hao_dian_liang (<class 'custom_components.panasonic_smart_app.sensor.PanasonicEnergySensor'>) with state_class total_increasing has set last_reset. Setting last_reset for entities with state_class other than 'total' is not supported. Please update your configuration if state_class is manually configured.
查了HA官方文件 https://developers.home-assistant.io/docs/core/entity/sensor
有以下描述
How to choose state_class and last_reset
It's recommended to use state class total without last_reset whenever possible, state class total_increasing or total with last_reset should only be used when state class total without last_reset does not work for the sensor.
我dump debug log如下
2024-05-17 14:23:53.479 DEBUG (MainThread) [custom_components.panasonic_smart_app] Finished fetching Panasonic Smart Application data in 10.019 seconds (success: True)
2024-05-17 14:23:53.480 DEBUG (MainThread) [custom_components.panasonic_smart_app] [客廳冷氣機 本月耗電量] state: 18.3
2024-05-17 14:23:53.480 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 492, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1069, in __async_calculate_state
if state_attributes := self.state_attributes:
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 446, in state_attributes
raise ValueError(
ValueError: Entity sensor.ke_ting_leng_qi_ji_ben_yue_hao_dian_liang (<class 'custom_components.panasonic_smart_app.sensor.PanasonicEnergySensor'>) with state_class total_increasing has set last_reset. Setting last_reset for entities with state_class other than 'total' is not supported. Please update your configuration if state_class is manually configured.
查了HA官方文件
https://developers.home-assistant.io/docs/core/entity/sensor
有以下描述
How to choose state_class and last_reset
It's recommended to use state class total without last_reset whenever possible, state class total_increasing or total with last_reset should only be used when state class total without last_reset does not work for the sensor.
看目前設置 PanasonicEnergySensor內的state_class會被指定成 total_increasing
last_reset看起來是為了每月重設 但不懂為什麼會拋個錯誤?
The text was updated successfully, but these errors were encountered: