home-assistant / architecture

Repo to discuss Home Assistant architecture
313 stars 100 forks source link

Add transition attribute to cover.set_*_position #471

Closed dnschneid closed 3 years ago

dnschneid commented 3 years ago

Context

From https://github.com/home-assistant/core/pull/40693

When automating lights, one can add a transition attribute to make them slowly change. The same can happen with powered blinds, where one can, for instance, slowly open the blinds in the morning to wake you up gently. Fast-moving blinds also tend to go VRRRR really loudly, so slowing down the transition is good to avoid unnecessary noise as well.

Proposal

Add a "transition" attribute to the cover.set_cover_position and cover.set_cover_tilt_position services.

Consequences

This will allow integrations that can support a transition time to implement it. If the protocol implemented by the cover doesn't support a transition time, it can generally be emulated in the component by turning it into repeated calls to set the position.

My experimental component for MySmartBlinds is one example of a component that implements a handler for transition when the protocol itself doesn't support it.

frenck commented 3 years ago

We generally only want to add things to our core, when there are multiple integrations/brands that can use this.

it can generally be emulated in the component by turning it into repeated calls to set the position

Emulation of this is not something we want to have in Home Assistant. We represent the devices and their capabilities as close to the original device as possible.

dnschneid commented 3 years ago

That certainly makes sense. I don't have a big picture into what platforms could natively support this. However, similar to light, it seems like a really fundamental thing to have, and greatly improves automations.

Emulation is also kind of a blurry line. The 1st party app for my blinds supports slow transitions, but it too appears to do so via repeated positioning calls (based on bluetooth traces). So if a library supporting this blind were to implement it, they would also emulate the transition in the Python library. I would assume that's ok as long as the emulation isn't happening in Homeassistant's code, right?

Right now, no component can implement timed transition support for covers, since the definition isn't there. Just like not all lights support timed transitions, it seems worthwhile to open this option up to the covers that can.

iMicknl commented 3 years ago

This would work for Somfy TaHoma as well, some covers can be operated with low speed (silently). Currently we implemented a set_cover_position_low_speed service.

https://github.com/iMicknl/ha-tahoma/blob/master/custom_components/tahoma/cover.py#L190-L199

cc @vlebourl @tetienne