basnijholt / adaptive-lighting

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

Inaccurate light transitions while `interval` is significantly smaller. #400

Closed ghost closed 1 year ago

ghost commented 1 year ago

I am wondering what I am doing wrong in the following scenario:

sleep_transition: 3600
min_brightness: 50
sleep_brightness:1
transition: 45
interval: 90

My intention is to enable sleep_mode at a certain time (with an automation) and gradually decrease the brightness from min_brightness value to sleep_brightness value during a period of one hour. Instead with the above configuration the brightness is decreasing from min_brightness value to sleep_brightness value way faster like it is based on the values of transition and interval

My deployment is the container flavor of Home Assistant on version 2022.11.5

Any ideas?

konpyl commented 1 year ago

Same issue

ghost commented 1 year ago

Today, I've tried to provide a higher value for sleep transition in the case that it requires milliseconds instead of seconds and I got the following error when I turn sleep mode to on.

Logger: homeassistant.core
Source: components/hue/bridge.py:132
First occurred: 12:50:07 PM (1 occurrences)
Last logged: 12:50:07 PM

Error executing service: <ServiceCall light.turn_on (c:adapt_lgt:b'd$*;':sleep:b'2m'): entity_id=['light.floor_lamp'], params=transition=6553.0, brightness=26, color_temp=454, color_temp_kelvin=2202>
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/homeassistant/components/hue/bridge.py", line 123, in async_request_call
    return await task(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/aiohue/v2/controllers/lights.py", line 103, in set_state
    await self.update(id, update_obj)
  File "/usr/lib/python3.10/site-packages/aiohue/v2/controllers/base.py", line 159, in update
    await self._bridge.request("put", endpoint, json=data)
  File "/usr/lib/python3.10/site-packages/aiohue/v2/__init__.py", line 179, in request
    raise_from_error(result["errors"][0])
  File "/usr/lib/python3.10/site-packages/aiohue/errors.py", line 42, in raise_from_error
    raise cls(error["description"])
aiohue.errors.AiohueException: invalid attribute value (.dynamics.duration)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/homeassistant/core.py", line 1763, in catch_exceptions
    await coro_or_task
  File "/usr/lib/python3.10/site-packages/homeassistant/core.py", line 1782, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/service.py", line 678, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 943, in async_request_call
    await coro
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/service.py", line 715, in _handle_entity_call
    await result
  File "/usr/lib/python3.10/site-packages/homeassistant/components/light/__init__.py", line 570, in async_handle_light_on_service
    await light.async_turn_on(**filter_turn_on_params(light, params))
  File "/usr/lib/python3.10/site-packages/homeassistant/components/hue/v2/light.py", line 211, in async_turn_on
    await self.bridge.async_request_call(
  File "/usr/lib/python3.10/site-packages/homeassistant/components/hue/bridge.py", line 132, in async_request_call
    raise HomeAssistantError(msg) from err
homeassistant.exceptions.HomeAssistantError: Request failed: invalid attribute value (.dynamics.duration)
ontje-dev commented 1 year ago

what bulbs do you use? i had the same problem, unfortunately the transition property only works with bulbs which have this feature enabled (like hue). i tinkered a workaround with a fading python script within an automation, which dims the lights from the current value to the sleep-brightness and then switch the sleep_mode on:

alias: activate sleep lights
description: ""
trigger:
  - platform: time
    at: "22:00:00"
  - platform: homeassistant
    event: start
condition:
  - condition: state
    entity_id: switch.adaptive_lighting_sleep_mode_home
    state: "off"
  - condition: time
    after: "21:59:59"
    before: "05:59:59"
action:
  - service: adaptive_lighting.set_manual_control
    data:
      entity_id: switch.adaptive_lighting_home
      manual_control: true
  - service: python_script.lightfader
    data:
      entity_id: light.home
      transition: 30
      brightness: 1
  - delay: 35
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.adaptive_lighting_sleep_mode_home
  - service: adaptive_lighting.set_manual_control
    data:
      entity_id: switch.adaptive_lighting_home
      manual_control: false
mode: single
pqhf5kd commented 1 year ago

I'm also getting this behaviour

pqhf5kd commented 1 year ago

Is there anyway I can help diagnose this? I'd love to use AL as to run my bedtime sunset/sunrise wake up alarm with a 10 or 15 minute transition.

ghost commented 1 year ago

@ontje-dev I have philips hue bulbs

pqhf5kd commented 1 year ago

I'm using a Hue Play Bar Normal transitions (called with light.turn_on) work fine

th3w1zard1 commented 1 year ago

I'm pretty sure the max transition for any light is 300 seconds. This is a Home Assistant or a device limitation. Go to your developer tools and try a light.turn_on to confirm.

A possible solution would be to setup an automation that listens for sleep_mode switch turn ons. Said automation could call light.turn_on with transitions of 300 at a time, and when the automation finishes it simply reenabled adaptive-lighting.

th3w1zard1 commented 1 year ago

turns out I already have the code written in one of my scripts. Hope it helps someone.

  - repeat:
      while:
        - condition: numeric_state
          entity_id: input_number.wakeup_transition_time_remaining
          above: "300"
      sequence:
        - service: light.turn_on
          target:
            entity_id: "{{ transition_lights }}"
          data:
            transition: 300
            kelvin: >
              {{ (2500 /
              (states("input_number.wakeup_transition_time_remaining")|int /
              300))|round(0, "ceil") + 2000 }}
            brightness: >-
              {{ (250 /
              (states("input_number.wakeup_transition_time_remaining")|int /
              300))|round(0, "ceil") + 5 }}
        - service: input_number.set_value
          target:
            entity_id: input_number.wakeup_transition_time_remaining
          data:
            value: >-
              {{ states("input_number.wakeup_transition_time_remaining")|int -
              300 }}
        - delay:
            hours: 0
            minutes: 5
            seconds: 0
            milliseconds: 0
pqhf5kd commented 1 year ago

I'm doing 600 second transitions with my Hue light.

I just tried 300 seconds as the Sleep Transition but it still finished much faster, maybe around 60?

th3w1zard1 commented 1 year ago

I just tried those settings and they work fine? If you're testing this by turning on and off the adaptive-lighting switch it'll use the initial transition value.

pqhf5kd commented 1 year ago

I'm turning on and off the adaptive_lighting_sleep_mode switch

th3w1zard1 commented 1 year ago

can you post your config so i can test on my end?

pqhf5kd commented 1 year ago

My Adaptive Lighting config? I'm using the GUI. I can't see a way to export it

th3w1zard1 commented 1 year ago

I tried your exact settings, then toggled the sleep_switch toggle back and forth and it seems to apply the sleep_transition of 299 correctly. It's moving about 1% every 3 seconds. The only setting I couldn't tick was rgb_color as my light doesn't support that.

There's three possible reasons here:

  1. we're using different adaptive-lighting versions, I'm using my own test build and you didn't post the version you're using.
  2. your lightbulb doesn't support longer transitions
  3. rgb_color is somehow broken and is influencing what should be this very unrelated problem somehow.
th3w1zard1 commented 1 year ago

Can you turn the main adaptive-lighting switch off, turn your light's brightness to 85% or something high enough where you can measure the diff, and try executing light.turn_on in the developer settings with the following:

service: light.turn_on
data:
  transition: 300
  brightness_pct: 3

If you get the same issue then your lightbulb doesn't support longer transitions.

If that's the case, just find the highest transition your bulb can handle and run my code above in a script to manually handle transitions over 300 seconds.

pqhf5kd commented 1 year ago

It's moving about 1% every 3 seconds.

How do you measure this? As far as I can see, the lamp reports the target brightness as soon as the service is called and before the transition has finished.

we're using different adaptive-lighting versions, I'm using my own test build and you didn't post the version you're using.

Where does AL show the current version? I can't find it in the config or in HACS.

Did you try using the GUI or YAML? I've just tried using YAML instead and I'm getting much slower transitions, but still not as slow as I expect.

Running the light.turn_on service manually is working correctly with 600 second transitions.

Thank you

pqhf5kd commented 1 year ago

Using YAML with sleep_transition: 600, I would say I'm getting around a 150 second transition.

th3w1zard1 commented 1 year ago

I measured by eyeballing it and counting the seconds between each percent change. With a 300 second sleep transition from 100% to 1% is about 3 seconds per integer percent change. If you click your light in hass Lovelace it'll update in real time on desktop. Otherwise you can view it in the recorder (logbook) for more detailed information if you have that setup

HACS should tell you your current version somewhere in the GUI

I didn't use YAML or the config flow, I modified the switch during runtime using adaptive_lighting.change_switch_settings from my own development build on my fork. My hass takes ages to restart to change settings any other way. I doubt it's the cause of the problem though.

pqhf5kd commented 1 year ago

I did another test with two identical Tradfri bulbs. The first is in one AL group with a sleep transition of 300.

I triggered a script that turns on Sleep Mode for the AL group and triggers a light.turn_on with a transition of 300 to the other bulb.

The bulb in the AL group finished its transition much quicker.

There's certainly an issue somewhere

pqhf5kd commented 1 year ago

I repeated the test with color_temp: 2200 instead of RGB and I got the same result

th3w1zard1 commented 1 year ago

Can you figure out what version you're using, I can try testing your exact build when I get home.

pqhf5kd commented 1 year ago

1.4.1 , I found it in the manifest.json file in the custom_components folder

th3w1zard1 commented 1 year ago

Could not reproduce on 1.4.1. I'm also using the tradfri bulbs btw, they're great!

Is it possible that something else is modifying your lights? Otherwise, I've found varying inconsistencies in those lights when I had improper configurations in zigbee2mqtt. for example, I have a light group light.den_ceilingfan_lights that have 4 lightbulbs in the group, when I had optimistic=False set the bulbs would occasionally go out of sync

th3w1zard1 commented 1 year ago

I'd need to see your zigbee2mqtt configuration.yaml to debug further. (and your devices.yaml and groups.yaml if you're using that)

th3w1zard1 commented 1 year ago

you should also set adaptive-lighting's logging to debug and post the output during a sleep transition.

pqhf5kd commented 1 year ago
2023-03-20 17:39:30.775 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting Sleep Mode: Adaptive Lighting: Turning on
2023-03-20 17:39:30.780 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: _sleep_mode_switch_state_event, event: '<Event state_changed[L]: entity_id=switch.adaptive_lighting_sleep_mode_al_hue, old_state=<state switch.adaptive_lighting_sleep_mode_al_hue=off; icon=mdi:theme-light-dark, friendly_name=Adaptive Lighting Sleep Mode: AL Hue @ 2023-03-20T17:37:07.226395+01:00>, new_state=<state switch.adaptive_lighting_sleep_mode_al_hue=on; icon=mdi:theme-light-dark, friendly_name=Adaptive Lighting Sleep Mode: AL Hue @ 2023-03-20T17:39:30.779330+01:00>>'
2023-03-20 17:39:30.781 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'HJrV':sleep:b'2m''
2023-03-20 17:39:30.783 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=True, context.id=adapt_lgt:b'HJrV':sleep:b'2m')' called
2023-03-20 17:39:30.784 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-20 17:39:30.784 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'HJrV':sleep:b'2m''
2023-03-20 17:39:30.790 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'HJrV':sleep:b'2m''
2023-03-20 17:39:30.959 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.desk_lamp_huelight' 'state_changed' event: '{'min_color_temp_kelvin': 2000, 'max_color_temp_kelvin': 6535, 'min_mireds': 153, 'max_mireds': 500, 'effect_list': ['colorloop'], 'supported_color_modes': [<ColorMode.COLOR_TEMP: 'color_temp'>, <ColorMode.XY: 'xy'>], 'color_mode': <ColorMode.XY: 'xy'>, 'brightness': 3, 'hs_color': (13.882, 100.0), 'rgb_color': (255, 59, 0), 'xy_color': (0.682, 0.315), 'off_with_transition': False, 'off_brightness': None, 'icon': 'hue:play-bar', 'friendly_name': 'Desk Lamp', 'supported_features': <LightEntityFeature.TRANSITION|FLASH|EFFECT: 44>}' with context.id='adapt_lgt:b'HJrV':sleep:b'2m''
th3w1zard1 commented 1 year ago
2023-03-20 17:39:30.784 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'HJrV':sleep:b'2m''

