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

Activate manual control when lights are turned on with individual settings #89

Closed
bcutter opened this issue Feb 9, 2021 · 10 comments · May be fixed by #528
Closed

Activate manual control when lights are turned on with individual settings #89

bcutter opened this issue Feb 9, 2021 · 10 comments · May be fixed by #528
Assignees
Milestone

Comments

@bcutter
Copy link

bcutter commented Feb 9, 2021

Use-Case:
I have wall switches with two buttons. Left one toggles light and sets brightness to 100 %, right one turns on without specific settings, so:

  • left button: maximum brightness
  • right button: adaptive lighting

Issue:
After using left button, so turning on light with...

service: light.toggle
data:
  brightness_pct: 100
  transition: 1
entity_id: light.bulb

...light turns on with 100 % brightness. After 10 seconds at latest it is being set to adaptive lighting´s current settings (e. g. 28 %).

Proposal:
Set lights to manual control when they are turned on with a fixed setting (values brightness, color temperature etc.).

Or is there a workaround for my scenario? I DO NOT want to manually dim the light after turning it on. 100 % shall be accepted, please AL don´t ignore my wish.

Update: Maybe my scenario is related to #37, at least parts of it.

@igiannakas
Copy link
Contributor

Why don't you disable the adaptive lighting switch before calling the light toggle switch in your automation?

@bcutter
Copy link
Author

bcutter commented Feb 11, 2021

Why don't you disable the adaptive lighting switch before calling the light toggle switch in your automation?

I thought bout that for a short moment but how to re-enable AL again? As I use light.toggle how can I make a difference between
A) turning light on (and turn off AL before)
B) turning light off (and turn on AL after)?

And as I have all lights in one AL integration when turning the whole AL switch off it would be disabled for other lights too, so even if it would work it would create another issue.

That's what my blueprint based automation looks like for left button (the one I want maximum brightness):
image

@igiannakas
Copy link
Contributor

igiannakas commented Feb 11, 2021 via email

@bcutter
Copy link
Author

bcutter commented Feb 11, 2021

OK I think I could manage that. But what about

And as I have all lights in one AL integration when turning the whole AL switch off it would be disabled for other lights too, so even if it would work it would create another issue.

Even without that it is getting quite complicated (check if light is off, if off than turn off AL and turn on light with custom brightness setting) for just turning a light on.

Why can't AL just respect my custom light settings and set the light to manual mode?

That's what my feature request would be.

So there must be a smarter way...

@basnijholt
Copy link
Owner

Why not first calling adaptive_lighting.set_manual_control before your

service: light.toggle
data:
  brightness_pct: 100
  transition: 1
entity_id: light.bulb

call?

@bcutter
Copy link
Author

bcutter commented Feb 12, 2021

As described in #37 this is not respected as well because it will only work for lights which are in ON state.

Did not test it by myself yet, but that's what #37 is all about.

And the workaround (turn light on, set to manual mode, apply individual (full) brightness setting) may result in strange behavior (flickering light etc.).

I really think there is room for improvement in AL to make these things possible. In case there are no other smart ideas...

@bcutter
Copy link
Author

bcutter commented Feb 13, 2021

You could check the status of the light. If it’s off, turn the adaptive lighting switch off and then turn the light on. If it’s on, the other way around. You can achieve that with templating in the automation https://www.home-assistant.io/docs/configuration/templating/

On 11 Feb 2021, at 18:16, bcutter @.***> wrote:  Why don't you disable the adaptive lighting switch before calling the light toggle switch in your automation? I thought bout that for a short moment but how to re-enable AL again? As I use light.toggle how can I make a difference between A) turning light on (and turn of AL before) B) turning light off (and turn on AL after)? That's what my blueprint based automation looks like for left button (the one I want maximum brightness): — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

I am trying to use this. Unfortunately my changes are not saved in the automation. Either because the automation is based on a blueprint or I have some syntax errors.

Could someone have a look at it? That´s the automation (cleaned some irrelevant parts) - see button_one_single_press: event for the relevant part:

alias: Switch-Control_Switch Opple
description: 
use_blueprint:
  path: >-
    e-raser/deconz-aqara-opple-wireless-scene-switch-2-button-lumi-remote-b286opcn01-wxcjkg11lm.yaml
  input:
    remote: [removed]
    button_one_single_press:
      # If light is off, disable AL for light to respect manual (fix) light values, turn light on after
      {% if is_state('light.light_bulb', 'off') %}
        - service: adaptive_lighting.set_manual_control
          data:
            entity_id: switch.adaptive_lighting
            manual_control: true
            lights: light.light_bulb
        - service: light.toggle
          data:
            brightness_pct: 100
            transition: 1
          entity_id: light.light_bulb
      {% else % }
        # If light is on reenable AL for light and turn light off
        - service: light.toggle
          data:
            brightness_pct: 100
            transition: 1
          entity_id: light.light_bulb
        - service: adaptive_lighting.set_manual_control
          data:
             entity_id: switch.adaptive_lighting
            manual_control: false
            lights: light.light_bulb
      {% endif %}
    button_one_double_press: []
    button_one_hold_in:
      - service: light.turn_on
        data:
          brightness_step_pct: 25
        entity_id: light.light_bulb
    button_two_single_press:
      - type: toggle
        device_id: [removed]
        entity_id: light.light_bulb
        domain: light
    button_two_hold_in:
      - service: light.turn_on
        data:
          brightness_step_pct: -25
        entity_id: light.light_bulb
    button_one_triple_press: []
    button_two_triple_press: []

So the question is: how to run several services combined with templating in a blueprint based automation?

I´m quite sure my syntax is wrong, https://www.home-assistant.io/docs/scripts/service-calls/#use-templates-to-decide-which-service-to-call does not really help.

Update:
Found a way using the UI only. Ended using "choose" with two conditions (light = on / off) and passing the adaptive_lighting.set_manual_control as second action besides switching the light on/off. Quite complicated, a lot of code. Will test this for some time.

I still vote for adaptive lightning detecting if lights are turned on with custom settings and setting manual mode for those lights automatically (as it does when changes are detected when lights are on). That would save a lot of headache and many lines of YAML code.

@RouNNdeL
Copy link

A workaround I found to at least work is to first call light.turn_on then adaptive_lighting.set_manual_control after with a 500ms (delays of 250ms cause only one light out of 2 to work) delay, and only then can I apply the scene. But this causes the lights to briefly flash white and after some delay they're set to the desired color. I think either this request or #37 should be implemented to allow us to apply scenes without having to manually track the state of the main adaptive lighting switch.

@RubenKelevra
Copy link
Collaborator

I'm currently in the process of doing version 2. This will be added/fixed.

Keep this ticket open until you can verify that it's properly working in the upcoming version 2.

@basnijholt
Copy link
Owner

I am implementing an option adapt_only_on_bare_turn_on which instantly triggers manual_control when turning on with brightness or color in PR #709.

Enabling this will make sure AL doesn't take over when setting a scene.

@RubenKelevra RubenKelevra added this to v2 Aug 30, 2024
@RubenKelevra RubenKelevra moved this to Inbox in v2 Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Inbox
Development

Successfully merging a pull request may close this issue.

6 participants