homeassistant-powercalc: Bug: Cannot import name 'CONF_SENSORS'
Edit: closed issue. Seems to have been resolved by updating to 2023.8.0b3.
System Health details
System Information
version | core-2023.8.0b2
Checklist
- I have read the FAQ to see if there is a known solution to my problem.
- I have enabled debug logging for my installation.
- I have filled out the issue template to the best of my ability.
- This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
- This issue is not a duplicate issue of currently previous issues…
Describe the issue
Powercalc presents an error after updating to the latest version. I had been putting it off since there was a potential breaking change. I removed the last remaining sensor that didn’t conform to the new template format and updated to the latest version.
Not sure if this is all related, but updated HA to 2023.8.0b2 to address the issue described here. After restarting I updated the remaining custom integrations, including Powercalc to the latest versions. I then tried to restart but was unable to due the error below:
Logger: homeassistant.components.hassio
Source: components/hassio/__init__.py:568
Integration: Home Assistant Supervisor ([documentation](https://rc.home-assistant.io/integrations/hassio), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+hassio%22))
First occurred: 7:50:04 AM (1 occurrences)
Last logged: 7:50:04 AM
The system cannot restart because the configuration is not valid: Component error: powercalc - cannot import name 'CONF_SENSORS' from 'custom_components.powercalc.const' (/config/custom_components/powercalc/const.py)
and
Logger: homeassistant.components.websocket_api.http.connection
Source: components/hassio/__init__.py:579
Integration: Home Assistant WebSocket API ([documentation](https://rc.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 7:50:04 AM (1 occurrences)
Last logged: 7:50:04 AM
[3486935016] The system cannot restart because the configuration is not valid: Component error: powercalc - cannot import name 'CONF_SENSORS' from 'custom_components.powercalc.const' (/config/custom_components/powercalc/const.py)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/hassio/__init__.py", line 579, in async_handle_core_service
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: The system cannot restart because the configuration is not valid: Component error: powercalc - cannot import name 'CONF_SENSORS' from 'custom_components.powercalc.const' (/config/custom_components/powercalc/const.py)
I’m not sure if this is related to something that changed with the powercalc updates or if it’s a result of updating to 2023.8.0b2.
Reproduction steps
- Pirateweather broke a couple of core components and a fix was identified and implemented in 2023.8.0b2. I updated HA to this version.
- Updated Powercalc and a number of other HACS custom integrations and frontend components.
- Attempted to restart Home Assistant.
- Errors prevent HA from restarting.
Debug logs
Unfortunately I am unable to restart HA so I could not enable debug logging.
Diagnostics dump or YAML config
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 19 (9 by maintainers)
Thanks, that’s what I needed! I removed powercalc in HACS and deleted
powercalc:fromconfiguration.yaml, then I could restart HA and install it again!Awesome glad you are up and running again!
I’ve had the same error this evening - I upgraded HA from 2023.05.03 to latest. Powercalc was on an older version and was unloaded after the upgrade. Once i’d upgraded all of the add-ons, HA complained about incorrect config as described by @albertskog. I had to comment out all the Powercalc entities in the configuration yaml file and reboot. After Powercalc reloaded, I re-enabled all the entities again.
I suspect the problem is with Powercalc being unloaded when you check the config.
@albertskog please see this comment https://github.com/bramstroker/homeassistant-powercalc/issues/1786#issuecomment-1665146058. You first have to make sure powercalc is removed as it seems it blocks HA startup in your case. Restart HA and reinstall powercalc 1.8.5
Sorry, I was not very clear in my previous comment. Since upgrading to HA 2023.8.0, I’m not able to restart HA because of this issue with powercalc, first with the old powercalc version but then when I upgraded, I suppose I’m now in some in-between state half upgraded to powercalc 1.8.5? Not too familiar with how the internals work here I’m afraid…
The logs say the error first appeared yesterday, right around the time when I upgraded HA.