I just went into the source and confirmed this debug message contains exactly what's being sent to light.turn_on. Are you still getting inconsistencies with the transition?

I have a theory. Can you post your full logs? It's possible that by calling light.turn_on with the same data during a transition, the transition's are sped up. For example if you have the interval set to 5, adaptive-lighting may send a light.turn_on call with the same data every 5 seconds.

If my theory above is correct, you should be able to get more accurate transition speeds doing the following: If you're using detect_non_ha_changes: true

If you're NOT using detect_non_ha_changes

pqhf5kd commented 1 year ago
2023-03-21 18:03:26.461 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration adaptive_lighting which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-03-21 18:03:26.461 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-03-21 18:03:31.884 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting up with '['light.desk_lamp_huelight']', config_entry.data: '{'name': 'Adaptive Lighting'}', config_entry.options: '{'lights': ['light.desk_lamp_huelight'], 'prefer_rgb_color': False, 'initial_transition': 1.0, 'sleep_transition': 299.0, 'transition': 30.0, 'interval': 29, 'min_brightness': 60, 'max_brightness': 85, 'min_color_temp': 2200, 'max_color_temp': 4000, 'sleep_brightness': 1, 'sleep_rgb_or_color_temp': 'rgb_color', 'sleep_color_temp': 2200, 'sleep_rgb_color': [255, 56, 0], 'sunrise_time': 'None', 'max_sunrise_time': 'None', 'sunrise_offset': 0, 'sunset_time': 'None', 'min_sunset_time': 'None', 'sunset_offset': 0, 'only_once': False, 'take_over_control': True, 'detect_non_ha_changes': False, 'separate_turn_on_commands': False, 'send_split_delay': 0, 'adapt_delay': 0}', converted to '{'lights': ['light.desk_lamp_huelight'], 'prefer_rgb_color': False, 'initial_transition': 1.0, 'sleep_transition': 299.0, 'transition': 30.0, 'interval': datetime.timedelta(seconds=29), 'min_brightness': 60, 'max_brightness': 85, 'min_color_temp': 2200, 'max_color_temp': 4000, 'sleep_brightness': 1, 'sleep_rgb_or_color_temp': 'rgb_color', 'sleep_color_temp': 2200, 'sleep_rgb_color': [255, 56, 0], 'sunrise_time': None, 'max_sunrise_time': None, 'sunrise_offset': datetime.timedelta(0), 'sunset_time': None, 'min_sunset_time': None, 'sunset_offset': datetime.timedelta(0), 'only_once': False, 'take_over_control': True, 'detect_non_ha_changes': False, 'separate_turn_on_commands': False, 'send_split_delay': 0, 'adapt_delay': 0, 'name': 'Adaptive Lighting'}'.
2023-03-21 18:03:32.285 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Called 'async_turn_on', current state is 'None'
2023-03-21 18:03:32.285 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Called '_setup_listeners'
2023-03-21 18:03:32.285 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Cancelled '_setup_listeners'
2023-03-21 18:03:32.286 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'T1?o':turn_on:b'''
2023-03-21 18:03:32.287 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 1.0, force=True, context.id=adapt_lgt:b'T1?o':turn_on:b'')' called
2023-03-21 18:03:32.287 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting Sleep Mode: Adaptive Lighting: last state is <state switch.adaptive_lighting_sleep_mode_al_hue=off; icon=mdi:theme-light-dark, friendly_name=Adaptive Lighting Sleep Mode: AL Hue @ 2023-03-20T17:44:32.990423+01:00>
2023-03-21 18:03:32.287 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting Sleep Mode: Adaptive Lighting: Turning off
2023-03-21 18:03:32.287 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting Adapt Color: Adaptive Lighting: last state is <state switch.adaptive_lighting_adapt_color_al_hue=on; icon=mdi:theme-light-dark, friendly_name=Adaptive Lighting Adapt Color: AL Hue @ 2023-03-20T17:36:54.124899+01:00>
2023-03-21 18:03:32.287 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting Adapt Color: Adaptive Lighting: Turning on
2023-03-21 18:03:32.288 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting Adapt Brightness: Adaptive Lighting: last state is <state switch.adaptive_lighting_adapt_brightness_al_hue=on; icon=mdi:theme-light-dark, friendly_name=Adaptive Lighting Adapt Brightness: AL Hue @ 2023-03-20T17:36:54.125324+01:00>
2023-03-21 18:03:32.288 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting Adapt Brightness: Adaptive Lighting: Turning on
2023-03-21 18:03:37.289 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.stefanikova_pm2_5 (<class 'homeassistant.components.template.sensor.SensorTemplate'>) is using native unit of measurement 'μg/m³' which is not a valid unit for the device class ('pm25') it is using; expected one of ['µg/m³']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+template%22
2023-03-21 18:03:37.295 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.stefanikova_pm10 (<class 'homeassistant.components.template.sensor.SensorTemplate'>) is using native unit of measurement 'μg/m³' which is not a valid unit for the device class ('pm10') it is using; expected one of ['µg/m³']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+template%22
2023-03-21 18:03:37.297 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.stefanikova_aqi (<class 'homeassistant.components.template.sensor.SensorTemplate'>) is using native unit of measurement 'AQI' which is not a valid unit for the device class ('aqi') it is using; expected one of ['no unit of measurement']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+template%22
2023-03-21 18:03:37.307 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Called '_setup_listeners'
2023-03-21 18:04:06.308 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'T1?o':interval:b'0R''
2023-03-21 18:04:06.309 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 30.0, force=False, context.id=adapt_lgt:b'T1?o':interval:b'0R')' called
2023-03-21 18:04:06.310 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting color_temp of light light.desk_lamp_huelight
2023-03-21 18:04:06.310 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 30.0, 'brightness': 211, 'color_temp_kelvin': 2200} with context.id='adapt_lgt:b'T1?o':interval:b'0R''
2023-03-21 18:04:06.313 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'T1?o':interval:b'0R''
2023-03-21 18:04:35.308 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'T1?o':interval:b'0s''
2023-03-21 18:04:35.310 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 30.0, force=False, context.id=adapt_lgt:b'T1?o':interval:b'0s')' called
2023-03-21 18:04:35.312 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting color_temp of light light.desk_lamp_huelight
2023-03-21 18:04:35.312 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 30.0, 'brightness': 211, 'color_temp_kelvin': 2200} with context.id='adapt_lgt:b'T1?o':interval:b'0s''
2023-03-21 18:04:35.317 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'T1?o':interval:b'0s''
2023-03-21 18:05:04.309 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'T1?o':interval:b'0{''
2023-03-21 18:05:04.311 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 30.0, force=False, context.id=adapt_lgt:b'T1?o':interval:b'0{')' called
2023-03-21 18:05:04.313 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting color_temp of light light.desk_lamp_huelight
2023-03-21 18:05:04.313 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 30.0, 'brightness': 211, 'color_temp_kelvin': 2200} with context.id='adapt_lgt:b'T1?o':interval:b'0{''
2023-03-21 18:05:04.318 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'T1?o':interval:b'0{''
2023-03-21 18:05:10.325 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.waqi_stefanikova_kosice_slovakia (None) cannot be converted to the unit of previously compiled statistics (AQI). Generation of long term statistics will be suppressed unless the unit changes back to AQI or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this
2023-03-21 18:05:10.328 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.waqi_amurska_kosice_slovakia (None) cannot be converted to the unit of previously compiled statistics (AQI). Generation of long term statistics will be suppressed unless the unit changes back to AQI or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this
2023-03-21 18:05:10.329 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.waqi_dumbierska_kosice_slovakia (None) cannot be converted to the unit of previously compiled statistics (AQI). Generation of long term statistics will be suppressed unless the unit changes back to AQI or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this
2023-03-21 18:05:33.311 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'T1?o':interval:b'1O''
2023-03-21 18:05:33.313 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 30.0, force=False, context.id=adapt_lgt:b'T1?o':interval:b'1O')' called
2023-03-21 18:05:33.314 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting color_temp of light light.desk_lamp_huelight
2023-03-21 18:05:33.314 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 30.0, 'brightness': 211, 'color_temp_kelvin': 2200} with context.id='adapt_lgt:b'T1?o':interval:b'1O''
2023-03-21 18:05:33.315 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'T1?o':interval:b'1O''
2023-03-21 18:06:02.312 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'T1?o':interval:b'1p''
2023-03-21 18:06:02.314 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 30.0, force=False, context.id=adapt_lgt:b'T1?o':interval:b'1p')' called
2023-03-21 18:06:02.315 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting color_temp of light light.desk_lamp_huelight
2023-03-21 18:06:02.316 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 30.0, 'brightness': 210, 'color_temp_kelvin': 2200} with context.id='adapt_lgt:b'T1?o':interval:b'1p''
2023-03-21 18:06:02.322 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'T1?o':interval:b'1p''
2023-03-21 18:06:02.491 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.desk_lamp_huelight' 'state_changed' event: '{'min_color_temp_kelvin': 2000, 'max_color_temp_kelvin': 6535, 'min_mireds': 153, 'max_mireds': 500, 'effect_list': ['colorloop'], 'supported_color_modes': [<ColorMode.COLOR_TEMP: 'color_temp'>, <ColorMode.XY: 'xy'>], 'color_mode': <ColorMode.COLOR_TEMP: 'color_temp'>, 'brightness': 210, 'color_temp_kelvin': 2202, 'color_temp': 454, 'hs_color': (29.79, 84.553), 'rgb_color': (255, 146, 39), 'xy_color': (0.579, 0.388), 'off_with_transition': False, 'off_brightness': None, 'icon': 'hue:play-bar', 'friendly_name': 'Desk Lamp', 'supported_features': <LightEntityFeature.TRANSITION|FLASH|EFFECT: 44>}' with context.id='adapt_lgt:b'T1?o':interval:b'1p''
2023-03-21 18:06:15.547 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting Sleep Mode: Adaptive Lighting: Turning on
2023-03-21 18:06:15.551 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: _sleep_mode_switch_state_event, event: '<Event state_changed[L]: entity_id=switch.adaptive_lighting_sleep_mode_al_hue, old_state=<state switch.adaptive_lighting_sleep_mode_al_hue=off; icon=mdi:theme-light-dark, friendly_name=Adaptive Lighting Sleep Mode: AL Hue @ 2023-03-21T18:03:32.287529+01:00>, new_state=<state switch.adaptive_lighting_sleep_mode_al_hue=on; icon=mdi:theme-light-dark, friendly_name=Adaptive Lighting Sleep Mode: AL Hue @ 2023-03-21T18:06:15.547841+01:00>>'
2023-03-21 18:06:15.552 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'T1?o':sleep:b'1^''
2023-03-21 18:06:15.554 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=True, context.id=adapt_lgt:b'T1?o':sleep:b'1^')' called
2023-03-21 18:06:15.555 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:06:15.555 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'T1?o':sleep:b'1^''
2023-03-21 18:06:15.563 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'T1?o':sleep:b'1^''
2023-03-21 18:06:15.734 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.desk_lamp_huelight' 'state_changed' event: '{'min_color_temp_kelvin': 2000, 'max_color_temp_kelvin': 6535, 'min_mireds': 153, 'max_mireds': 500, 'effect_list': ['colorloop'], 'supported_color_modes': [<ColorMode.COLOR_TEMP: 'color_temp'>, <ColorMode.XY: 'xy'>], 'color_mode': <ColorMode.XY: 'xy'>, 'brightness': 3, 'hs_color': (13.882, 100.0), 'rgb_color': (255, 59, 0), 'xy_color': (0.682, 0.315), 'off_with_transition': False, 'off_brightness': None, 'icon': 'hue:play-bar', 'friendly_name': 'Desk Lamp', 'supported_features': <LightEntityFeature.TRANSITION|FLASH|EFFECT: 44>}' with context.id='adapt_lgt:b'T1?o':sleep:b'1^''
2023-03-21 18:06:31.313 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'T1?o':interval:b'2L''
2023-03-21 18:06:31.315 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 30.0, force=False, context.id=adapt_lgt:b'T1?o':interval:b'2L')' called
2023-03-21 18:06:31.317 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:06:31.317 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 30.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'T1?o':interval:b'2L''
2023-03-21 18:06:31.323 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'T1?o':interval:b'2L''
2023-03-21 18:07:00.315 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'T1?o':interval:b'2m''
2023-03-21 18:07:00.316 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 30.0, force=False, context.id=adapt_lgt:b'T1?o':interval:b'2m')' called
2023-03-21 18:07:00.318 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:07:00.318 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 30.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'T1?o':interval:b'2m''
2023-03-21 18:07:00.319 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'T1?o':interval:b'2m''
2023-03-21 18:07:29.315 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'T1?o':interval:b'2>''
2023-03-21 18:07:29.317 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 30.0, force=False, context.id=adapt_lgt:b'T1?o':interval:b'2>')' called
2023-03-21 18:07:29.318 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:07:29.318 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 30.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'T1?o':interval:b'2>''
2023-03-21 18:07:29.322 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'T1?o':interval:b'2>''
2023-03-21 18:07:58.316 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'T1?o':interval:b'3I''
2023-03-21 18:07:58.317 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 30.0, force=False, context.id=adapt_lgt:b'T1?o':interval:b'3I')' called
2023-03-21 18:07:58.319 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:07:58.319 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 30.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'T1?o':interval:b'3I''
2023-03-21 18:07:58.320 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'T1?o':interval:b'3I''
pqhf5kd commented 1 year ago

Set your interval as high as your desired longest transition.

This appears to work. Here's a log to compare the difference:

2023-03-21 18:24:28.183 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting Sleep Mode: Adaptive Lighting: Turning on
2023-03-21 18:24:28.188 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: _sleep_mode_switch_state_event, event: '<Event state_changed[L]: entity_id=switch.adaptive_lighting_sleep_mode_al_hue, old_state=<state switch.adaptive_lighting_sleep_mode_al_hue=off; icon=mdi:theme-light-dark, friendly_name=Adaptive Lighting Sleep Mode: AL Hue @ 2023-03-21T18:22:34.241498+01:00>, new_state=<state switch.adaptive_lighting_sleep_mode_al_hue=on; icon=mdi:theme-light-dark, friendly_name=Adaptive Lighting Sleep Mode: AL Hue @ 2023-03-21T18:24:28.184257+01:00>>'
2023-03-21 18:24:28.190 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':sleep:b'1O''
2023-03-21 18:24:28.192 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=True, context.id=adapt_lgt:b'PaPD':sleep:b'1O')' called
2023-03-21 18:24:28.194 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:24:28.194 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':sleep:b'1O''
2023-03-21 18:24:28.198 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':sleep:b'1O''
2023-03-21 18:24:28.376 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.desk_lamp_huelight' 'state_changed' event: '{'min_color_temp_kelvin': 2000, 'max_color_temp_kelvin': 6535, 'min_mireds': 153, 'max_mireds': 500, 'effect_list': ['colorloop'], 'supported_color_modes': [<ColorMode.COLOR_TEMP: 'color_temp'>, <ColorMode.XY: 'xy'>], 'color_mode': <ColorMode.XY: 'xy'>, 'brightness': 3, 'hs_color': (13.882, 100.0), 'rgb_color': (255, 59, 0), 'xy_color': (0.682, 0.315), 'off_with_transition': False, 'off_brightness': None, 'icon': 'hue:play-bar', 'friendly_name': 'Desk Lamp', 'supported_features': <LightEntityFeature.TRANSITION|FLASH|EFFECT: 44>}' with context.id='adapt_lgt:b'PaPD':sleep:b'1O''
2023-03-21 18:24:34.299 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'1p''
2023-03-21 18:24:34.301 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'1p')' called
2023-03-21 18:24:34.303 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:24:34.303 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'1p''
2023-03-21 18:24:34.308 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'1p''
2023-03-21 18:25:03.301 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'1^''
2023-03-21 18:25:03.302 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'1^')' called
2023-03-21 18:25:03.304 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:25:03.304 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'1^''
2023-03-21 18:25:03.308 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'1^''
2023-03-21 18:25:10.365 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.waqi_stefanikova_kosice_slovakia (None) cannot be converted to the unit of previously compiled statistics (AQI). Generation of long term statistics will be suppressed unless the unit changes back to AQI or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this
2023-03-21 18:25:10.369 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.waqi_amurska_kosice_slovakia (None) cannot be converted to the unit of previously compiled statistics (AQI). Generation of long term statistics will be suppressed unless the unit changes back to AQI or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this
2023-03-21 18:25:10.371 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.waqi_dumbierska_kosice_slovakia (None) cannot be converted to the unit of previously compiled statistics (AQI). Generation of long term statistics will be suppressed unless the unit changes back to AQI or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this
2023-03-21 18:25:32.302 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'2L''
2023-03-21 18:25:32.304 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'2L')' called
2023-03-21 18:25:32.305 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:25:32.305 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'2L''
2023-03-21 18:25:32.310 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'2L''
2023-03-21 18:26:01.302 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'2m''
2023-03-21 18:26:01.304 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'2m')' called
2023-03-21 18:26:01.306 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:26:01.306 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'2m''
2023-03-21 18:26:01.313 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'2m''
2023-03-21 18:26:30.303 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'2>''
2023-03-21 18:26:30.305 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'2>')' called
2023-03-21 18:26:30.306 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:26:30.306 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'2>''
2023-03-21 18:26:30.310 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'2>''
2023-03-21 18:26:59.304 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'3I''
2023-03-21 18:26:59.306 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'3I')' called
2023-03-21 18:26:59.307 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:26:59.307 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'3I''
2023-03-21 18:26:59.313 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'3I''
2023-03-21 18:27:28.305 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'3j''
2023-03-21 18:27:28.307 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'3j')' called
2023-03-21 18:27:28.309 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:27:28.309 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'3j''
2023-03-21 18:27:28.312 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'3j''
2023-03-21 18:27:57.307 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'3;''
2023-03-21 18:27:57.309 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'3;')' called
2023-03-21 18:27:57.310 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:27:57.310 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'3;''
2023-03-21 18:27:57.312 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'3;''
2023-03-21 18:28:26.308 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'4F''
2023-03-21 18:28:26.310 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'4F')' called
2023-03-21 18:28:26.311 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:28:26.311 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'4F''
2023-03-21 18:28:26.318 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'4F''
2023-03-21 18:28:55.309 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'4g''
2023-03-21 18:28:55.311 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'4g')' called
2023-03-21 18:28:55.313 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:28:55.313 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'4g''
2023-03-21 18:28:55.316 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'4g''
2023-03-21 18:29:24.310 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'4*''
2023-03-21 18:29:24.312 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'4*')' called
2023-03-21 18:29:24.313 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:29:24.314 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'4*''
2023-03-21 18:29:24.317 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'4*''
2023-03-21 18:29:53.311 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'5C''
2023-03-21 18:29:53.313 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'5C')' called
2023-03-21 18:29:53.314 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:29:53.314 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'5C''
2023-03-21 18:29:53.322 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'5C''
2023-03-21 18:30:22.311 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'5d''
2023-03-21 18:30:22.313 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'5d')' called
2023-03-21 18:30:22.314 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:30:22.315 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'5d''
2023-03-21 18:30:22.319 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'5d''
2023-03-21 18:30:51.312 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'5&''
2023-03-21 18:30:51.313 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'5&')' called
2023-03-21 18:30:51.315 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:30:51.315 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'5&''
2023-03-21 18:30:51.315 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'5&''
2023-03-21 18:31:20.314 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'69''
2023-03-21 18:31:20.315 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'69')' called
2023-03-21 18:31:20.317 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:31:20.317 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'69''
2023-03-21 18:31:20.318 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'69''
2023-03-21 18:31:49.314 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'6a''
2023-03-21 18:31:49.316 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'6a')' called
2023-03-21 18:31:49.317 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:31:49.317 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'6a''
2023-03-21 18:31:49.318 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'6a''
2023-03-21 18:32:18.315 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'6#''
2023-03-21 18:32:18.316 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'6#')' called
2023-03-21 18:32:18.318 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:32:18.318 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'6#''
2023-03-21 18:32:18.319 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'6#''
2023-03-21 18:32:47.315 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'76''
2023-03-21 18:32:47.317 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'76')' called
2023-03-21 18:32:47.318 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:32:47.318 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'76''
2023-03-21 18:32:47.319 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.desk_lamp_huelight']')' event with context.id='adapt_lgt:b'PaPD':interval:b'76''
2023-03-21 18:33:16.316 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt:b'PaPD':interval:b'7X''
2023-03-21 18:33:16.318 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Adaptive Lighting: '_adapt_lights(['light.desk_lamp_huelight'], 299.0, force=False, context.id=adapt_lgt:b'PaPD':interval:b'7X')' called
2023-03-21 18:33:16.319 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Setting rgb_color of light light.desk_lamp_huelight
2023-03-21 18:33:16.319 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.desk_lamp_huelight', 'transition': 299.0, 'brightness': 3, 'rgb_color': [255, 56, 0]} with context.id='adapt_lgt:b'PaPD':interval:b'7X''
pqhf5kd commented 1 year ago

Although I suppose that this means the regular transitions will be less frequent and more noticeable?

It's interesting that even with the interval set to 299, AL appears to be doing something every 30 seconds

Also it's interesting that the log states brightness 3. I have it configured to 1 can see that the light doesn't transition fully to 1%. Turning the light off and on again (while sleep mode is still enabled) brings it down to the correct level

I'm also using the tradfri bulbs btw, they're great!

Actually I'm not so happy with them. I'm having trouble even with manual transitions

th3w1zard1 commented 1 year ago

According to your logs the interval is set to 30ish seconds. Otherwise I have no idea why the interval function is running every 30 seconds. Are you sure you saved your config correctly?

th3w1zard1 commented 1 year ago

The only thing that you should be seeing by adaptive lighting in the logs during those 299 seconds are normal state change events.

pqhf5kd commented 1 year ago

That's because I changed the Transition value instead of the Interval value, sorry 🤦 Retesting now

pqhf5kd commented 1 year ago

Ok, thank you, setting the interval to the same value as the sleep transition does allow the sleep transition to work correctly on my Hue light, even at 600 seconds.

I suppose I need to increase the length of regular transitions to smooth out the bigger, less frequent changes (while sleep mode is off). Technically, could a feature be implemented to ignore the interval vaule while sleep mode is switched on? Sleep mode is a fixed value, so theoretically there's no reason for the lights to be continuously updated no?

th3w1zard1 commented 1 year ago

Yeah I agree. This needs to be looked at. PR #450 should fix this once properly implemented.

Again please note that if you ever do need to use detect_non_ha_changes: true you need to set interval to slightly less than the smallest transition (see #417)

I am now a contributor to the main project and will ensure this issue is looked at moving forward with the next update.

th3w1zard1 commented 1 year ago

@pqhf5kd Do you mind if I rename this issue, to better explain the true problem?

pqhf5kd commented 1 year ago

Of course, please go ahead Sent from Jake Edmonds' iPhoneOn 22 Mar 2023, at 07:26, Benjamin Auquite @.***> wrote: @pqhf5kd Do you mind if I rename this issue, to better explain the true problem?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

th3w1zard1 commented 1 year ago

Done. I've also pinned the issue to prevent duplicates.

I implemented most of this code required for this fix in #450, all we need to do is finalize the PR.

Anyone having this problem please see https://github.com/basnijholt/adaptive-lighting/issues/400#issuecomment-1476915733

th3w1zard1 commented 1 year ago

@alexator This should be fixed in 1.10.0