GithubHelp home page GithubHelp logo

Comments (18)

claytonjn avatar claytonjn commented on May 30, 2024

https://github.com/claytonjn/hass-circadian_lighting/wiki/Additional-Functionality#turn-on-lights-to-correct-color-temperature--brightness

from hass-circadian_lighting.

RobertDWhite avatar RobertDWhite commented on May 30, 2024

Hi claytonjn,
Thanks for all your work!
I have been looking over this more. Since I use the dimmers, I think it is more accurate to be seeking information about how to make scenes that turn on to the appropriate setting. I am looking into the Hue debugging now and have successfully turned off all my lights (one small step...). So onward, I suppose, to figuring out how to pull the circadian rhythm into Hue scenes.

from hass-circadian_lighting.

claytonjn avatar claytonjn commented on May 30, 2024

Ah, yes. I started writing the documentation on that (same page in the WiKi) but haven't had the time to finish it... Hopefully I will soon.

from hass-circadian_lighting.

RobertDWhite avatar RobertDWhite commented on May 30, 2024

Ah. I see. Thanks for the heads up. I do have the correct setting for power on, now, though. So maybe I will figure it out before the documentation goes up! I have challenged myself. Thanks again for all your work.

from hass-circadian_lighting.

JSchoeck avatar JSchoeck commented on May 30, 2024

Hi Clayton, great feature set and implementation, thanks for providing your code to the public!
I'm trying to use the service call as you describe in the documentation, but my light isn't reacting.
Might be a bit naive, but is the code you give as an example for an action usable literally? I'm asking because of the switch.circadian_lighting_[...] bit - or do I have to define an acutal name for my intended target light and use switch.lightname instead (which I tried but it didn't work).
Switching on the circadian light while my light is on does correctly change color already.

from hass-circadian_lighting.

claytonjn avatar claytonjn commented on May 30, 2024

You're using the entity_id of the Circadian Lighting switch(s) that was created when you configured CL. So it should start with switch.circadian_lighting_ and you have to replace the [...] with the rest of the entity_id based on how you named the switch.

from hass-circadian_lighting.

JSchoeck avatar JSchoeck commented on May 30, 2024

That's what I thought (could be clearer in the docs though) and tried. See code below.
This does not turn on my light though, it stays off.

In configuration.yaml:

switch:
  - platform: circadian_lighting 
    name: Tageslichtlampe
    lights_rgb:
      - light.led_lichterkette_1_rgb

Automation (via HASSIO UI):
Called service: light.turn_on
Used entity_id: light.led_lichterkette_1_rgb
Action/Data code:

brightness_pct: '{{ state_attr(''switch.circadian_lighting_tageslichtlampe'', ''brightness'') | int }}'
kelvin: '{{ state_attr(''sensor.circadian_values'', ''colortemp'') | int }}'

It also doesn't work if I append the name, i.e. switch.circadian_lighting_tageslichtlampe or switch.circadian_lighting_led_lichterkette_1_rgb. I do see that the configuration changed to the value when I specified the switch, so I do know the correct name.
Does CL only work when the light is already switched on or maybe only with RBGWW lights? I'm using an analog RGB LED strip.

What's weird is that when I test the automation (manually triggering it via the UI), it says "in 8 seconds" - which it doens't for any other automation I've created so far (where it says "0 seconds ago" or something).

Edit: Fixed switch name to lowercase.

from hass-circadian_lighting.

claytonjn avatar claytonjn commented on May 30, 2024

That looks right, although the quotes seem wrong. You should have a double quote " around the template string and a single quote ' around the entity_id and attribute, per my example.

I've never uses the GUI to do Automations because it doesn't offer full functionality and it looks like you can't use templates at all. If you notice in my example the Automation has data_template: rather than just data:, so I'm pretty sure you just have to write the automation manually in automations.yaml.

from hass-circadian_lighting.

JSchoeck avatar JSchoeck commented on May 30, 2024

Does CL only work when the light is already switched on?
What about this? The service call suggests that the actual light should turn on as well.
Although it doesn't change the fact that the circadian "light switch" doesn't turn on. If I add another action to first turn on my light, it is the color that was set last, not circadian.

About the templating: it definitely does work per se via the UI, I'm using it for other things and it has also been confirmed by others. I also tried to change the quotes in there yaml and use that, also without success - plus my other automations use the same quote pattern anyway.

I don't know what else to try...

from hass-circadian_lighting.

claytonjn avatar claytonjn commented on May 30, 2024

What does the automation look like from your automations.yaml file?

from hass-circadian_lighting.

JSchoeck avatar JSchoeck commented on May 30, 2024

The mystery is solved!
The automation via UI needs 4 actions.

  1. Turn on the light device itself that you want to use and have defined to use CL settings. The automation action is "device" -> turn on light name
  2. Service switch.turn_on for the CL switch component (for which you later set brightness via state_attr).
  3. Service light.turn_on for the defined light (same one as in the CL call)
  4. The above discussed service call for CL (works as I posted it)

Thank you for your help!

from hass-circadian_lighting.

claytonjn avatar claytonjn commented on May 30, 2024

I'm confused, based on your description it sounds like you're turning on the light three times and turning on the CL switch. It may seem like it's working, but I'm thinking that what's really happening is that the CL switch adjusts as soon as it's turned on and already "listens" for the configured lights to be turned on, and the extra actions are superfluous. If you set the lights to something like green, then turn them off, then run your automation; do they come on immediately at the correct color temperature or do they come on green and then transition to the correct color temperature?

If you could post a screenshot of your automation or the code from automations.yaml that would really help clear things up.

from hass-circadian_lighting.

JSchoeck avatar JSchoeck commented on May 30, 2024

Yes exactly, the service call does not turn on the light, which is why I tried the additional actions.
With my automation sequence the light turns on with the circadian values directly, even if I set it to something else before.

Here's the code from the yaml:

- id: '1578059524133'
  alias: '[Licht] Aufwachlicht'
  description: LED Streifen mit Circadian Lighting anschalten
  trigger:
  - at: '7:30'
    platform: time
  condition: []
  action:
  - device_id: f3dba83649964f8ea3bc000a6f9a15e3
    domain: light
    entity_id: light.led_lichterkette_1_rgb
    type: turn_on
  - entity_id: switch.circadian_lighting_tageslichtlampe
    service: switch.turn_on
  - entity_id: light.led_lichterkette_1_rgb
    service: light.turn_on
  - data:
      brightness_pct: '{{ state_attr(''switch.circadian_lighting_tageslichtlampe'',
        ''brightness'') | int }}'
      kelvin: '{{ state_attr(''sensor.circadian_values'', ''colortemp'') | int }}'
    entity_id: light.led_lichterkette_1_rgb
    service: light.turn_on

from hass-circadian_lighting.

claytonjn avatar claytonjn commented on May 30, 2024

What type of light is this? You definitely shouldn't need to send three turn_on commands for the light, some users have reported lights only adjusting colortemp or brightness but not both in the same call so I could see that being an issue, but this should really be enough:

- id: '1578059524133'
  alias: '[Licht] Aufwachlicht'
  description: LED Streifen mit Circadian Lighting anschalten
  trigger:
    - at: '7:30'
      platform: time
  condition: []
  action:
    - service: switch.turn_on
      entity_id: switch.circadian_lighting_tageslichtlampe
    - service: light.turn_on
      entity_id: light.led_lichterkette_1_rgb
      data_template:
        brightness_pct: '{{ state_attr(''switch.circadian_lighting_tageslichtlampe'', ''brightness'') | int }}'
        kelvin: '{{ state_attr(''sensor.circadian_values'', ''colortemp'') | int }}'

from hass-circadian_lighting.

claytonjn avatar claytonjn commented on May 30, 2024

Is the behavior different if you change the automation to be just the following?

- id: '1578059524133'
  alias: '[Licht] Aufwachlicht'
  description: LED Streifen mit Circadian Lighting anschalten
  trigger:
    - at: '7:30'
      platform: time
  condition: []
  action:
    - entity_id: switch.circadian_lighting_tageslichtlampe
      service: switch.turn_on
    - entity_id: light.led_lichterkette_1_rgb
      service: light.turn_on

from hass-circadian_lighting.

JSchoeck avatar JSchoeck commented on May 30, 2024

Is the behavior different if you change the automation to be just the following?

- id: '1578059524133'
  alias: '[Licht] Aufwachlicht'
  description: LED Streifen mit Circadian Lighting anschalten
  trigger:
    - at: '7:30'
      platform: time
  condition: []
  action:
    - entity_id: switch.circadian_lighting_tageslichtlampe
      service: switch.turn_on
    - entity_id: light.led_lichterkette_1_rgb
      service: light.turn_on

This works, yes!
Turns on the light directly into CL mode, without the former color or brightness being visible.

For completeness sake: I'm using a Simfonio LED strip (based on Tuyas version of the ESP8266, can aparently be integrated into HA via the fluxled component):
https://www.amazon.de/gp/product/B07X22SCCN/

So, now we only need a mechanism to reduce/correct the brightness (as it's much brigther than the sunlight during winter now, almost at full brightness before the sun is even starting to rise).

Cheers!

from hass-circadian_lighting.

claytonjn avatar claytonjn commented on May 30, 2024

This works, yes!
Turns on the light directly into CL mode, without the former color or brightness being visible.

So actually you're not actually turning on the light directly to the correct values, CL just adjusts so fast you can't tell. That's perfect if it works for you! With some lights there's a noticeable delay and the templates are required.

So, now we only need a mechanism to reduce/correct the brightness (as it's much brigther than the sunlight during winter now, almost at full brightness before the sun is even starting to rise).

This is actually intentional. Circadian Lighting is designed to be weather/season agnostic so that the behavior is consistent and a rhythm is maintained. One of the big benefits of CL is keeping you more alert during winter months where it can often be dark and gloomy and depressing.

from hass-circadian_lighting.

JSchoeck avatar JSchoeck commented on May 30, 2024

Ah, thank you for the explanation!

from hass-circadian_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.