home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.65k stars 30.79k forks source link

Support transitions for Shelly Dimmer (2) #45310

Closed Didel closed 3 years ago

Didel commented 3 years ago

The problem

In Home Assistant it is possible to use the ‘transition’ property, in order to make a smooth fade over time from the current to the desired value. For example, with lights, this can be used to have the lights fade slowly until they have reached the desired percentage of brightness.

The Shelly Dimmer 2 that I have installed doesn’t seem to support this. It is setup with the native Shelly integration. I can successfully use Home Assistant to turn the lights (connected to the Shelly Dimmer) on or off, set them to a certain percentage, control the brightness using the wall switch and see the updated value resembled in the Home Assistant ui, all works as desired. I can successfully use transitions on other ‘light’ entities in my home (for example Hue bulbs, both via the Hue integration and Hue bulbs operated directly via Zigbee, so without the Hue hub), but when changing nothing but the entity_id to the Shelly dimmer, it immediately sets the new value without the transition.

Environment

Problem-relevant configuration.yaml

The issue occurs when, for example, using the development tools to call the light.turn_on service with the following data (serial number redacted from entity_id) :

entity_id: light.shellydimmer2_xxxxxxxx_light_0
brightness_pct: 100
transition: 60

When replacing the entity_id for another (non-Shelly) light entity, the transition works as expected.

Traceback/Error logs

Additional information

The Shelly Dimmer 2 was updated to the most recent firmware (1.9.4), but after reboot of both the Shelly and Home Assistant the same problems still appear.

bieniu commented 3 years ago

Unfortunately, currently the device/firmware doesn't support transitions when turning the light on/off or changing brightness. You can permanently enable the transitions via the settings https://shelly-api-docs.shelly.cloud/#shelly-dimmer-sl-settings

Didel commented 3 years ago

Hm. As a fellow developer, I completely understand the answer and the reasons why that prevents support of the transition. Even with the 'permanent' setting, it looks like it doesn't allow more than 5 seconds, while I would like to have the lights fade in more slowly (e.g. when sunset starts, I slowly transition the lights from 0 to 100 over a few minutes, so you almost don't notice the lights are being turned on).

However, as a 'normal' user, I don't get why something that is perfectly dimmable through software (without doubt the best of its kind) would not allow me to automatically fade from one setting to another over a set period of time using the same software. The way I see it, the configuration added in YML (regardless if it is in a scene, automation or something else) is not a way in which the user can / should directly address the API's of the end device, but a generic interface to describe the desired actions or states. The user should not be 'limited' by whether or not the device's API supports it. In the YML the user describes what should happen, it is up to Home Assistant to make it happen (in the best possible way). For supported devices and/or integrations, it should obviously use the API's to do so. However, in cases like this, I think that Home Assistant should fall back to some custom functionality that uses a loop to in/decrease the value over time. By doing so, the user input doesn't have to change, more devices are supported immediately and once the proper API's are available they can be implemented instead in order to improve the performance and/or reliability.

I would understand if this specific issue isn't the right place for this (request for) change. I'm not that familiar (yet) with the Home Assistant community, do you think it would make sense to enter this as a separate issue?

bieniu commented 3 years ago

However, in cases like this, I think that Home Assistant should fall back to some custom functionality that uses a loop to in/decrease the value over time.

I don't think it's a good idea for HA Core to fill the lack of features in the device API.

I would understand if this specific issue isn't the right place for this (request for) change. I'm not that familiar (yet) with the Home Assistant community, do you think it would make sense to enter this as a separate issue?

You can open feature request here https://community.home-assistant.io/c/feature-requests You can also start a discussion about light transitions in CoAP API on Shelly Support Facebook group. I'll open a feature request on GitLab Allterco server.

bieniu commented 3 years ago

Feature request opened

image

Didel commented 3 years ago

@bieniu Thank you for your reply, and for your feature request, that is greatly appreciated!

Is the page of that issue publicly available for me and others to follow? And if that feature is implemented, it still needs to be implemented separately in Home Assistant, right?

bieniu commented 3 years ago

Is the page of that issue publicly available for me and others to follow?

You need an invitation from Shelly team to access their GitLab server.

And if that feature is implemented, it still needs to be implemented separately in Home Assistant, right?

Yes

chemelli74 commented 3 years ago

@Didel, based on previous comment can you please close this issue ?

Thx,

Simone

Didel commented 3 years ago

@chemelli74 I can, but perhaps we could use this issue to keep track of the status regarding the support of transitions on the various Shelly devices? As noted above, once Shelly has updated firmware to enable this, (the Shelly integration for) Home Assistant will need to be updated as well. I would propose to close this issue once that has been resolved. Would you agree?

chemelli74 commented 3 years ago

@Didel, GitHub is for issues with current code, not for feature request or future implementation. For those there is Community forum

Issue should be closed.

Simone

Didel commented 3 years ago

Clear. I will close this issue then. @bieniu could you make sure to open a feature request to support this once there is support from the Shelly firmware? Many thanks in advance!

bieniu commented 3 years ago

Once Shelly software supports this feature, we'll add support for it to the integration.