zha-toolkit icon indicating copy to clipboard operation
zha-toolkit copied to clipboard

Backup blueprint broke with latest update

Open roblamoreaux opened this issue 1 year ago • 9 comments

`The latest update seems to have removed the zha_execute service that the backuyp blueprint uses, so it give an error message.

I think the blueprint needs to be changed to the new zhe_toolkit.backup service.

roblamoreaux avatar Aug 01 '24 13:08 roblamoreaux

It looks like I may have been mistaken, in that ZHA_Toolkit had not started due to not finding HA Core. updating to V1.1.12 seems to have fixed that, but I am getting the following when I execute the script: Daily Coordinator Backup - Monthly rotation: Error executing script. Unexpected error for call_service at pos 1: 'HAZHAData' object has no attribute 'gateway' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 525, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 764, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 727, in _async_run_long_action return await long_task ^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2763, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2806, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/zha_toolkit/__init__.py", line 684, in toolkit_service zha_gw = zha.gateway ^^^^^^^^^^^ AttributeError: 'HAZHAData' object has no attribute 'gateway'

roblamoreaux avatar Aug 01 '24 16:08 roblamoreaux

It looks like the latest version obliges to find a new way to access the 'gateway' instance (if it's still there).

This surely impacts more than just the backup which is as far as I know also proposed by ZHA itself.

mdeweerd avatar Aug 01 '24 20:08 mdeweerd

The gateway file was deleted from 2024.7.4 to 2024.8.0b

diff --git a/homeassistant/components/zha/core/gateway.py b/homeassistant/components/zha/core/gateway.py
deleted file mode 100644

mdeweerd avatar Aug 01 '24 21:08 mdeweerd

But thre is a function to get it (accroding to homeassistant/components/zha/diagnostics.py code)

    gateway: [-ZHAGateway-]{+Gateway+} = get_zha_gateway(hass)
    app = gateway.application_controller

And found in the zha helpers:

homeassistant/components/zha/helpers.py:def get_zha_gateway(hass: HomeAssistant) -> Gateway:
homeassistant/components/zha/helpers.py:def get_zha_gateway_proxy(hass: HomeAssistant) -> ZHAGatewayProxy:

I do not have a 2024.8.X system yet, and other priorities as well.

mdeweerd avatar Aug 01 '24 21:08 mdeweerd

then, this integration requires more rework and will fail for all users next week. With the last version I tried to overcome this - but it seem, that there are more areas that needs to be adapted.

Unfortunately, I also do not have the capacity to go through all cases :-(

ChristophCaina avatar Aug 02 '24 10:08 ChristophCaina

Tip of the day : Keep version HA 2024.7 or lower ! With each update of HA, incompatibility issues exist.

I'm using 2024.6.4 version and all i need, works like a charm. Why change ?

CordoWEB avatar Aug 02 '24 13:08 CordoWEB

We're restructuring ZHA a lot and will have more major changes in the next couple of releases.

I think long-term the functionality you rely on to be provided by ZHA Toolkit needs to be moved into zigpy and ZHA for it to be stable.

puddly avatar Aug 02 '24 17:08 puddly

We're restructuring ZHA a lot and will have more major changes in the next couple of releases. I think long-term the functionality you rely on to be provided by ZHA Toolkit needs to be moved into zigpy and ZHA for it to be stable.

Why i need zha_toolkit ? Because in ZHA there are a "zha.set_zigbee_cluster_attribute" but no "zha.get_zigbee_cluster_attribute". I do not understand why because this function is available on HA UI. I need it to read information on zigbee a device every 40s. When you request this feature, the first answer is "install zha-toolkit" ! Thanks a lot if you can add it.

CordoWEB avatar Aug 02 '24 19:08 CordoWEB

Try out the beta release, 1.1.19 and see how things go. This resolved all issues for my use cases.

wbyoung avatar Aug 09 '24 22:08 wbyoung

#271 is a duplicate, but I already tagged that one, so I am closing this.

mdeweerd avatar Dec 25 '24 21:12 mdeweerd