basnijholt / adaptive-lighting

Adaptive Lighting custom component for Home Assistant
https://basnijholt.github.io/adaptive-lighting/
Apache License 2.0
1.7k stars 127 forks source link

Adaptive lighting does not adjust brightness of Lightener group correctly #978

Open Patrick1610 opened 2 months ago

Patrick1610 commented 2 months ago

Home Assistant Adaptive Lighting Issue Template

Bug Reports

If you need help with using or configuring Adaptive Lighting, please open a Q&A discussion thread here instead.

Before submitting a bug report, please follow these troubleshooting steps:

Please confirm that you have completed the following steps:

Required information for bug reports:

Please include the following information in your issue.

Issues missing this information may not be addressed.

  1. Debug logs captured while the issue occurred. See here for instructions on enabling debug logging:
  1. Your Adaptive Lighting configuration:

Just added 1 of multiple lightener groups, left the rest of the settings default


3.  (If using Zigbee2MQTT), provide your configuration files (**remove all personal information before posting**):
    - `devices.yaml`
    - `groups.yaml`
    - `configuration.yaml` ⚠️; **Warning** _**REMOVE ALL of the PERSONAL INFORMATION BELOW before posting**_ ⚠️;
      - mqtt: `server`:
      - mqtt: `user`:
      - mqtt: `password`:
      - advanced: `pan_id`:
      - advanced: `network_key`:
      - anything in `log_syslog` if you use this
    - Brand and model number of problematic light(s)


4.  Describe the bug and how to reproduce it:
There is a form of light groups from another custom integration, called Lightener. It allows you to specify different brightness percentages per light in the group. So when the group is set to 50%, one light can be 10% and another 70% for example. 

When I set this group as the destination for AL, it does not work. 

AL should set the lightener to a percentage (for example 50% and the underlying lights should be adapter by lightener. 
Instead, AL sets all underlying lights to 50% and the Lightener is not adapter to 50% at all. 

I can create screenshots or a short screen recording later if needed. 

5. Steps to reproduce the behavior:
Create a lightener
Set only lightener as light for AL
Turn on Lightener light 
daniel1v commented 2 months ago

I am experiencing the same issue. It seems like adaptive lighting expands light groups and then applies its brightness and color temperature to the single lights instead of the group itself. this is fine for standard light groups but leads to unexpected behavior in lightener groups, because of the non linear brightness mapping. As lightener inherits from light group, it is recognized as a light group.

the current behavior was a bit confusing for me, because one could add a light group but also single lights to adaptive lighting. this gives the impression, that adaptive lighting is able to control the group light itself and not only the contained single lights.

@basnijholt, can you confirm this? maybe there could be a switch to turn off group expansion?

Patrick1610 commented 2 months ago

@daniel1v, I didn't understand the problem as deep as you do, so thanks for clarifying!

It would be an amazing solution if this could be turned on/off in the configuration of each AL instance. I hope this is possible @basnijholt 🙏🏼

Patrick1610 commented 2 months ago

In addition: manual control is also looking at the individual lights. It would be nice if that keeps working as is.

basnijholt commented 2 months ago

There could be an option to turn off the expansion but this would break the manual control.

Patrick1610 commented 2 months ago

It would be great if that was possible, because the use of Lightener makes the relativity between lights possible, which makes the automatic lighting of AL near perfect!

Wouldn't it be possible to have an additional option to switch between manual control monitoring for the group or the individual lights? For example: That the lights are loaded twice into the integration and used without expansion for the control-part and used with expansion for the monitoring-part of the instance?

daniel1v commented 2 months ago

There could be an option to turn off the expansion but this would break the manual control.

yeah, it is right, that the manual control for single group members could be impacted, when the group is not expanded anymore. one could argue, that this is totally ok, when selecting this imaginary option.

To overcome the issue, I have several suggestions in my mind, but imho the best would be:

by default, AL should control the group entity itself, and not expand light groups for adaption.

for the detection of manual control, AL should watch the group entity and also all the group members:

I think this solution would have no negative side effects for the existing users and could also be the default behavior of AL but also could only be available via config option.

what do you think @basnijholt ?

Patrick1610 commented 2 months ago

@daniel1v I agree with you that it would be great to see a solution that allows us to keep using manual control. However, only having the option to disable group expansion (at first) would be most important for me, since that would allow me to use lightener and set up relative lighting scenarios.

In the case that manual control will be fixed I only disagree with the following:

as soon as manual control is detected for a group member, AL should switch to the same behavior as now: do not control the group entity, instead expand the group and exclude manually controlled single light entities

Let me elaborate. When using Lightener the following could happen. Let's say AL is at 50%, and lightener would give us the following scenario:

When I manually set Light C to 80%, and that disables manual control for all lights, the next time AL updates Light A and B will see massive changes, since they both will be changed to 50%. I think when a light is changed that is a part of a group (and that group is in AL), and the imaginary 'Group expansion' button is disabled, the group should be marked as manually controlled as a whole. Or there should be an extra option so users can choose between those two versions of manual control in combination with disabling group expansion.

daniel1v commented 2 months ago

@Patrick1610 The proposed solution was intended to be more general and, of course, the manual control detection should not trigger, when a light state is changed by the group. In fact, there may be some details, I do not know about.

To make a clear statement: I would also support a feature request to simply have an option to turn off group expansion everywhere and live with the drawbacks.

@basnijholt would it be possible to get such a feature? Should a separate feature request be opened? I would really appreciate using AL and lightener together.

Patrick1610 commented 2 months ago

@basnijhol Just wondering and trying to understand, because the tool and its capabilities are amazing! But how does AL work for you? Are all the lights in your house/room at the same level, or do you use a lot of scenes that disable AL during the day?

I can't imagine having all lights at the same level, since I have lights of different brands or dimmer with classic bulbs that are much brighter than other bulbs, but that might be very specific for me.

Wouldn't it be possible to have a feature like Lightener inside AL? Where you can specify the percentages of the lights after you have chosen the lights. So AL still calculates a percentage throughout the day, but what that percentage means per light is adjustable. Just check the lightener repo to see what I mean 😉