Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dim lights before switching them off #10

Closed
chbndrhnns opened this issue Jan 15, 2020 · 29 comments
Closed

Dim lights before switching them off #10

chbndrhnns opened this issue Jan 15, 2020 · 29 comments
Assignees
Labels
enhancement New feature or request

Comments

@chbndrhnns
Copy link
Contributor

Would it be possible to dim lights to some level for some time before switching them off?

@benleb
Copy link
Owner

benleb commented Jan 15, 2020

as some kind of "warning" to move or the lights will switch off? That could indeed be useful!

@benleb benleb self-assigned this Jan 15, 2020
@benleb benleb added the enhancement New feature or request label Jan 15, 2020
@chbndrhnns
Copy link
Contributor Author

chbndrhnns commented Jan 15, 2020

I like how it is implemented for Deconz. Sadly, this cannot be re-used in home assistant yet.

@benleb
Copy link
Owner

benleb commented Jan 16, 2020

To be honest, something like this looks not really useful to me. It looks nice, but I am not sure if it has real value.
If no one moves, the lights could be switched of or?! Whats the use case for dimming the lights over 10 or 20min in steps if you are not there anymore?

@chbndrhnns
Copy link
Contributor Author

My intention was to point out where I got the idea from, not to ask for that specific implementation.
As a warning, I find it really helpful to not be in darkness immediately.

@benleb
Copy link
Owner

benleb commented Feb 3, 2020

So lets think about how this could be implemented (one dimming stage before switching off for now, thats easier to talk about for now)...
An absolute time before switching off or after switching on? Or a relative one maybe? And the same for the dimming, decrease the brightness by an absolute or relative value? and what about scene? just touch the brightness value if the configured setting is a scene?

Currently an absolut time value (in seconds probably) which dimms to 80% (or 50%?) before switching off seems reasonable to me. What would you (and maybe others reading this :)) prefer?

Sure, it would be possible to implement every possible way listed above, but that would add really much complexity.

@chbndrhnns
Copy link
Contributor Author

Yeah, let's start with what's most simple. For the use case of "I'll warn you that I am being turned off soon", I would like to see

  • an absolute value for time
  • a relative value for brightness
  • not sure I understand your intentions about the scene thing.

Also, if new motion is detected, the dim stage should be aborted.

@atterdal
Copy link

atterdal commented Feb 7, 2020

Was going to issues to ask if this was possible. This would be an amazing for bathrooms.

@efurban
Copy link

efurban commented Mar 12, 2020

It'll be nice to have a "Fade Rate" feature, or Fade On, Fade Off separately. (In Insteon, it's called Ramp Rate).
The issue is that not all protocols/platforms provide this feature (Lutron Caseta does not) so it'll be nice to have it here instead.
E.g:

  fade_rate: 5 
  daytimes:
    - { starttime: "02:00", name: late_night, light: 50 }
    - { starttime: "08:30", name: day, light: 100 }

@kroimon
Copy link

kroimon commented Mar 12, 2020

Would it be possible to mimic the deconz feature by defining a list of delay/value pairs for the daytimes/light parameter?
So something like this:

daytimes:
  - starttime: "02:00"
    name: late_night
    light:
      - 100
      - delay: 60
        value: "FadeOutScene"
      - delay: 120
        value: 0
  - { starttime: "08:30", name: day, light: 100 }

This would give you the flexibility of deconz, but keeps the simple configuration style if you just want to have a two-step fade-out.

@thundergreen
Copy link
Contributor

I was also thinking about this feature and find it really helpful as my lights turn off completely but sometimes it's just nice having a dimmed mode.... maybe with timer before turning off completely or the possibility to deactivate turn off and let it dimmed?

@adec
Copy link

adec commented Aug 12, 2020

Just looking into this, I like the idea of being able to specify scenes for the intermediate state as it gives the flexibility of perhaps turning a light a different colour rather than dimming it.

@X1pheR
Copy link

X1pheR commented Oct 28, 2020

Any chance this will get implemented (since request was from januari)? I still have a lot of lights with all motion sensors on Hue because of this missing feature in Home Assistant. Hue natively dims the lights for 10 seconds or so before turning off the lights when triggered by motion. I love it because it indeed acts as a warning that the lights go off triggering you to move :)

@kroimon
Copy link

kroimon commented Oct 28, 2020

With the new restart mode in HA, I created the following automation directly in HA to turn on the kitchen lights when motion is detected and when the motion sensor turns back to idle while the lights are still on, it will first dim the lights, then turn them off after one minute.
If motion is detected during the dim period, the automation will simply restart, turning the lights back on.

- alias: Kitchen: Motion detected
  mode: restart
  trigger:
  - type: motion
    platform: device
    domain: binary_sensor
    device_id: 56754e39c3874eb39d7181dfd3d682ae
    entity_id: binary_sensor.motionsensor_kitchen
  condition:
  - condition: numeric_state
    entity_id: sun.sun
    value_template: '{{ state.attributes.elevation }}'
    below: '8.5'
  action:
  - service: light.turn_on
    entity_id: light.group_kitchen
    data:
      brightness_pct: 100
      transition: 2
  - wait_template: '{{ is_state(trigger.entity_id, ''off'') }}'
  - condition: device
    domain: light
    device_id: ae538670194e4fd18ce4c721eb0faa9f
    entity_id: light.group_kitchen
    type: is_on
  - service: light.turn_on
    entity_id: light.group_kitchen
    data:
      brightness_pct: 50
      transition: 2
  - delay: 00:01:00
  - service: light.turn_off
    entity_id: light.group_kitchen
    data:
      transition: 2

@benleb
Copy link
Owner

benleb commented Oct 28, 2020

Any chance this will get implemented (since request was from januari)? I still have a lot of lights with all motion sensors on Hue because of this missing feature in Home Assistant. Hue natively dims the lights for 10 seconds or so before turning off the lights when triggered by motion. I love it because it indeed acts as a warning that the lights go off triggering you to move :)

sorry, I am in the last weeks of my thesis currently and have no real time for open source projects :/
but!
taking care of this and all other issues is planned to start at the end of November :) 🎉

@X1pheR
Copy link

X1pheR commented Oct 28, 2020

With the new restart mode in HA, I created the following automation directly in HA to turn on the kitchen lights when motion is detected and when the motion sensor turns back to idle while the lights are still on, it will first dim the lights, then turn them off after one minute.
If motion is detected during the dim period, the automation will simply restart, turning the lights back on.

- alias: Kitchen: Motion detected
  mode: restart
  trigger:
  - type: motion
    platform: device
    domain: binary_sensor
    device_id: 56754e39c3874eb39d7181dfd3d682ae
    entity_id: binary_sensor.motionsensor_kitchen
  condition:
  - condition: numeric_state
    entity_id: sun.sun
    value_template: '{{ state.attributes.elevation }}'
    below: '8.5'
  action:
  - service: light.turn_on
    entity_id: light.group_kitchen
    data:
      brightness_pct: 100
      transition: 2
  - wait_template: '{{ is_state(trigger.entity_id, ''off'') }}'
  - condition: device
    domain: light
    device_id: ae538670194e4fd18ce4c721eb0faa9f
    entity_id: light.group_kitchen
    type: is_on
  - service: light.turn_on
    entity_id: light.group_kitchen
    data:
      brightness_pct: 50
      transition: 2
  - delay: 00:01:00
  - service: light.turn_off
    entity_id: light.group_kitchen
    data:
      transition: 2

Nice! Thanks for sharing. I'm still a newbie so will try and work this out for my setup. Your motion sensor does not have a light sensor since you are using the sun elevation? How do I know which device id I have?

Do you also by any chance have something like this for hue dimmer switches? I have some directly on deconz now but you loose the functionality to tap the on button multiple times to change between different scenes/light settings.

@X1pheR
Copy link

X1pheR commented Oct 28, 2020

Any chance this will get implemented (since request was from januari)? I still have a lot of lights with all motion sensors on Hue because of this missing feature in Home Assistant. Hue natively dims the lights for 10 seconds or so before turning off the lights when triggered by motion. I love it because it indeed acts as a warning that the lights go off triggering you to move :)

sorry, I am in the last weeks of my thesis currently and have no real time for open source projects :/
but!
taking care of this and all other issues is planned to start at the end of November :) 🎉

