Support tilt for covers in ZHA

As discussed in Does ZHA not support tilt for covers/blinds? ZHA does not support tilt for covers currently. It would be great if that would be supported, since it is a quite basic feature in my opinion.

For reference, there is more related discussions here about the request and workarounds to tilt cover:

https://github.com/zigpy/zha-device-handlers/issues/1397

https://github.com/zigpy/zigpy/discussions/936

@cremor Maybe this should also be submitted to issues for Home Assistant core as well or?

https://github.com/home-assistant/core/issues

cover.py for zha component inside Home Assistant core looks to be missing tilt for covers?

https://github.com/home-assistant/core/tree/dev/homeassistant/components/cover

So need to extend cover support for tilt in cover.py for zha component inside Home Assistant core?

https://github.com/home-assistant/core/blob/9f0665bbb4c765b7ec00d7f042ccca0340ea9054/homeassistant/components/zha/cover.py

Could look at the other integrations/components that already include tilt and copy missing lines to zha?

And would of course also have to be tested by someone with access to cover devices with tilt function.

For comparison can look at some of the other components in Home Assistant core that implemented tilt:

https://github.com/home-assistant/core/blob/fe38e6ba875cb267da2ed066109b946a124166cc/homeassistant/components/mqtt/cover.py

https://github.com/home-assistant/core/blob/fe38e6ba875cb267da2ed066109b946a124166cc/tests/components/mqtt/test_cover.py

https://github.com/home-assistant/core/blob/9b5939a7a5424a8545c78e9b6b5f20e1a7ab7ac7/homeassistant/components/demo/cover.py

https://github.com/home-assistant/core/blob/e9a9b119c40c9337b1c61b7780e97b689cbd9f0f/homeassistant/components/template/cover.py

https://github.com/home-assistant/core/blob/3f7b7187ab410fd8dbf04fcfc834fda731dc8087/tests/components/group/test_cover.py

https://github.com/home-assistant/core/blob/a59460a23336627d0bc12b1eefffdaa516e55e87/tests/components/cover/test_reproduce_state.py

Other components already including tilt for cover are; deconz, somfy, esphome, knx, rfxtrx, and more:

https://github.com/home-assistant/core/search?p=4&q=tilt

1 Like

Yes, this is where the implementation is missing.

The Home Assistant Github issue tracker is only used for bugs. For feature requests it links to this forum.

I do have a Zigbee cover device that supports tilt, so I can test.

3 Likes

Have made changes in zha cover function. It wasn’t very difficult. Works fine, but not ready for integrate yet. I testet with Nexentro zigbee cover modul.
https://github.com/home-assistant/core/compare/dev…josef109:home-assistant_core:zha-cover_tilt

1 Like

Great, thanks!
Please let me know if I can help in any way! But I also only own the Nexentro Blinds Actuator Mini, so I assume we have the same hardware.

A few things that I noticed about your changes:

On zigbee cluster side there is no separate tilt command for up, down and stop. So now i changed it width “go_to_tilt_percentage” for up and down. Actually only the state is not working perfect.
@cremor: please test the changes

How can I test the changes? I don’t have any experience with Home Assistant development, or even Python development in general. Also, I only own a single Zigbee stick, so I’d have to test this with my real HA system I assume? I’m running it on a Raspberry Pi.

Btw, this line still looks like an error: Comparing home-assistant:dev...josef109:zha-cover_tilt · home-assistant/core · GitHub

I own a lot of Nexentro Blind Actuators so it would be amazing getting tilt positioning to work. I also can test if you give an explanation how. Thanks a lot for your effort @josef109

ok, i explain:
go to “[GitHub - josef109/home-assistant_core at zha-cover_tilt]”. Download the branch as zip or clone it.
Copy the complete homeassistant/components/zha directory to your device under config/custom_components. Add the line

“version”: “v1.2.3”

to /config/custom_components/zha/manifest.json. Restart the device. Check the logfile.
If you have no custom components use google to enable: :grinning:

in the log file there should be a warning if the zha custom component work:

WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration zha 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

1 Like

Will this custom component then replace the “original” ZHA? And will it take over the existing ZHA configuration?
Can we go back to the “original” ZHA by just deleting the custom component folder again?

yes, correct

1 Like

Do you plan on submitting this as patch to upstream ZHA as a pull request for the Home Assistant core?

We’ll see, but I have first to modify the tests for the changes

1 Like

I’ve now tested it at commit 9755570. The controls seem to all work fine, thanks!

The only problems I noticed are about the data that HA is showing:

  • The shown tilt position (current_tilt_position) isn’t updated very often. For sure less often than the cover position (current_position).
    Sometimes it even stays at old values forever. For example, I just closed my cover and current_tilt_position is still at 20, but should be reported as 0.
    But I don’t know if this is something you have control over, or if the devices just don’t send that data very often.
    • It seems like this also affects the “toggle tilt” command. If you execute it too soon after a previous execution finished, it will do nothing.
  • The cover state only stays in “opening” or “closing” state for a short while (maybe just as long as the tilt position is changing) and then shows “open” again, even though the cover is still moving (and current_position is still changing).

I also tested 9755570 today and have to say, it is working really well. Also the wall mounted buttons are still working and tilt position is precisely reported. Really good work.

@cremor: are you using the latest Nexentro Firmware

Yes, my devices use firmware version 0.0.52.5 and there is no update offered.

About the tilt position updates: The Nextentro Config app (which uses Bluetooth) shows tilt position updates way more often than HA.

bluetooth and zigbee are two completely independent interfaces. I think it is clear that the controller itself has the exact position. Whether it also communicates it, I can not say yet. Often the last position does not come through. It may be due to zigpy or the controller. I will check with the zigbee sniffer.

1 Like

I just saw that you created a pull request, thanks!

Did you find out anything about the tilt position update frequency?

@josef109 Is “tilt” and “lift” the same attribute in ZCL Window Covering cluster are “Tilt” and “Lift” separate attributes and if so should not Home Assistant’s cover component really support them as different device actions?

https://github.com/home-assistant/core/blob/bacbe4aa58e02a25217c07d23c45fccc70325a5e/homeassistant/components/cover/device_action.py

Reference: