GithubHelp home page GithubHelp logo

Comments (15)

basnijholt avatar basnijholt commented on July 16, 2024 1

But that is exactly how it is designed to work.

If the lights are off and something/someone turns on the lights, then it is adapted (also if you call light.turn_on(color_name='red')).

Only a change after that moment will lead to AL stopping.

from adaptive-lighting.

poudenes avatar poudenes commented on July 16, 2024 1

Then I understand you all the time :). And its lots of programming to add a feature like:

ignore_color: true

I can imagine that more people use colors in their house and some bulbs normal kelvin colors.
If you can add a line to ignore the turn_on when there is a color involved that will be very useful.

Now I'm using the sensor of circadian and use the colortemp attribute in all scripts for lights that not use color at that moment. Only thing now I can't turn it off. because its read the attribute all the time.

from adaptive-lighting.

basnijholt avatar basnijholt commented on July 16, 2024 1

And its lots of programming to add a feature like

Yes, it is a lot of work because there are many ways to specify a color.

Now I'm using the sensor of circadian and use the colortemp attribute in all scripts for lights that not use color at that moment. Only thing now I can't turn it off. because its read the attribute all the time.

Those sensor values are also available as attributes to the Adaptive Lighting switch!

You can also create an Adaptive Lighting switch with no lights at all and always leave it on.
Then you can use the new service adaptive_lighting.apply to apply the settings to some lights (you need to update to the latest code to use it ;).

from adaptive-lighting.

poudenes avatar poudenes commented on July 16, 2024 1

Thanks for this info. I will create a switch leave it on. And will do some tests with the new service. Thanks for all the patient !

from adaptive-lighting.

basnijholt avatar basnijholt commented on July 16, 2024

Great! Let me know how it works :)

from adaptive-lighting.

poudenes avatar poudenes commented on July 16, 2024

The adaptive_lighting.apply will only apply once to the light at that moment i guess?

from adaptive-lighting.

basnijholt avatar basnijholt commented on July 16, 2024

That is correct 👍

from adaptive-lighting.

Jeltel avatar Jeltel commented on July 16, 2024

I can imagine that more people use colors in their house and some bulbs normal kelvin colors.
If you can add a line to ignore the turn_on when there is a color involved that will be very useful.

I'm not completely following. But I suspected just as @poudenes that when you turn on the light, and use something to specify the colour, colourtemperature or brightness, that Adaptive Lighting would ignore the light, (turning off the switch.adaptive_lighting_name) and only would restart the adaptive lighting, when the light was turned off (and then on again, without light settings).
But If I'm correct, that's not what it does. How would I go around configuring a specific colour scheme, without Adaptive Lighting changing it?

  1. Turn off adaptive lighting switch, before turning the light to a specific setting?
  2. Do two light.turn_on. One to let adaptive lighting do it's thing and then to set the colour?

Both include an action that is not intuitive to me as a user.

from adaptive-lighting.

basnijholt avatar basnijholt commented on July 16, 2024

Do two light.turn_on. One to let adaptive lighting do it's thing and then to set the colour?

I would do this.

It's like this because of implementation details.

There are many keywords to the light.turn_on service? I only want to implement behaviors that are consistent and that one can reason about why it happens. It quite complicated already.

For example, what you are proposing could never work for lights that are controlled outside of HA.

However, I will look into implementing this.

from adaptive-lighting.

Jeltel avatar Jeltel commented on July 16, 2024

Ok, then it should work like I have it now.

I do a triple switch which sets a scene on all the lights in the living room. After a short while, adaptive lighting changes the light to the colour and brightness of that time of day.
That's expected then.
I would expect if I do the triple switch again, the lights remain in the set scene. However, the tradfri lights are changed by adaptive lighting. The Hue lights stay in the set scene.

Would that be a bug?

from adaptive-lighting.

poudenes avatar poudenes commented on July 16, 2024

Ok, then it should work like I have it now.

I do a triple switch which sets a scene on all the lights in the living room. After a short while, adaptive lighting changes the light to the colour and brightness of that time of day.
That's expected then.
I would expect if I do the triple switch again, the lights remain in the set scene. However, the tradfri lights are changed by adaptive lighting. The Hue lights stay in the set scene.

Would that be a bug?

That is a option. Not a nice one. First lights goto Adaptive lighting and then second action it give the light a color.
If it was possible for Bas to implement something that Adaptive Lighting ignored the turn_on when there is a color set for the light.

What I did now as workaround:

  1. Create a Adaptive Switch without lights in it:
- name: "Sensor"
  sleep_brightness: 20
  min_brightness: 70
  only_once: true
  max_color_temp: 3800
  min_color_temp: 2000
  interval: 30
  prefer_rgb_color: false
  take_over_control: true
  detect_non_ha_changes: true
  1. Some code in automations to use the values for lights that need to use Adaptive Lighting
    For example here my full automation "Scene Evening". Here you see a set of holiday scenes based on conditions.
    Now my lights change directly to right color without problem.
###########################################################################################
# SCENE EVENING WHEN SUN IS BELOW HORIZON AND NO TV OF MOVIE IS PLAYING
###########################################################################################

- alias: "Scene - Evening"
  trigger:

    - platform: time_pattern
      minutes: 1

    - platform: state
      entity_id: sun.sun

    - platform: state
      entity_id: binary_sensor.sensor_manual_family_home

    - platform: state
      entity_id: switch.scene_goodnight

    - platform: state
      entity_id: sensor.harmony
      to: "off"

  condition:
    - condition: state
      entity_id: sun.sun
      state: "below_horizon"

    - condition: state
      entity_id:
        - switch.scene_evening
        - switch.scene_goodnight
        - sensor.harmony
      state: "off"

    - condition: state
      entity_id: binary_sensor.sensor_manual_family_home
      state: "on"

  action:
    - service: script.engine_say
      data:
        media_player: media_player.this_device
        call_scene_evening: 1

    - service: input_number.set_value
      data:
        entity_id: input_number.fullykiosk_brightness_slider
        value: 50

    - service: switch.turn_on
      entity_id: switch.scene_evening

    - service: switch.turn_off
      data:
        entity_id:
          - switch.scene_appletv
          - switch.scene_cooking
          - switch.scene_daytime
          - switch.scene_disco
          - switch.scene_goodnight
          - switch.scene_kodi
          - switch.scene_sexy
          - switch.scene_sleeping
          - switch.scene_tv
          - switch.lux_low

    - service: light.turn_on
      data:
        entity_id: light.nanoleaf
        brightness_pct: 30
        effect: >-
          {% if states('sensor.holiday') == 'Christmas' %} Christmas
          {% elif states('sensor.holiday') == 'Halloween' %} Halloween
          {% elif states('sensor.holiday') == 'Kingsday' %} Kingsday
          {% elif states('sensor.holiday') == 'Birthday' %} Kingsday
          {% else %} Kay
          {% endif %}

    - service: homeassistant.turn_on
      data:
        entity_id: light.newkaku_01401eb6_a
        brightness_pct: >-
          {% if states('binary_sensor.neo_diningroomdoor_custom_sensor') == 'on' and states('switch.kay_learning') == 'on' %} 100
          {% elif states('binary_sensor.neo_diningroomdoor_custom_sensor') == 'on' and states('switch.kay_learning') == 'off' %} 0
          {% elif states('binary_sensor.neo_diningroomdoor_custom_sensor') == 'off' and states('switch.kay_learning') == 'on' %} 100
          {% else %} 50
          {% endif %}

    - choose:
# CHRISTMAS
        - conditions:
            - condition: state
              entity_id: sensor.holiday
              state: "Christmas"
          sequence:
            - service: switch.turn_on
              entity_id:
                - switch.node_8_switch # Bank
                - switch.node_2_switch # iMac

            - service: light.turn_on
              data:
                entity_id: light.livingroom_all
                brightness_pct: 100
                kelvin: "{{ states.switch.adaptive_lighting_sensor.attributes.color_temp_kelvin | round(0)}}"

            - service: light.turn_on
              data:
                entity_id: light.dressoir_all
                color_name: "blue"
                brightness_pct: "{{ 0 if is_state('binary_sensor.neo_diningroomdoor_custom_sensor', 'on') else 100 }}"

            - service: light.turn_on
              data:
                entity_id: light.dressoir_2
                color_temp: 153
                brightness_pct: "{{ 0 if is_state('binary_sensor.neo_diningroomdoor_custom_sensor', 'on') else 100 }}"

            - service: light.turn_on
              data:
                entity_id: light.balcony
                brightness_pct: 100
                effect: 0

# HALLOWEEN
        - conditions:
            - condition: state
              entity_id: sensor.holiday
              state: "Halloween"
          sequence:
            - service: light.turn_on
              data:
                entity_id: light.livingroom_all
                brightness_pct: 100
                kelvin: "{{ states.switch.adaptive_lighting_sensor.attributes.color_temp_kelvin | round(0)}}"

            - service: light.turn_on
              data:
                entity_id: light.dressoir_all
                color_name: "blue"
                brightness_pct: "{{ 0 if is_state('binary_sensor.neo_diningroomdoor_custom_sensor', 'on') else 100 }}"

            - service: light.turn_on
              data:
                entity_id: light.dressoir_2
                color_name: "purple"
                brightness_pct: "{{ 0 if is_state('binary_sensor.neo_diningroomdoor_custom_sensor', 'on') else 100 }}"

            - service: light.turn_on
              data:
                entity_id: light.balcony
                brightness_pct: 100
                effect: 0

# KINGSDAY
        - conditions:
            - condition: state
              entity_id: sensor.holiday
              state: "Kingsday"
          sequence:
            - service: light.turn_on
              data:
                entity_id: light.livingroom_all
                brightness_pct: 100
                kelvin: "{{ states.switch.adaptive_lighting_sensor.attributes.color_temp_kelvin | round(0)}}"

            - service: light.turn_on
              data:
                entity_id: light.dressoir_1
                color_name: "red"
                brightness_pct: "{{ 0 if is_state('binary_sensor.neo_diningroomdoor_custom_sensor', 'on') else 100 }}"

            - service: light.turn_on
              data:
                entity_id: light.dressoir_2
                color_temp: 153
                brightness_pct: "{{ 0 if is_state('binary_sensor.neo_diningroomdoor_custom_sensor', 'on') else 100 }}"

            - service: light.turn_on
              data:
                entity_id: light.dressoir_3
                color_name: "blue"
                brightness_pct: "{{ 0 if is_state('binary_sensor.neo_diningroomdoor_custom_sensor', 'on') else 100 }}"

            - service: light.turn_on
              data:
                entity_id: light.balcony
                brightness_pct: 100
                effect: 0

# BITHRDAY
        - conditions:
            - condition: state
              entity_id: sensor.holiday
              state: "Birthday"
          sequence:
            - service: light.turn_on
              data:
                entity_id: light.livingroom_all
                brightness_pct: 100
                kelvin: "{{ states.switch.adaptive_lighting_sensor.attributes.color_temp_kelvin | round(0)}}"

            - service: light.turn_on
              data:
                entity_id:
                  - light.dressoir_1
                  - light.dressoir_2
                  - light.dressoir_3
                effect: 0
                brightness_pct: "{{ 0 if is_state('binary_sensor.neo_diningroomdoor_custom_sensor', 'on') else 100 }}"

            - service: light.turn_on
              data:
                entity_id: light.balcony
                brightness_pct: 100
                effect: 0

# DEFAULT
      default:
        - service: light.turn_on
          data:
            entity_id: light.livingroom_all
            brightness_pct: 100
            kelvin: "{{ states.switch.adaptive_lighting_sensor.attributes.color_temp_kelvin | round(0)}}"

        - service: light.turn_on
          data:
            entity_id: light.balcony
            brightness_pct: 100
            effect: 0

        - service: light.turn_on
          data:
            entity_id: light.dressoir_all
            brightness_pct: "{{ 0 if is_state('binary_sensor.neo_diningroomdoor_custom_sensor', 'on') else 100 }}"

from adaptive-lighting.

Jeltel avatar Jeltel commented on July 16, 2024

Ok, that might work. But it's even less intuitive than my suggestion and would take up more configuration.

But I think that at least the Tradfri Lights aren't ignored after a second light.turn_on action. As that's what I've done here at home. I'll make a bug report for that.

from adaptive-lighting.

basnijholt avatar basnijholt commented on July 16, 2024

I would expect if I do the triple switch again, the lights remain in the set scene. However, the tradfri lights are changed by adaptive lighting. The Hue lights stay in the set scene.

Would that be a bug?

Yes, that sounds like it! Could you create an issue and attach the log?

from adaptive-lighting.

Jeltel avatar Jeltel commented on July 16, 2024

@basnijholt #5

from adaptive-lighting.

poudenes avatar poudenes commented on July 16, 2024

Thanks for all the support. I think we can close this.... thank for the A.L Intergration!!

from adaptive-lighting.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.