Totally understandable. Thank you for your quick response and good luck with your thesis ;)

@paviro
Copy link
Contributor

paviro commented Nov 16, 2020

I would also love to see this! Very much like the original Hue bridge does it. Dimm it down over 5-10 seconds or so to give you the chance to move enough.

Hope your thesis is going alright!

@benleb
Copy link
Owner

benleb commented Nov 23, 2020

4ed699a

it works but probably has some bugs... do not use it if you need reliable lights ;)

@thundergreen
Copy link
Contributor

thundergreen commented Nov 23, 2020

Will try and report :)
any special config needed?

@paviro
Copy link
Contributor

paviro commented Nov 23, 2020

Will test when I am back at home from work on Thursday :)

@thundergreen
Copy link
Contributor

thundergreen commented Nov 23, 2020 via email

@benleb
Copy link
Owner

benleb commented Nov 23, 2020

ah sorry 😅 but expect it to slightly change until officially released and documented ;)

transition style

starts seconds_before seconds before the light will turn off to smoothly turn down the lights until off. uses the transition parameter in home assistant

diningroom:
  module: automoli
  class: AutoMoLi
  disable_switch_entities: [input_boolean.automoli]
  disable_hue_groups: true
  room: esszimmer
  delay: 300
  dim:
    method: transition
    seconds_before: 10

step style

dims the lights by brightness_step_pct, seconds_before seconds before the light will turn off. uses the brightness_step_pct parameter in home assistant

bedroom:
  module: automoli
  class: AutoMoLi
  disable_switch_entities: [input_boolean.automoli]
  disable_hue_groups: true
  room: schlafzimmer
  delay: 180
  dim:
    method: step
    brightness_step_pct: -30
    seconds_before: 20

@paviro
Copy link
Contributor

paviro commented Dec 10, 2020

Installed it :) Is it correct that the dimming parameters are not shown yet in the summary log of ad yet?
Also dimming down works perfectly but it does not seem to get cancelled when motion is detected during dimming?

dim:
    method: transition
    seconds_before: 10

@paviro
Copy link
Contributor

paviro commented Dec 15, 2020

The last commits seem to have fixed the canceling but it only worked until I updated to Home Assistant 2020.12.0 now the lights show as turned on in home assistant but in reality they dim down and won't turn back on ever as home assistant sees them as on. Not sure if this is a HA bug or an issue here.

@benleb
Copy link
Owner

benleb commented Dec 18, 2020

Installed it :) Is it correct that the dimming parameters are not shown yet in the summary log of ad yet?

ah yes, thanks, fixed in c4add6c

The last commits seem to have fixed the canceling but it only worked until I updated to Home Assistant 2020.12.0 now the lights show as turned on in home assistant but in reality they dim down and won't turn back on ever as home assistant sees them as on. Not sure if this is a HA bug or an issue here.

Hm sounds as you have a problem with your lights? I don't think thats an automoli issue as automoli relies on the state-informations from home assistant and cannot work as it should when this info is wrong.

@chbndrhnns
Copy link
Contributor Author

I also have the impression that starting with Homeassistent 2020.12.0, something is off with automoli, as well. The humidity-controlled bathroom light is no longer respecting the humidity sensor value and just turns off. Any idea how to debug that? @benleb

@paviro
Copy link
Contributor

paviro commented Dec 18, 2020

I don’t think it’s the lights as they were fine before the Home assistant update. But again I also don’t really can image it being automoli. Seems more like a home assistant bug.

@benleb
Copy link
Owner

benleb commented Dec 18, 2020

Ok so we have problems since 2020.12...

  • Humidity Sensor is ignored
  • Lights show as on but they aren’t (see below)

Anything else? If you have other info which could be useable, tell me ;) I will try to reproduce this and find the bug over the weekend ✌️

As automoli does not change the state directly, just via the home assistant services, I expect that if lights have a wrong state in home assistant, it must be something else... But will investigate this too!

@benleb
Copy link
Owner

benleb commented Dec 18, 2020

lets move to the new issue here to keep things separate.

As the feature requested here is implemented, I will close here and release this weekend :)

@benleb benleb closed this as completed Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

9 participants