marcolivierarsenault / moonraker-home-assistant

Home Assistant integration for Moonraker, Klipper and Mainsail
https://moonraker-home-assistant.readthedocs.io
MIT License
265 stars 28 forks source link

"Invalid handler specified" #332

Closed danielecosta7 closed 6 months ago

danielecosta7 commented 7 months ago

Errore durante l'installazione dell'integrazione (dopo averla scaricata e installata da HACS, ovviamente post reboot) Impossibile caricare il flusso di configurazione: {"message":"Invalid handler specified"

Screenshot 2024-04-29 213428

marcolivierarsenault commented 7 months ago

Can you please add the logs.

drpetersen commented 7 months ago

Same (except for the language) error message here. This is what's in the logs when I try to install the integration:

2024-05-01 15:11:11.236 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform custom_components.moonraker.config_flow
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/loader.py", line 1025, in _load_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/loader.py", line 1058, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1128, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/home/agent/.homeassistant/custom_components/moonraker/__init__.py", line 30, in <module>
    from .sensor import SENSORS
  File "/home/agent/.homeassistant/custom_components/moonraker/sensor.py", line 451
    name=f"{split_obj[1].replace("_", " ")} Power".title(),
                                  ^
SyntaxError: f-string: unmatched '('
2024-05-01 15:11:11.247 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration moonraker: Exception importing custom_components.moonraker.config_flow

Home Assistant installed in a virtual Python environment on a Raspberry Pi.

drpetersen commented 7 months ago

… and the obvious (Works for Me™ :wink:) patch:

--- /home/agent/.homeassistant/custom_components/moonraker/sensor.py.orig
+++ /home/agent/.homeassistant/custom_components/moonraker/sensor.py
@@ -448,7 +448,7 @@
             desc = MoonrakerSensorDescription(
                 key=f"{split_obj[0]}_{split_obj[1]}_power",
                 status_key=obj,
-                name=f"{split_obj[1].replace("_", " ")} Power".title(),
+                name=f"{split_obj[1].replace('_', ' ')} Power".title(),
                 value_fn=lambda sensor: int(
                     sensor.coordinator.data["status"][sensor.status_key]["power"] * 100
                 ),
drpetersen commented 7 months ago

… which actually seems to have been fixed three weeks ago … :thinking: just not been released so far.

So, sorry for the noise, this can be closed as far as I am concerned. Thank you!

marcolivierarsenault commented 7 months ago

Yeah simply download latest version of the code 'main' until I ship a new release.

https://moonraker-home-assistant.readthedocs.io/en/latest/support/latest.html

danielecosta7 commented 7 months ago

Yeah, same problem. I download the "main" version and now it's working. Thanks!