basnijholt / adaptive-lighting

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

AL not working with automation but does work manual #853

Open Dualdriven opened 1 year ago

Dualdriven commented 1 year ago

Home Assistant Adaptive Lighting Issue Template

Please confirm that you have completed the following steps:

Required information for bug reports:

Please include the following information in your issue.

  1. Debug logs captured while the issue occurred. See here for instructions on enabling debug logging:
2023-11-15 16:49:07.295 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] AL_Woonkamer: '_update_attrs_and_maybe_adapt_lights' called with context.id='01HF9TR0JZ:al:IFGF:ntrv:3K' lights: 'None', transition: '45.0', force: 'False'
2023-11-15 16:49:07.312 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] AL_Woonkamer: filtered_lights: '['light.woonkamer']'
2023-11-15 16:49:07.313 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] AL_Woonkamer: 'light.woonkamer' is being manually controlled, stop adapting, context.id=01HF9TR0JZ:al:IFGF:ntrv:3K.
2023-11-15 16:49:07.387 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] AL_Keuken: '_update_attrs_and_maybe_adapt_lights' called with context.id='01HF9TR0NV:al:IFGF:ntrv:3K' lights: 'None', transition: '45.0', force: 'False'
2023-11-15 16:49:07.402 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] AL_Keuken: filtered_lights: '['light.keuken']'
2023-11-15 16:49:07.403 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] AL_Keuken: 'light.keuken' is being manually controlled, stop adapting, context.id=01HF9TR0NV:al:IFGF:ntrv:3K.
2023-11-15 16:49:07.444 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] AL_Eettafel: '_update_attrs_and_maybe_adapt_lights' called with context.id='01HF9TR0QK:al:IFGF:ntrv:3K' lights: 'None', transition: '45.0', force: 'False'
2023-11-15 16:49:07.459 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] AL_Eettafel: filtered_lights: '['light.eettafel']'
2023-11-15 16:49:07.460 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] AL_Eettafel: 'light.eettafel' is being manually controlled, stop adapting, context.id=01HF9TR0QK:al:IFGF:ntrv:3K.
  1. Your Adaptive Lighting configuration:
interval: 90
transition: 45
initial_transition: 1
seperate_turn_on_commands: enabled
  1. (If using Zigbee2MQTT), provide your configuration files (remove all personal information before posting):
    • devices.yaml n.a.
    • groups.yaml n.a.
    • configuration.yaml
      
      # Loads default set of integrations. Do not remove.
      default_config:

Load frontend themes from the themes folder

frontend: themes: !include_dir_merge_named themes extra_module_url: /config/www/community/lovelace-card-mod/card-mod.js

automation: !include automations.yaml script: !include scripts.yaml scene: !include scenes.yaml sensor: !include sensors.yaml light: !include lights.yaml template: !include templates.yaml input_boolean: !include input_boolean.yaml group: !include groups.yaml notify: !include notify.yaml

homeassistant: name: Thuis latitude: !secret latitude longitude: !secret longitude elevation: !secret elevation unit_system: metric currency: EUR country: NL time_zone: "Europe/Amsterdam" temperature_unit: C internal_url: !secret internal_url packages: !include_dir_named packages customize: !include customize.yaml

recorder: db_url: !secret mariadb_url commit_interval: 20 purge_keep_days: 30

influxdb: host: !secret influxdb_host port: 8086 database: !secret influxdb_database username: !secret influxdb_user password: !secret influxdb_pass max_retries: 3 default_measurement: state include: #include entities domains:

http: ip_ban_enabled: true login_attempts_threshold: 3


-  mqtt: `server`:  No idea what you mean, if you mean IP adress is can post it.
-  mqtt: `user`: mosquitto
-  mqtt: `password`: mqtt
-  advanced: `pan_id`: 50198 (hope this is correct)
-  advanced: `network_key`: n.a.
-  Brand and model number of problematic light(s)
            -    IKEA Tradfri [LED1624G9]
            -    IKEA Tradfri [LED2003G10]
- `Blueprint`:

blueprint: name: Motion-activated Light based on Sun Elevation domain: automation source_url: https://community.home-assistant.io/t/motion-activate-light-or-switch-based-on-daylight-sun-elevation/265010 input: motion_entity: name: Motion Sensor selector: entity: domain: binary_sensor device_class: motion light_target: name: Light selector: target: entity: domain: light default: "" below_elevation: name: Below sun elevation description: Solar elevation. This is the angle between the sun and the horizon. Negative values mean the sun is below the horizon. default: 3 selector: number: min: -90.0 max: 90.0 unit_of_measurement: degrees step: 1.0 mode: slider mode: restart max_exceeded: silent trigger: platform: state entity_id: !input "motion_entity" from: "off" to: "on" variables: below_elevation: !input "below_elevation" condition:

  1. Steps to reproduce the behavior: Turn on lights with automation and turn on lights manual.

  2. Other I have no clue why it is not working since the blueprint is still using the service light.turn_on AL should intercept it. Also I saw the log is saying that the lights are manually controlled which isn't the case (100% sure) since I waited for the lights to turn on by the automation.

A other thought I had was changing the service from light.turn_on to adaptive_lighting.apply as in:

service: adaptive_lighting.apply
data:
  turn_on_lights: true
  lights:
    - light.woonkamer
  adapt_brightness: true
  adapt_color: true

Thanks for your time!

ghudgens commented 12 months ago

Not sure if it's the same problem, but I had the same problem with service actions, but once I switched to device actions, it worked.

ybjlus commented 10 months ago

I have the same issue, I think it's since the last update. My scenes are controlled through node red with a "light-turn on" command combined with brightness/color data.

JoshSald commented 10 months ago

After updating HA yesterday I've also been having a similar issue with 1 bulb (Tradfri LED2003G10) that refuses to adapt either via automation or from a light.turn_on service call.

domdomegg commented 2 months ago

I'm also finding adaptive lighting doesn't take over with IKEA Tradfri bulbs when triggered from an automation with:

description: "Test automation"
mode: single
trigger: []
condition: []
action:
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      device_id: d90d1876eb5982d6512c4c18b3434488

Using the light entity rather than device appears to work though. This is the workaround I'm using for now.

Happy to provide logs as necessary to help debug this, if provided instructions on how to find and share the relevant ones!

jamesshannon commented 1 month ago

I'm seeing this in the most recent version.

2024-10-04 15:43:44.865 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] ADU Bedroom Closet: Ignoring 'off' → 'on' event for 'light.adu_bedroom_closet_light' with context.id='01J9CV81FWG9GV20KVE0HCV76S' because 'light.turn_on' was not called by HA and 'detect_non_ha_changes' is False

Which is false -- it's being turned on via an automation.