jeroenterheerdt / HAsmartirrigation

Smart Irrigation custom component for Home Assistant
MIT License
301 stars 47 forks source link

Integration loading error #333

Closed freedoc35 closed 1 month ago

freedoc35 commented 2 months ago

What happened?

I had to restore a backup due to a new setup of my HA server. Erything went sooth, I also did many restarts of HA meanwhile.

Today it told me, that Smart irrigation could not be loaded anymore. It also doesn't appear in the sidebar. I even tried to delete it, which also was not possible.

How to reproduce

It is always and maintaining broken.

Relevant log output

Here the error log from protocol:

Logger: homeassistant.loader
Quelle: loader.py:921
Erstmals aufgetreten: 08:21:47 (2 Vorkommnisse)
Zuletzt protokolliert: 08:54:05

Unexpected exception importing component custom_components.smart_irrigation
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 921, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/smart_irrigation/__init__.py", line 40, in <module>
    from .store import async_get_registry
  File "/config/custom_components/smart_irrigation/store.py", line 279
    async def async_factory_default_modules(self):
    ^^^^^
IndentationError: expected an indented block after function definition on line 268

Which version are you running?

v2024.1.0

Diagnostics file

Additional information

I am not able to downlad a diagnostic file. Ther is no such option!

Diondk commented 2 months ago

I had the same after installing v2024.3.0 for now i went back to v2024.1.0 and it started working again. Can be a work around for now.

freedoc35 commented 2 months ago

I was stuck completely. Now I was able to delete the old integration (2024.1.0), but reinstalling 2024.3.0 doesn't work either..

Diondk commented 2 months ago

Sorry made a typo, i am currently on 2024.1.0 and its working fine Go to hacs -> smart irrigation -> 3 dots in upper right corner -> redownload and select v2024.1.0 -> click download an after installation restart HA

freedoc35 commented 2 months ago

Made it.

2024.1.0 works again.

Thanks

Am Di., 12. März 2024 um 09:31 Uhr schrieb Dion @.***>:

Sorry made a typo, i am currently on 2024.1.0 and its working fine Go to hacs -> smart irrigation -> 3 dots in upper right corner -> redownload and select v2024.1.0 -> click download an after installation restart HA

— Reply to this email directly, view it on GitHub https://github.com/jeroenterheerdt/HAsmartirrigation/issues/333#issuecomment-1991032060, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6EBG2NBYGLJ2LDAMBKLVTDYX24NBAVCNFSM6AAAAABERXELHOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJRGAZTEMBWGA . You are receiving this because you authored the thread.Message ID: @.***>

-- Dietmar Grasl Florianerstr. 20 A - 4483 Hargelsberg @.***

jata1 commented 2 months ago

I have the same issue. Downgrading to the working version now.

jata1 commented 2 months ago

For some reason I can't select another version of the integration but I do have a backup from yesterday.

I have made other changes in HA today so I would like to just restore this integration. What is the process?

Update: luckily I had a copy of the custom component backed up yesterday. Just copied it back and restarted HA.

ScratMan commented 2 months ago

There is an issue in the store.py file. The method async_factory_default_zonesis empty at line 268, while it's called on line 262. Solved the issue by changing lines 260 to 277 by :

    async def set_up_factory_defaults(self):
        # if not self.zones:
        #     await self.async_factory_default_zones()
        if not self.modules:
            await self.async_factory_default_modules()
        if not self.mappings:
            await self.async_factory_default_mappings()

    # async def async_factory_default_zones(self):
        #new_zone1 = ZoneEntry(
        #    **{ZONE_ID: 0, ZONE_NAME: localize("defaults.default-zone", self.hass.config.language)+" 1", ZONE_SIZE: 50.5, ZONE_THROUGHPUT: 10.1,ZONE_MODULE:0,ZONE_MAPPING:0,ZONE_LEAD_TIME:0, ZONE_MAXIMUM_DURATION:CONF_DEFAULT_MAXIMUM_DURATION, ZONE_MAXIMUM_BUCKET: CONF_DEFAULT_MAXIMUM_BUCKET}
        #)
        #new_zone2 = ZoneEntry(
        #    **{ZONE_ID: 1, ZONE_NAME: localize("defaults.default-zone", self.hass.config.language)+" 2", ZONE_SIZE: 100.1, ZONE_THROUGHPUT: 20.2,ZONE_MODULE:0,ZONE_MAPPING: 0, ZONE_LEAD_TIME:0, ZONE_MAXIMUM_DURATION: CONF_DEFAULT_MAXIMUM_DURATION, ZONE_MAXIMUM_BUCKET: CONF_DEFAULT_MAXIMUM_BUCKET}
        #)
        #self.zones[0] = new_zone1
        #self.zones[1] = new_zone2
        #self.async_schedule_save()
dlindnegm commented 2 months ago

Mine is completely broken. After upgrading to 2024.3.0 I got an error "Error Config flow could not be loaded: {"message":"Invalid handler specified"}". I re-downloaded and re-installed but it never shows on the side-bar and if I try to reinstall the integration it says that only one instance can be installed. I've tried to download the previous version but none of the prior versions can be selected. Tried a restore of the custom_components folder but still got the same errors, and still no side-bar. Nothing in the HA logs and not able to get a debug log since there's nothing showing in the Integrations GUI. Also tried editing the store.py file with the code ScratMan provided but that hasn't fixed it.

jeroenterheerdt commented 2 months ago

so sorry, my bad. Should be fixed in v2024.3.1 (at least it's on my machine ;))

dlindnegm commented 2 months ago

v2024.3.1 has fixed it for me - Thanks!

I'm still not able to select a different version to re-download using the HA GUI. Previous versions show up but after you select one it always reverts to the most current version. There's a message that says "The version selector will be removed in a future release. If you need to install a specific version, you can do so by using the service call for update entities.". This is happening for all HACS integrations, so I'm assuming that change has already been implemented.

It looks like the new method to downgrade is to use a service call. I haven't tried it, but it looks like this might be the method:

service: update.install
target:
  entity_id: update.smart_irrigation_update
data:
  version: v2024.1.0