rnovacek / homeassistant_cz_energy_spot_prices

Home Assistant integration that provides current Czech electricity spot prices based on OTE.
Apache License 2.0
75 stars 17 forks source link

Integration stop working code 500 #4

Closed Nunak closed 1 year ago

Nunak commented 1 year ago

Hi,

many thanks for this integration!

some day ago this integration did stop working

2022-12-05 17:03:09.679 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform custom_components.cz_energy_spot_prices.config_flow
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/loader.py", line 728, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/loader.py", line 745, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/homeassistant/.homeassistant/custom_components/cz_energy_spot_prices/config_flow.py", line 59, in <module>
    class OptionsFlowHandler(config_entries.OptionsFlow):
  File "/home/homeassistant/.homeassistant/custom_components/cz_energy_spot_prices/config_flow.py", line 65, in OptionsFlowHandler
    self, user_input: dict[str, Any] | None = None
TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'NoneType'
2022-12-05 17:03:09.680 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration cz_energy_spot_prices: Exception importing
 custom_components.cz_energy_spot_prices.config_flow
2022-12-05 17:02:40.516 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/srv/homeassistant/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/srv/homeassistant/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/forwarded.py", line 222, in forwarded_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/ban.py", line 82, in ban_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/config/config_entries.py", line 218, in post
    return await super().post(request)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/data_validator.py", line 73, in wrapper
    result = await method(view, request, data, *args, **kwargs)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/data_entry_flow.py", line 71, in post
    result = await self._flow_mgr.async_init(
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 225, in async_init
    flow, result = await task
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 243, in _async_init
    flow = await self.async_create_flow(handler, context=context, data=data)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/config_entries.py", line 1626, in async_create_flow
    return HANDLERS[entry.domain].async_get_options_flow(entry)
  File "/home/homeassistant/.homeassistant/custom_components/cz_energy_spot_prices/config_flow.py", line 42, in async_get_options_flow
    return OptionsFlowHandler(config_entry)
NameError: name 'OptionsFlowHandler' is not defined
rnovacek commented 1 year ago

TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'NoneType'

This sounds like python version problem, could you check what version are you using? What HomeAssistant installation method have you used?

NameError: name 'OptionsFlowHandler' is not defined

This is strange, that class is defined few lines below this problem. could you please make sure that all the files were correctly copied into HomeAssistant folder?

Nunak commented 1 year ago

I did install via HACS.

version:

{
    "domain": "cz_energy_spot_prices",
    "name": "Czech Energy Spot Prices",
    "documentation": "https://github.com/rnovacek/homeassistant_cz_energy_spot_prices",
    "dependencies": [],
    "codeowners": ["@rnovacek"],
    "requirements": [],
    "iot_class": "cloud_polling",
    "version": "0.1.0",
    "config_flow": true
}

Let me try manual install via git

Nunak commented 1 year ago

I did manual install via git clone(old one has been deleted) and same issue :(

2022-12-05 17:52:22.120 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform custom_components.cz_energy_spot_prices.config_flow
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/loader.py", line 728, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/loader.py", line 745, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/homeassistant/.homeassistant/custom_components/cz_energy_spot_prices/config_flow.py", line 59, in <module>
    class OptionsFlowHandler(config_entries.OptionsFlow):
  File "/home/homeassistant/.homeassistant/custom_components/cz_energy_spot_prices/config_flow.py", line 65, in OptionsFlowHandler
    self, user_input: dict[str, Any] | None = None
TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'NoneType'
2022-12-05 17:52:22.122 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration cz_energy_spot_prices: Exception importing custom_components.cz_energy_spot_prices.config_flow
rnovacek commented 1 year ago

Please try pulling from git again, I've tried to fix it. Not quite certain it'll help.

Nunak commented 1 year ago

It's working! Many thanks :)

rnovacek commented 1 year ago

Cool, thanks for reporting!