EPMatt / awesome-ha-blueprints

A curated collection of automation blueprints for Home Assistant.
https://epmatt.github.io/awesome-ha-blueprints
GNU General Public License v3.0
811 stars 237 forks source link

Light hook - support for adaptive lighting #112

Open KrzysztofHajdamowicz opened 3 years ago

KrzysztofHajdamowicz commented 3 years ago

Thank you for taking the time to report here! :tada:

Please don't delete any part of the template, since keeping the provided structure will help maintainers to process your request more rapidly.

This template should only be used to propose a new feature or enhancement for an existing blueprint. If this is not your case, you can choose a different issue template. If you have a question instead, please open a discussion here.

*=required

Details*

Description*

I'd like to add support for turning on lights with adaptive lighting applied on turning on lights

Automation YAML config

Adaptive lighting listens for tuning on lights and applies necessary changes, but it leaves a second or two of previous light setting before fix comes in. In order to start light with appropriate settings (so, no lag or wrong light when turning on) You need to execute light.turn_on with few templatable params

    - service: light.turn_on
      target:
        entity_id: light.all_lights_in_toilet
      data:
        color_temp: >-
          {{ state_attr('switch.adaptive_lighting_toilet', 'color_temp_mired') |int }}
        brightness_pct: >-
          {{ state_attr('switch.adaptive_lighting_toilet', 'brightness_pct') |int }}

Implementation

It would be great to offer another input in hook blueprint- entity of adaptive lighting switch. If it is provided, use state_attr of that switch to set initial lighting values.

Additional Details*

Additional context

It would be great to support adaptive-lighting, because getting blasted by 01:00PM light when you go to toilet at 02:30 AM is a little unpleasant experience. Normally I should close my eyes for a second or so, until adaptive lighting changes lighting params. This can be avoided by starting lights properly on turning on.

JDFS404 commented 2 years ago

I'm trying these services out now, do you still use transition with it? Because I would like the lights to turn on slowly (i.e. 1 second just like Hue), but when I use transition: 1 in the service call, it still takes 1 second (duh) to transition to the color. Perhaps I should use initial_transition or love transition out at all?

Edit: for Hue lights, it's better to use xy_color. Since replacing color_temp with xy_color, lights transition almost immediately to the correct brightness and color.