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

Tradfri Lights still adapted after a second light.turn_on #5

Closed
Jeltel opened this issue Oct 8, 2020 · 7 comments
Closed

Tradfri Lights still adapted after a second light.turn_on #5

Jeltel opened this issue Oct 8, 2020 · 7 comments

Comments

@Jeltel
Copy link

Jeltel commented Oct 8, 2020

  • When turning on the lights for the first time with a script, the lights go to the set scene. And then after a short while AL will change the lights. This is logical.
  • Then a second activation of the scripts, activates the lights and undoes what AL did.
  • Then after a short while again, the Tradfri lights are updated by AL, while the Hue lights stay at the scene.

So AL recognizes that a scene has been set for the Hue lights, but not for the Tradfri lights.

This is what the script does:

woonkamer_energie:
  sequence:
  - data:
      entity_id: light.eettafel
      color_temp: 152
    service: light.turn_on
  - data:
      entity_id: light.koplamp
      color_temp: 152
    service: light.turn_on
  - data:
      brightness: 255
      entity_id: light.lamp_boven_zithoek
      color_temp: 152
    service: light.turn_on
  - data:
      brightness: 255
      entity_id: light.leeslamp_bank
      color_temp: 152
    service: light.turn_on
  - data:
      entity_id: light.lampjes_langs_het_plafond
    service: light.turn_on
  - delay:
      milliseconds: 1
  - data:
      brightness: 255
      entity_id: light.eettafel
    service: light.turn_on
  - data:
      brightness: 255
      entity_id: light.koplamp
    service: light.turn_on
  alias: Woonkamer Energie

Where light.eettafel and light.koplamp are Tradfri lights (bundles of 4 and 2 lights to be exact) and light.lamp_boven_zithoek and light.leeslamp_bank are HUE lights.
Thing with the Tradfri lights is that they cannot process two settings at the same time. So brightness and colour need to be set shortly after each other. So are actually already are two light.turn_on actions in this script.

@Jeltel
Copy link
Author

Jeltel commented Oct 8, 2020

@basnijholt what log do you need?
Which log setting do I need to set for home assistant?

@basnijholt
Copy link
Owner

Could you add this to your configuration.yaml:

logger:
  default: warning
  logs:
    custom_components.adaptive_lighting: debug

restart HA and share home-assistant.log after the problem occurred.

@Jeltel
Copy link
Author

Jeltel commented Oct 9, 2020

2020-10-09 08:27:41 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.eettafel']')' event
2020-10-09 08:27:42 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.koplamp']')' event
2020-10-09 08:27:42 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.lamp_boven_zithoek']')' event
2020-10-09 08:27:43 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.leeslamp_bank']')' event
2020-10-09 08:28:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Zithoek: '_update_attrs_and_maybe_adapt_lights' called
2020-10-09 08:28:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Zithoek: '_adapt_lights(['light.koplamp', 'light.lamp_boven_zithoek', 'light.leeslamp_bank', 'light.eettafel'], None, False)' called
2020-10-09 08:28:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Zithoek: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.koplamp', 'transition': 45.0, 'brightness_pct': 100, 'color_temp': 364}
2020-10-09 08:28:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Zithoek: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.lamp_boven_zithoek', 'transition': 45.0, 'brightness_pct': 100, 'color_temp': 364}
2020-10-09 08:28:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Zithoek: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.leeslamp_bank', 'transition': 45.0, 'brightness_pct': 100, 'color_temp': 364}
2020-10-09 08:28:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Zithoek: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.eettafel', 'transition': 45.0, 'brightness_pct': 100, 'color_temp': 364}
2020-10-09 08:28:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.koplamp']')' event
2020-10-09 08:28:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.lamp_boven_zithoek']')' event
2020-10-09 08:28:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.leeslamp_bank']')' event
2020-10-09 08:28:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.eettafel']')' event
2020-10-09 08:28:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Gang Boven: '_update_attrs_and_maybe_adapt_lights' called
2020-10-09 08:28:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Gang Boven: '_adapt_lights(['light.lamp_gang_boven'], None, False)' called
2020-10-09 08:28:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.lamp_boven_zithoek' 'state_changed' event: '{'min_mireds': 153, 'max_mireds': 500, 'effect_list': ['colorloop'], 'brightness': 254, 'color_temp': 364, 'hs_color': (0, 0), 'rgb_color': (255, 255, 255), 'xy_color': (0.323, 0.329), 'off_brightness': None, 'friendly_name': 'Lamp Boven Zithoek', 'supported_features': 63}'
2020-10-09 08:28:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.leeslamp_bank' 'state_changed' event: '{'min_mireds': 153, 'max_mireds': 500, 'effect_list': ['colorloop'], 'brightness': 254, 'color_temp': 364, 'hs_color': (0, 0), 'rgb_color': (255, 255, 255), 'xy_color': (0.323, 0.329), 'off_brightness': None, 'friendly_name': 'Leeslamp Bank', 'supported_features': 63}'
2020-10-09 08:28:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.eettafel' 'state_changed' event: '{'min_mireds': 250, 'max_mireds': 454, 'brightness': 254, 'color_temp': 364, 'off_brightness': None, 'friendly_name': 'Eettafel', 'supported_features': 43}'
2020-10-09 08:28:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.eettafel' 'state_changed' event: '{'min_mireds': 250, 'max_mireds': 454, 'brightness': 254, 'color_temp': 250, 'off_brightness': None, 'friendly_name': 'Eettafel', 'supported_features': 43}'
2020-10-09 08:28:24 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.koplamp' 'state_changed' event: '{'min_mireds': 250, 'max_mireds': 454, 'brightness': 254, 'color_temp': 364, 'off_brightness': None, 'friendly_name': 'Koplamp', 'supported_features': 43}'
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Zithoek: '_update_attrs_and_maybe_adapt_lights' called
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Zithoek: '_adapt_lights(['light.koplamp', 'light.lamp_boven_zithoek', 'light.leeslamp_bank', 'light.eettafel'], None, False)' called
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Zithoek: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.koplamp', 'transition': 45.0, 'brightness_pct': 100, 'color_temp': 360}
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Zithoek: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.lamp_boven_zithoek', 'transition': 45.0, 'brightness_pct': 100, 'color_temp': 360}
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Zithoek: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.leeslamp_bank', 'transition': 45.0, 'brightness_pct': 100, 'color_temp': 360}
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Zithoek: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.eettafel', 'transition': 45.0, 'brightness_pct': 100, 'color_temp': 360}
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.koplamp']')' event
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.lamp_boven_zithoek']')' event
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.leeslamp_bank']')' event
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.eettafel']')' event
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Gang Boven: '_update_attrs_and_maybe_adapt_lights' called
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Gang Boven: '_adapt_lights(['light.lamp_gang_boven'], None, False)' called
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.lamp_boven_zithoek' 'state_changed' event: '{'min_mireds': 153, 'max_mireds': 500, 'effect_list': ['colorloop'], 'brightness': 254, 'color_temp': 360, 'hs_color': (0, 0), 'rgb_color': (255, 255, 255), 'xy_color': (0.323, 0.329), 'off_brightness': None, 'friendly_name': 'Lamp Boven Zithoek', 'supported_features': 63}'
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.eettafel' 'state_changed' event: '{'min_mireds': 250, 'max_mireds': 454, 'brightness': 254, 'color_temp': 360, 'off_brightness': None, 'friendly_name': 'Eettafel', 'supported_features': 43}'
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.leeslamp_bank' 'state_changed' event: '{'min_mireds': 153, 'max_mireds': 500, 'effect_list': ['colorloop'], 'brightness': 254, 'color_temp': 360, 'hs_color': (0, 0), 'rgb_color': (255, 255, 255), 'xy_color': (0.323, 0.329), 'off_brightness': None, 'friendly_name': 'Leeslamp Bank', 'supported_features': 63}'
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.eettafel' 'state_changed' event: '{'min_mireds': 250, 'max_mireds': 454, 'brightness': 254, 'color_temp': 278, 'off_brightness': None, 'friendly_name': 'Eettafel', 'supported_features': 43}'
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.eettafel' 'state_changed' event: '{'min_mireds': 250, 'max_mireds': 454, 'brightness': 254, 'color_temp': 306, 'off_brightness': None, 'friendly_name': 'Eettafel', 'supported_features': 43}'
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.eettafel' 'state_changed' event: '{'min_mireds': 250, 'max_mireds': 454, 'brightness': 254, 'color_temp': 334, 'off_brightness': None, 'friendly_name': 'Eettafel', 'supported_features': 43}'
2020-10-09 08:29:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.eettafel' 'state_changed' event: '{'min_mireds': 250, 'max_mireds': 454, 'brightness': 254, 'color_temp': 362, 'off_brightness': None, 'friendly_name': 'Eettafel', 'supported_features': 43}'
2020-10-09 08:29:54 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.koplamp' 'state_changed' event: '{'min_mireds': 250, 'max_mireds': 454, 'brightness': 254, 'color_temp': 360, 'off_brightness': None, 'friendly_name': 'Koplamp', 'supported_features': 43}'
2020-10-09 08:29:54 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.koplamp' 'state_changed' event: '{'min_mireds': 250, 'max_mireds': 454, 'brightness': 254, 'color_temp': 306, 'off_brightness': None, 'friendly_name': 'Koplamp', 'supported_features': 43}'
2020-10-09 08:29:54 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.koplamp' 'state_changed' event: '{'min_mireds': 250, 'max_mireds': 454, 'brightness': 254, 'color_temp': 362, 'off_brightness': None, 'friendly_name': 'Koplamp', 'supported_features': 43}'
2020-10-09 08:30:27 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.eettafel']')' event
2020-10-09 08:30:27 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.koplamp']')' event
2020-10-09 08:30:28 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.lamp_boven_zithoek']')' event
2020-10-09 08:30:28 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.leeslamp_bank']')' event
2020-10-09 08:31:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Zithoek: '_update_attrs_and_maybe_adapt_lights' called
2020-10-09 08:31:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Zithoek: '_adapt_lights(['light.koplamp', 'light.lamp_boven_zithoek', 'light.leeslamp_bank', 'light.eettafel'], None, False)' called
2020-10-09 08:31:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Zithoek: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.koplamp', 'transition': 45.0, 'brightness_pct': 100, 'color_temp': 357}
2020-10-09 08:31:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Zithoek: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.lamp_boven_zithoek', 'transition': 45.0, 'brightness_pct': 100, 'color_temp': 357}
2020-10-09 08:31:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Zithoek: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.leeslamp_bank', 'transition': 45.0, 'brightness_pct': 100, 'color_temp': 357}
2020-10-09 08:31:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Zithoek: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.eettafel', 'transition': 45.0, 'brightness_pct': 100, 'color_temp': 357}
2020-10-09 08:31:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.koplamp']')' event
2020-10-09 08:31:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.lamp_boven_zithoek']')' event
2020-10-09 08:31:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.leeslamp_bank']')' event
2020-10-09 08:31:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.eettafel']')' event
2020-10-09 08:31:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Gang Boven: '_update_attrs_and_maybe_adapt_lights' called
2020-10-09 08:31:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Gang Boven: '_adapt_lights(['light.lamp_gang_boven'], None, False)' called
2020-10-09 08:31:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.lamp_boven_zithoek' 'state_changed' event: '{'min_mireds': 153, 'max_mireds': 500, 'effect_list': ['colorloop'], 'brightness': 254, 'color_temp': 357, 'hs_color': (0, 0), 'rgb_color': (255, 255, 255), 'xy_color': (0.323, 0.329), 'off_brightness': None, 'friendly_name': 'Lamp Boven Zithoek', 'supported_features': 63}'
2020-10-09 08:31:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.leeslamp_bank' 'state_changed' event: '{'min_mireds': 153, 'max_mireds': 500, 'effect_list': ['colorloop'], 'brightness': 254, 'color_temp': 357, 'hs_color': (0, 0), 'rgb_color': (255, 255, 255), 'xy_color': (0.323, 0.329), 'off_brightness': None, 'friendly_name': 'Leeslamp Bank', 'supported_features': 63}'
2020-10-09 08:31:23 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.eettafel' 'state_changed' event: '{'min_mireds': 250, 'max_mireds': 454, 'brightness': 254, 'color_temp': 357, 'off_brightness': None, 'friendly_name': 'Eettafel', 'supported_features': 43}'
2020-10-09 08:31:24 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.koplamp' 'state_changed' event: '{'min_mireds': 250, 'max_mireds': 454, 'brightness': 254, 'color_temp': 357, 'off_brightness': None, 'friendly_name': 'Koplamp', 'supported_features': 43}'

There you go.
Now the Hue lights also don't stay in the set scene.

@basnijholt
Copy link
Owner

Hi @Jeltel,

Thanks a lot for your log file and for reporting a bug. However, it might be that I have solved this already because you are using an old version of the code. Could you please update to the latest version of the code and try again?

@Jeltel
Copy link
Author

Jeltel commented Oct 9, 2020

I've installed the new version and will investigate somewhere in the next couple of days. Now my paying work calls :)

Thanks for this adaptive lighting so far. It at least fixes some issues with Circadian lighting that kept bugging me. 👍

@basnijholt
Copy link
Owner

Good! Please let me know whether it works as expected for you now or not.

@Jeltel
Copy link
Author

Jeltel commented Oct 12, 2020

@basnijholt No issues so far for switching colours after turning the light to a colour twice.

Did saw sporadically that the lights turned on again, after turning off. But I'll make a new issue when i get some more info about it.

@Jeltel Jeltel closed this as completed Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants