BottlecapDave / HomeAssistant-OctopusEnergy

Unofficial Home Assistant integration for interacting with Octopus Energy
https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/
MIT License
532 stars 49 forks source link

Invalid Config - Unable to prepare setup for platform 'octopus_energy.sensor' #873

Closed bunjamin1982 closed 1 month ago

bunjamin1982 commented 1 month ago

Describe the bug

Since upgrading to version 11.0.0 I have seen this error posted. Have removed and re-installed the integration - still seeing same error.

Logger: homeassistant.setup Source: setup.py:404 First occurred: 10:58:31 (1 occurrences) Last logged: 10:58:31 Unable to prepare setup for platform 'octopus_energy.sensor': Platform not found (Exception importing custom_components.octopus_energy.sensor).

Reproduction steps

Upgrade to v11.0, error posted. Uninstalled integration, and re-downloaded via HACS. Same error posted following set up

Expected behaviour

Normal operation

Tariff Code

E-1R-AGILE-23-12-06-B

Integration Version

11.0.0

Home Assistant Version

2024.2.2

Fresh Install?

After upgrading

Home Assistant Logs

Logger: homeassistant.loader Source: loader.py:847 First occurred: 12:41:04 (1 occurrences) Last logged: 12:41:04 Unexpected exception importing platform custom_components.octopus_energy.sensor

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/loader.py", line 847, in get_platform cache[full_name] = self._import_platform(platform_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 864, in _import_platform return importlib.import_module(f"{self.pkg_path}.{platform_name}") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 994, in exec_module File "", line 488, in _call_with_frames_removed File "/config/custom_components/octopus_energy/sensor.py", line 35, in from .cost_tracker.cost_tracker import OctopusEnergyCostTrackerSensor File "/config/custom_components/octopus_energy/cost_tracker/cost_tracker.py", line 43, in class OctopusEnergyCostTrackerSensor(CoordinatorEntity, RestoreSensor): File "/config/custom_components/octopus_energy/cost_tracker/cost_tracker.py", line 147, in OctopusEnergyCostTrackerSensor async def _async_calculate_cost(self, event: Event[EventStateChangedData]):


TypeError: type 'Event' is not subscriptable

----------------------------------------
Logger: homeassistant.setup
Source: setup.py:404
First occurred: 12:41:04 (1 occurrences)
Last logged: 12:41:04
Unable to prepare setup for platform 'octopus_energy.sensor': Platform not found (Exception importing custom_components.octopus_energy.sensor).

### Confirmation

- [X] I confirm that I cannot find my solution within the [documentation](https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy)
- [X] I confirm that I cannot find my solution within the [FAQ](https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/faq)
c235tgfer commented 1 month ago

@bunjamin1982 I had the same error - I upgraded HA itself to latest (2024.5.3) and it's fixed it, maybe give that a spin?

BottlecapDave commented 1 month ago

Ah looks like the deprecation warning I was fixing had it's solution only added in 2023.5. I'll update the minimum version. I'm sorry that you encountered this. As @c235tgfer mentioned you can either upgrade HA or revert to an older version of the integration.

BottlecapDave commented 1 month ago

I've re-released v11.0.0 with the minimum HA version set to 2024.5.0.

bunjamin1982 commented 1 month ago

Thank you all - I can confirm upgrading to a later HA version has fixed the issue