Closed Gloomyeye closed 1 day ago
Seems somehow a json file for power profile which was downloaded is corrupted somehow.
I need to work on better error handling here, so the corrupted file is redownload in this case.
You might have a look in config/.storage/powercalc_profiles
directory. You can remove all directories here and this will cause powercalc to redownload all the profiles.
Please also make sure you are on v1.12.13, which optimized download logic bug which was in v1.12.12, which probably caused the corruption in the first place.
Hope this helps.
Thank you for your response. In installed the latest version of powercalc. However, the deletion of the directories has no effect. I can see that the files are redownloded after restarting. The error "ValueError: 'None' is not a valid ColorMode" still occurs. All my hue lights are affected with the error.
Very strange how that broke all of a sudden. Powercalc tries to get the current color mode of the light after a state change of the light. Somehow there is no color mode, but that is mandatory state attribute for a light. Never seen reports about this error before, so very strange you run into it all of a sudden.
Could you have a look into developer tools that state attributes of your light?
yes, that is strange if color mode should be always available. I updated all my hue lamps to the newest firmware.
The developer tools section shows this for an inactive light:
min_color_temp_kelvin: 2202
max_color_temp_kelvin: 4504
min_mireds: 222
max_mireds: 454
effect_list:
- blink
- breathe
- okay
- channel_change
- candle
- finish_effect
- stop_effect
- stop_hue_effect
supported_color_modes:
- color_temp
effect: null
color_mode: null
brightness: null
color_temp_kelvin: null
color_temp: null
hs_color: null
rgb_color: null
xy_color: null
icon: mdi:ceiling-light
friendly_name: Pendelleuchte KUE (L)
supported_features: 44
This is the status after activating the light:
min_color_temp_kelvin: 2202
max_color_temp_kelvin: 4504
min_mireds: 222
max_mireds: 454
effect_list:
- blink
- breathe
- okay
- channel_change
- candle
- finish_effect
- stop_effect
- stop_hue_effect
supported_color_modes:
- color_temp
effect: null
color_mode: color_temp
brightness: 102
color_temp_kelvin: 2732
color_temp: 366
hs_color:
- 28.327
- 64.71
rgb_color:
- 255
- 167
- 89
xy_color:
- 0.524
- 0.387
icon: mdi:ceiling-light
friendly_name: Pendelleuchte KUE (L)
supported_features: 44
My zigbee2mqtt stauts of the light looks like this:
{
"brightness": 102,
"color_mode": "color_temp",
"color_temp": 366,
"color_temp_startup": 65535,
"linkquality": 216,
"power_on_behavior": "on",
"state": "OFF",
"update": {
"installed_version": 16786434,
"latest_version": 16786434,
"state": "idle"
},
"update_available": false,
"device": {
"applicationVersion": 2,
"dateCode": "20240329",
"friendlyName": "Hue Pendelleuchte KUE (L)",
"hardwareVersion": 1,
"ieeeAddr": "0x001788010b7f75f0",
"manufacturerID": 4107,
"manufacturerName": "Signify Netherlands B.V.",
"model": "8719514301481",
"networkAddress": 60641,
"powerSource": "Mains (single phase)",
"softwareBuildID": "1.116.3",
"stackVersion": 1,
"type": "Router",
"zclVersion": 8
}
}
In general, the color_mode status is set in Zigbee2MQTT. However, the status in Home Assistant is null if the light is off.
This looks fine. When the light is on there is a color mode and when off it's null
. That's also on my HA instance and expected behaviour.
LUT calculation is only executed when the light is on. So looking at the exception there is a moment where the light is set to on but color mode missing in the attributes.
Do you get this error message everytime after toggling the light, or only sporadic?
Since when does this error message appear? Is this after you updated HA, powercalc or the firmware of your Hue lights.
I did some testing with different test scenarios. The answers to your questions:
Tests:
1) Toggle light If I toggle the lights on and off, no error message will be created. I tested it with three Hue lights.
2) Reload integrations If I reload all powercalc integrations with the home assistant service, then I get one warning twice. Maybe this is another "bug" / not related to my initial issue. This is the warning:
Logger: homeassistant.util.loop
Quelle: util/loop.py:86
Erstmals aufgetreten: 23:20:42 (2 Vorkommnisse)
Zuletzt protokolliert: 23:20:42
Detected blocking call to walk with args ('/config/.storage/powercalc_profiles/signify/LCX004',) inside the event loop by custom integration 'powercalc' at custom_components/powercalc/power_profile/power_profile.py, line 171: return sorted(next(os.walk(self.get_model_directory(True)))[1]) (offender: /config/custom_components/powercalc/power_profile/power_profile.py, line 171: return sorted(next(os.walk(self.get_model_directory(True)))[1])), please create a bug report at https://github.com/bramstroker/homeassistant-powercalc/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#walk Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/config/custom_components/powercalc/sensor.py", line 353, in async_setup_entry await _async_setup_entities( File "/config/custom_components/powercalc/sensor.py", line 375, in _async_setup_entities entities = await create_sensors(hass, config, discovery_info, config_entry) File "/config/custom_components/powercalc/sensor.py", line 625, in create_sensors return await create_individual_sensors( File "/config/custom_components/powercalc/sensor.py", line 755, in create_individual_sensors power_sensor = await create_power_sensor( File "/config/custom_components/powercalc/sensors/power.py", line 121, in create_power_sensor return await create_virtual_power_sensor( File "/config/custom_components/powercalc/sensors/power.py", line 141, in create_virtual_power_sensor power_profile = await get_power_profile( File "/config/custom_components/powercalc/power_profile/factory.py", line 40, in get_power_profile profile = await library.get_profile( File "/config/custom_components/powercalc/power_profile/library.py", line 110, in get_profile await profile.select_sub_profile(sub_profile) File "/config/custom_components/powercalc/power_profile/power_profile.py", line 187, in select_sub_profile if not self.has_sub_profiles: File "/config/custom_components/powercalc/power_profile/power_profile.py", line 175, in has_sub_profiles return len(self.get_sub_profiles()) > 0 File "/config/custom_components/powercalc/power_profile/power_profile.py", line 171, in get_sub_profiles return sorted(next(os.walk(self.get_model_directory(True)))[1])
Detected blocking call to scandir with args ('/config/.storage/powercalc_profiles/signify/LCX004',) inside the event loop by custom integration 'powercalc' at custom_components/powercalc/power_profile/power_profile.py, line 171: return sorted(next(os.walk(self.get_model_directory(True)))[1]) (offender: <frozen os>, line 366: ?), please create a bug report at https://github.com/bramstroker/homeassistant-powercalc/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#scandir Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/config/custom_components/powercalc/sensor.py", line 353, in async_setup_entry await _async_setup_entities( File "/config/custom_components/powercalc/sensor.py", line 375, in _async_setup_entities entities = await create_sensors(hass, config, discovery_info, config_entry) File "/config/custom_components/powercalc/sensor.py", line 625, in create_sensors return await create_individual_sensors( File "/config/custom_components/powercalc/sensor.py", line 755, in create_individual_sensors power_sensor = await create_power_sensor( File "/config/custom_components/powercalc/sensors/power.py", line 121, in create_power_sensor return await create_virtual_power_sensor( File "/config/custom_components/powercalc/sensors/power.py", line 141, in create_virtual_power_sensor power_profile = await get_power_profile( File "/config/custom_components/powercalc/power_profile/factory.py", line 40, in get_power_profile profile = await library.get_profile( File "/config/custom_components/powercalc/power_profile/library.py", line 110, in get_profile await profile.select_sub_profile(sub_profile) File "/config/custom_components/powercalc/power_profile/power_profile.py", line 187, in select_sub_profile if not self.has_sub_profiles: File "/config/custom_components/powercalc/power_profile/power_profile.py", line 175, in has_sub_profiles return len(self.get_sub_profiles()) > 0 File "/config/custom_components/powercalc/power_profile/power_profile.py", line 171, in get_sub_profiles return sorted(next(os.walk(self.get_model_directory(True)))[1])
I created a button to reload all powercalc integration which is using the homeassistant.reload_config_entry service:
type: entities
entities:
- type: button
icon: mdi:play-circle-outline
name: Powercalc neustarten
action_name: Ausführen
tap_action:
action: call-service
confirmation:
text: Reload config?
service: homeassistant.reload_config_entry
data: {}
target:
entity_id:
- sensor.hue_lamp_02_energy
- sensor.hue_lamp_03_energy
- sensor.hue_lightstrip_01_energy
- sensor.hue_lamp_05_part_01_energy
- sensor.hue_lamp_05_part_02_energy
- sensor.hue_lamp_05_part_03_energy
- sensor.aza_outlet_ikea_01_energy
- sensor.hue_light_01_part_01_energy
- sensor.hue_light_01_part_02_energy
- sensor.hue_light_01_part_03_energy
- sensor.hue_light_01_part_04_energy
- sensor.hue_lamp_01_energy
- sensor.hue_lamp_04_energy
- sensor.hue_lamp_08_energy
- sensor.hue_lightstrip_02_energy
- sensor.esp32_lightstrip_01_energy
- sensor.bose_media_soundbar_300_energy
- sensor.hue_lamp_07_energy
- sensor.hue_lamp_06_energy
- sensor.hue_lamp_05_energy
- sensor.hue_lamp_09_energy
- sensor.hue_light_01_energy
3) Restarting home assistant I restart my home assistant instance (not only the YAML files). Then I got my errors from my first post again. This is the log after restarting: home-assistant_2024-06-28T21-28-49.834Z.log
4) Redownloaded powercalc integration from HACS After I reload the integration from HACS (v.1.12.13) I get a lot of warnings regarding powercalc integration. I did not restarted the home assistant system.
Logger: homeassistant.util.loop
Quelle: util/loop.py:86
Erstmals aufgetreten: 23:30:11 (58 Vorkommnisse)
Zuletzt protokolliert: 23:30:11
Detected blocking call to open with args ('/config/custom_components/powercalc/strategy/fixed.py', 'wb') inside the event loop by custom integration 'hacs' at custom_components/hacs/repositories/base.py, line 600: zip_file.extractall(self.content.path.local) (offender: /usr/local/lib/python3.12/zipfile/__init__.py, line 1801: open(targetpath, "wb") as target:), please create a bug report at https://github.com/hacs/integration/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response await func(hass, connection, msg) File "/config/custom_components/hacs/websocket/repository.py", line 234, in hacs_repository_download await repository.async_install() File "/config/custom_components/hacs/repositories/base.py", line 893, in async_install await self.async_install_repository(version=version) File "/config/custom_components/hacs/repositories/base.py", line 975, in async_install_repository await self.download_zip_files(self.validate) File "/config/custom_components/hacs/repositories/base.py", line 566, in download_zip_files await self.async_download_zip_file( File "/config/custom_components/hacs/repositories/base.py", line 600, in async_download_zip_file zip_file.extractall(self.content.path.local)
Detected blocking call to open with args ('/config/custom_components/powercalc/strategy/__init__.py', 'wb') inside the event loop by custom integration 'hacs' at custom_components/hacs/repositories/base.py, line 600: zip_file.extractall(self.content.path.local) (offender: /usr/local/lib/python3.12/zipfile/__init__.py, line 1801: open(targetpath, "wb") as target:), please create a bug report at https://github.com/hacs/integration/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response await func(hass, connection, msg) File "/config/custom_components/hacs/websocket/repository.py", line 234, in hacs_repository_download await repository.async_install() File "/config/custom_components/hacs/repositories/base.py", line 893, in async_install await self.async_install_repository(version=version) File "/config/custom_components/hacs/repositories/base.py", line 975, in async_install_repository await self.download_zip_files(self.validate) File "/config/custom_components/hacs/repositories/base.py", line 566, in download_zip_files await self.async_download_zip_file( File "/config/custom_components/hacs/repositories/base.py", line 600, in async_download_zip_file zip_file.extractall(self.content.path.local)
Detected blocking call to open with args ('/config/custom_components/powercalc/__init__.py', 'wb') inside the event loop by custom integration 'hacs' at custom_components/hacs/repositories/base.py, line 600: zip_file.extractall(self.content.path.local) (offender: /usr/local/lib/python3.12/zipfile/__init__.py, line 1801: open(targetpath, "wb") as target:), please create a bug report at https://github.com/hacs/integration/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response await func(hass, connection, msg) File "/config/custom_components/hacs/websocket/repository.py", line 234, in hacs_repository_download await repository.async_install() File "/config/custom_components/hacs/repositories/base.py", line 893, in async_install await self.async_install_repository(version=version) File "/config/custom_components/hacs/repositories/base.py", line 975, in async_install_repository await self.download_zip_files(self.validate) File "/config/custom_components/hacs/repositories/base.py", line 566, in download_zip_files await self.async_download_zip_file( File "/config/custom_components/hacs/repositories/base.py", line 600, in async_download_zip_file zip_file.extractall(self.content.path.local)
Detected blocking call to open with args ('/config/custom_components/powercalc/const.py', 'wb') inside the event loop by custom integration 'hacs' at custom_components/hacs/repositories/base.py, line 600: zip_file.extractall(self.content.path.local) (offender: /usr/local/lib/python3.12/zipfile/__init__.py, line 1801: open(targetpath, "wb") as target:), please create a bug report at https://github.com/hacs/integration/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response await func(hass, connection, msg) File "/config/custom_components/hacs/websocket/repository.py", line 234, in hacs_repository_download await repository.async_install() File "/config/custom_components/hacs/repositories/base.py", line 893, in async_install await self.async_install_repository(version=version) File "/config/custom_components/hacs/repositories/base.py", line 975, in async_install_repository await self.download_zip_files(self.validate) File "/config/custom_components/hacs/repositories/base.py", line 566, in download_zip_files await self.async_download_zip_file( File "/config/custom_components/hacs/repositories/base.py", line 600, in async_download_zip_file zip_file.extractall(self.content.path.local)
Detected blocking call to open with args ('/config/custom_components/powercalc/manifest.json', 'wb') inside the event loop by custom integration 'hacs' at custom_components/hacs/repositories/base.py, line 600: zip_file.extractall(self.content.path.local) (offender: /usr/local/lib/python3.12/zipfile/__init__.py, line 1801: open(targetpath, "wb") as target:), please create a bug report at https://github.com/hacs/integration/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response await func(hass, connection, msg) File "/config/custom_components/hacs/websocket/repository.py", line 234, in hacs_repository_download await repository.async_install() File "/config/custom_components/hacs/repositories/base.py", line 893, in async_install await self.async_install_repository(version=version) File "/config/custom_components/hacs/repositories/base.py", line 975, in async_install_repository await self.download_zip_files(self.validate) File "/config/custom_components/hacs/repositories/base.py", line 566, in download_zip_files await self.async_download_zip_file( File "/config/custom_components/hacs/repositories/base.py", line 600, in async_download_zip_file zip_file.extractall(self.content.path.local)
Could you please make a separate issue for 2 and 4, the mentioning about Detected blocking call
?
Tens of them are already fixed in a few releases last month, but apparently there are still some cases I missed.
In v1.12.12 there was a bug which caused powercalc to redownload each and every profile again and again.
So I would suggest to not use that version anymore, as the Colormode error
is 99.9% sure not related to any powercalc version.
Good to know you only get the color mode error at startup. Still strange and seem to maybe be a bug in the Hue integration which got introduced recently. I will make that more failsafe so powercalc does not raise an error on it.
1) Error about color mode fixed with #2334. It should log a warning now (also with entity_id included), no error anymore. 2) Blocking call log fixed with #2335 3) Will have a further look into this error if I can make this more robust 4) This is not a Powercalc issue, but a HACS issue, you must report this at HACS
The errors about blocking calls is something HA added lately to detect that and it's hitting almost all custom integrations. It's to further improve HA performance, to make it even more impressive than it is already.
Implemented retry mechanism for the JSON decode error with #2336
Will issue a new release soon with all the fixes.
Hope this solves everything for you.
Thank you very much for your great work and time! I’m looking forward for the New Release.
v1.13.0-beta.0 was released. Could you please give that a test run?
After restarting and updating to the beta version, I got my initial colormode error again as well as the following:
Logger: homeassistant.helpers.event
Quelle: helpers/event.py:342
Erstmals aufgetreten: 16:02:51 (12 Vorkommnisse)
Zuletzt protokolliert: 16:02:51
Error while dispatching event for sensor.hue_light_01_part_03_power to <Job track state_changed event ['sensor.hue_lightstrip_01_power', 'sensor.hue_light_01_part_02_power', 'sensor.hue_light_01_part_04_power', 'sensor.hue_light_01_part_03_power', 'sensor.hue_light_01_part_01_power'] HassJobType.Callback <bound method GroupedSensor.on_state_change of <entity sensor.hue_light_01_power=unknown>>>
Error while dispatching event for sensor.hue_lamp_05_part_01_power to <Job track state_changed event ['sensor.hue_lamp_05_part_01_power', 'sensor.hue_lamp_05_part_02_power', 'sensor.hue_lamp_05_part_03_power'] HassJobType.Callback <bound method GroupedSensor.on_state_change of <entity sensor.hue_lamp_05_power=unknown>>>
Error while dispatching event for sensor.hue_lightstrip_01_power to <Job track state_changed event ['sensor.hue_lightstrip_01_power', 'sensor.hue_light_01_part_02_power', 'sensor.hue_light_01_part_04_power', 'sensor.hue_light_01_part_03_power', 'sensor.hue_light_01_part_01_power'] HassJobType.Callback <bound method GroupedSensor.on_state_change of <entity sensor.hue_light_01_power=unknown>>>
Error while dispatching event for sensor.hue_lamp_05_part_03_power to <Job track state_changed event ['sensor.hue_lamp_05_part_01_power', 'sensor.hue_lamp_05_part_02_power', 'sensor.hue_lamp_05_part_03_power'] HassJobType.Callback <bound method GroupedSensor.on_state_change of <entity sensor.hue_lamp_05_power=unknown>>>
Error while dispatching event for sensor.hue_light_01_part_01_power to <Job track state_changed event ['sensor.hue_lightstrip_01_power', 'sensor.hue_light_01_part_02_power', 'sensor.hue_light_01_part_04_power', 'sensor.hue_light_01_part_03_power', 'sensor.hue_light_01_part_01_power'] HassJobType.Callback <bound method GroupedSensor.on_state_change of <entity sensor.hue_light_01_power=unknown>>>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 342, in _async_dispatch_entity_id_event
hass.async_run_hass_job(job, event)
File "/usr/src/homeassistant/homeassistant/core.py", line 938, in async_run_hass_job
hassjob.target(*args)
File "/config/custom_components/powercalc/sensors/group.py", line 577, in on_state_change
new_state = self.calculate_new_state(event.data["new_state"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/powercalc/sensors/group.py", line 649, in calculate_new_state
del self._states[state.entity_id]
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
KeyError: 'sensor.hue_lamp_05_part_02_power'
After another restart I get the same errors.
this is the first error:
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht
Logger: homeassistant
Quelle: custom_components/powercalc/strategy/lut.py:196
Integration: Powercalc (Dokumentation, Probleme)
Erstmals aufgetreten: 16:05:26 (34 Vorkommnisse)
Zuletzt protokolliert: 16:05:30
Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/powercalc/sensors/power.py", line 378, in appliance_state_listener
await self._handle_source_entity_state_change(
File "/config/custom_components/powercalc/sensors/power.py", line 490, in _handle_source_entity_state_change
self._power = await self.calculate_power(state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/powercalc/sensors/power.py", line 539, in calculate_power
power = await self._strategy_instance.calculate(entity_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/powercalc/strategy/lut.py", line 130, in calculate
color_mode = await self.get_selected_color_mode(attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/powercalc/strategy/lut.py", line 196, in get_selected_color_mode
color_mode = ColorMode(str(attrs.get(ATTR_COLOR_MODE, ColorMode.UNKNOWN)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/enum.py", line 757, in __call__
return cls.__new__(cls, value)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/enum.py", line 1171, in __new__
raise ve_exc
ValueError: 'None' is not a valid ColorMode
Thanks for testing. Hopefully fixed with #2339 and #2338. Just released v1.13.0-beta.1 Please give it another go.
Yeah, that looks good! With beta.1 no errors or warnings occur. Thank you very much!
nice good to hear
System Health details
System Information
Home Assistant Community Store
GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.34.0 Stage | running Available Repositories | 1390 Downloaded Repositories | 22 HACS Data | okHome Assistant Cloud
logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | okHome Assistant Supervisor
host_os | Home Assistant OS 12.4 -- | -- update_channel | beta supervisor_version | supervisor-2024.06.2 agent_version | 1.6.0 docker_version | 26.1.4 disk_total | 395.0 GB disk_used | 31.1 GB healthy | true supported | true host_connectivity | true supervisor_connectivity | true ntp_synchronized | true virtualization | kvm board | ova supervisor_api | ok version_api | ok installed_addons | ESPHome (2024.6.2), Samba share (12.3.1), Piper (1.5.0), openWakeWord (1.10.0), Terminal & SSH (9.14.0), Samba Backup (5.2.0), Studio Code Server (5.15.0), vosk (1.6.0)Dashboards
dashboards | 5 -- | -- resources | 15 views | 36 mode | storageMiele
component_version | 2024.5.0 -- | -- reach_miele_cloud | okRecorder
oldest_recorder_run | 15. Juni 2024 um 15:09 -- | -- current_recorder_run | 25. Juni 2024 um 22:34 estimated_db_size | 814.04 MiB database_engine | sqlite database_version | 3.44.2Checklist
Describe the issue
Hello,
I get the an error in the log during startup of Home Assistant after direct updating of powercalc intergration regarding JSONDecodeError. After restarting again the JSONDecodeError disappears and invalid ColorMode error occurs.
Reproduction steps
Debug logs
Diagnostics dump or YAML config
Two diagnostics as an example. I have different Hue lamps with powercal integration in use. Always use the library option: config_entry-powercalc-c3e34bc1f7d5d4d24f32d1cf1492a1e6.json config_entry-powercalc-9a2d46d3e74b7b4ca0b3846b2e8dd1c3.json