briancmpbll / home_assistant_custom_envoy

171 stars 76 forks source link

Envoy fails to load with SyntaxError in line 174 const.py for v0.0.20-dev-1 #173

Closed wittelw closed 5 months ago

wittelw commented 7 months ago

I got an update notice this evening and updated to the latest dev build (log below). I added the comma to the end of line 174 of const.py as suggested in the log, restarted Home Assistant, and the Enphase Envoy component loaded. Current Power Production is showing 0 W, which is correct as it is after sunset at the moment.

2023-11-24 17:03:25.248 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-11-24 17:03:25.251 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration enphase_envoy which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-11-24 17:03:38.829 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing component custom_components.enphase_envoy
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 816, in get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/config/custom_components/enphase_envoy/__init__.py", line 19, in <module>
from .const import COORDINATOR, DOMAIN, NAME, PLATFORMS, SENSORS, CONF_USE_ENLIGHTEN, CONF_SERIAL, PHASE_SENSORS, DEFAULT_SCAN_INTERVAL
File "/config/custom_components/enphase_envoy/const.py", line 174
name="Active Inverter Count"
^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
2023-11-24 17:03:38.844 ERROR (MainThread) [homeassistant.setup] Setup failed for custom integration enphase_envoy: Unable to import component: Exception importing custom_components.enphase_envoy
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 816, in get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/config/custom_components/enphase_envoy/__init__.py", line 19, in <module>
from .const import COORDINATOR, DOMAIN, NAME, PLATFORMS, SENSORS, CONF_USE_ENLIGHTEN, CONF_SERIAL, PHASE_SENSORS, DEFAULT_SCAN_INTERVAL
File "/config/custom_components/enphase_envoy/const.py", line 174
name="Active Inverter Count"
^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 215, in _async_setup_component
component = integration.get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 824, in get_component
raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing custom_components.enphase_envoy
2023-11-24 17:03:45.217 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform custom_components.enphase_envoy.config_flow
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 836, in get_platform
cache[full_name] = self._import_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 853, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/config/custom_components/enphase_envoy/__init__.py", line 19, in <module>
from .const import COORDINATOR, DOMAIN, NAME, PLATFORMS, SENSORS, CONF_USE_ENLIGHTEN, CONF_SERIAL, PHASE_SENSORS, DEFAULT_SCAN_INTERVAL
File "/config/custom_components/enphase_envoy/const.py", line 174
name="Active Inverter Count"
^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
2023-11-24 17:03:45.235 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration enphase_envoy: Exception importing custom_components.enphase_envoy.config_flow
2023-11-24 17:03:45.313 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 836, in get_platform
cache[full_name] = self._import_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 853, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/config/custom_components/enphase_envoy/__init__.py", line 19, in <module>
from .const import COORDINATOR, DOMAIN, NAME, PLATFORMS, SENSORS, CONF_USE_ENLIGHTEN, CONF_SERIAL, PHASE_SENSORS, DEFAULT_SCAN_INTERVAL
File "/config/custom_components/enphase_envoy/const.py", line 174
name="Active Inverter Count"
^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2075, in _load_integration
integration.get_platform("config_flow")
File "/usr/src/homeassistant/homeassistant/loader.py", line 845, in get_platform
raise ImportError(
ImportError: Exception importing custom_components.enphase_envoy.config_flow
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/discovery_flow.py", line 96, in _async_start
await gather_with_limited_concurrency(
File "/usr/src/homeassistant/homeassistant/util/async_.py", line 187, in gather_with_limited_concurrency
return await gather(
^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/async_.py", line 185, in sem_task
return await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 880, in async_init
flow, result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 898, in _async_init
flow = await self.async_create_flow(handler, context=context, data=data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1000, in async_create_flow
handler = await _async_get_flow_handler(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2096, in _async_get_flow_handler
await _load_integration(hass, domain, hass_config)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2082, in _load_integration
raise data_entry_flow.UnknownHandler
homeassistant.data_entry_flow.UnknownHandler
catsmanac commented 7 months ago

Thanks for testing @wittelw, really appreciate. Did I mess up that comma big time. Went back and looked and saw I had it fixed on my test system here, but completely overlooked forwarding it into the test release. Clearly forgot to download it after publishing as well :-(.

I've pushed v0.0.20-dev-2 with the same fix you did (and downloaded it after update), so you probably will get another notification sometime.

This version only add showing active inverters for legacy envoy with firmware before R3.9, so if yours is newer the production version 0.0.19 is still good.