@tube0013 Can you see in the log that zha_toolkit is loadling before zha?
What version of HA are you using?
EDIT: I released v0.8.33 - hopefully that will allow zha-toolkit to be setup - it no longer expects “the gateway” to be defined in ZHA to do its own initialisation. Hopefully that fixes it. If not, zha-toolkit will have to be setup not testing anything about zha at startup at all and report that zha is missing later (on every zha-toolkit service call).
So on Link to Entities – My Home Assistant you can tick the checkbox at the start of the line for an entity. A menu will appear at the top where the “red button” allows you to delete the selected entities.
Hi,
Lately my zigbee coordinator goes offline sometimes.
I tried setting up an automation to warn me about that using the device_offline trigger, but that doesn’t seem to help. can zha_toolkit help here?
Hello @le_top. Thank you for your great work. Is it possible, to convert the zigbee2mqtt room-loadbalancing-blueprint fron napalm to zha? I use danfoss ally thermostats at my whole house (actually 11, but later 15) but sometimes grouped heaters are uneven hot. With z2m and room loadbalancing, they get even heat. But i have a lot of issues with z2m and would like to go back to zha.
It is possible to implement this under ZHA, but there is some work to transform this, mainly to work with the load values.
I think of these 3 ways to do it (I can think of more, but these would be the ones I consider):
Work purely with a yaml automation (/blueprint) and zha-toolkit features to read the load values;
Extend the existing danfoss quirk/zha_device_handlers (+ZHA?) to add the load values as a state attribute. Then use this attribute in a yaml script.
Implement part of the code in Python, and mix with a yaml automation. It is easy and dynamic to add a new service to ZHA-Toolkit. There could be a set of danfoss specific services, and we would need one that accepts a list of devices that need load balancing, and the python code would take care of getting the current load indicators, compute the totals and send them to the devices.
It would then suffice to call this service on a regular basis.
1. Using Yaml and ZHA-Toolkit features.
a. One should verify/configure the Load reporting configuration of the Danfoss Valves. This is a one time configuration that could be added to the existing Danfoss configuration script.
A correct configuration ensures that the valves are reporting their load without a need to send a zigbee attribute read request to the valves.
b. The load values would then end up in the cached values in the zigpy/zha database. They can be read using a service call like this (the example is for reading a cached temperature value). The key elements in this example are (1) use_cache which avoids sending a read request to the valve, and (2) writing the result directly to a state value or state attribute which is then useable in the automation.
- alias: Try to get more precise temperature (should work if zigbee temperature
sensor)
service: zha_toolkit.attr_read
data:
ieee: '{{ temp_sensor_id }}'
use_cache: true
cluster: 1026
attribute: 0
state_id: '{{ temp_sensor_id }}'
state_attr: best_val
state_value_template: value/100
c. Compute the total load value - use a repeat loop in yaml and use the attr_read service as shown in (b) to get the load value, and compute the required sum. After the sum, loop again and use attr_write to send this value to the valves.
2. Update the zha_quirk
Implies starting from the existing quirk and make necessary changes to make the load value accessible from Home Assistant. I know that ZHA has evolve recently to make some of that easier to implement.
3. Implement part of the code in Python
One could start by adding a user service as shown in the _user.py example and documented here.
Zha-toolkit reloads the code before calling it so one can evolve and test the code without restarting HA.
The command_data argument/field can be used to provide the list of devices in one room. The python code would then loop over this list, either use the ‘attr_read’ service by calling it internally with the proper arguments, or implement the reads more explicitly and check the cache using code as in zcl_attr.py.
Thank you for your explanation. I thought, it would be much easier to implement this feature. Too bad, that my coding knowledge is nearly zero. Well, i have to stay at z2m then i think.
@le_top Thanks again for continuing to develop zha-toolkit! Wondering if can suggest that you update your original post in this thread for the current feature so that it summarize is correct when it is linked:
zha-toolkit did not wait for such a feature for providing responses which can be fouind in the event data. There are some examples that demonstrate how to use that.
However, it would certainly beneficial to provide the data directly to the automation rather than having to retrieve it from the event (which is kind of complex to capture in an automation).
However, I did not find technical documentation on how to generate those responses in a component’s python by following the links in the release notes.
Release notes also mention that integration developers first need to enable it per service. So you can not get responses from just any service, instead, it has been enabled in the integration for each specific service that you want to be able to give a response.
As I understand, the release notes implies that other than for scripts it has so far only been enabled for calendar.list_events and conversation.process services in the Calander integration as an example so guess that integration developers would need to use that as a reference?
Perhaps @allenporter has more info or links on implementing responses for services in integrations?
but then I get SyntaxError: positional argument follows keyword argument - I will find the correct way to do it (named argumetn or positional argument).
I’m trying to use Toolkit, which has been installed/activated correctly. I also activated the custom component under “log” in my configuration. I understand that the feedback from running the services will be listed in the Home Assistant core log file - correct? The problem is I see nothing in the log file.
Is there somebody who can point me in the direction of a solution?!
One way to verify that zha-toolkit is correctly set up is to verify that they appear in “Developrer Tools > Services” (example in French):
Using that same location to run services, you can dynamically change the log level (no need to add them to you static configuration - the configuration is kept until reboot or another change):
It is true that the traces should occur in the log (/config/home-assistant.log).
With Home Assistant >=2023.7 and zha-toolkit>=v0.9.7, you can also see the response when using th e “Developer Tools>Services” without the need to activate logging or listen to events:
And when using a zha-toolkit service, you can get the result in a variable by adding “response_variable: …” to the service arguments.
Do you see the zha toolkit services? Do you have zha insdtalled as well (zha-toolkit ‘extends’ zha)? zha has services as well, so you can check that you have access to those: