entity-controller icon indicating copy to clipboard operation
entity-controller copied to clipboard

Pre-dim

Open haavardNO opened this issue 5 years ago • 10 comments

Using the entity-controller and it works close to perfectly. One thing I am missing is a pre-dim function. That would dim down the lights to a certain level x amounts of minutes before shut off.

Possible to add in a future version?

thanks.

haavardNO avatar Oct 21 '20 12:10 haavardNO

I'd like such a feature too, to warn when the lights are about to shut off. One work-around I use is to turn off the light with a long (30 seconds or more) transition as shown in the Customize Service Calls docs, under service_data_off.

chishm avatar Oct 25 '20 11:10 chishm

Would you be able to take a look at this? Happy to review a PR and discuss a solution.

danobot avatar Nov 16 '20 11:11 danobot

I'd be happy to. My current plan is to add an extra state to the state machine for warning dim, with a timeout transition to off that is set via configuration.

chishm avatar Nov 20 '20 00:11 chishm

Changing the state machine is almost never the solution - remember this is not a lighting a controller and we can not change the existing behaviour. For example, I am using it to control a fan in the bathroom. A change to the state machine would impact all users, just to satisfy one niche requirement.

It started off as a lighting controller but I am not looking to make it more specific to that use case.

What we could do instead is implement a way to have EC call special scripts before changing states. That way you can have a script to dim the lights and wait and once the script is finished, EC proceeds with the state change.

danobot avatar Nov 20 '20 00:11 danobot

Ok, given those requirements, my new plan is to enhance trigger_on_activate and trigger_on_deactivate. Is there any reason that extra parameters (like the triggering entity and controlled entities) can't be passed in the turn_on call, for use by scripts? The docs mention that they aren't, but I'm not sure why not.

chishm avatar Nov 20 '20 01:11 chishm

no reason, other than time :)

danobot avatar Nov 20 '20 02:11 danobot

I've managed to solve my problem using automations and blueprints, so I won't be working on this issue any more.

Sorry about the long time between updates.

chishm avatar Mar 13 '21 04:03 chishm

I've managed to solve my problem using automations and blueprints, so I won't be working on this issue any more.

Sorry about the long time between updates.

@chishm are you able to share some the details of your approach with automations and blueprints?

AustinBrunkhorst avatar Nov 17 '22 20:11 AustinBrunkhorst

Can do. I've attached the sensor_light.yaml blueprint I use. It's a bit complicated because I also use Adaptive Lighting, and wanted the lights to come on at the right brightness and white temperature. And I also use custom deCONZ handling for the wall buttons I've got.

The main idea behind the blueprint is to always turn on the light at full brightness (as determined by Adaptive Lighting) when motion is detected, wait for X seconds of no motion before turning them to half brightness, wait Y seconds then turn them off. If at any point the lights are turned on by something other than the automation (as detected by a turn_on or deconz service call with a different context ID), then the automation will stop running so that it doesn't subsequently turn the lights off.

chishm avatar Nov 28 '22 23:11 chishm

I'd love this feature as well -> but I figured I could probably get it working via a script. This is how the native Hue dimmers work is that they dim to 50% after 50% of the dimming time and then they turn off...

Additionally I want to trigger how the turn on/off works if my tv is turned on. If I make progress on this I'll post my solution here ...

jeeftor avatar Apr 20 '23 18:04 jeeftor