Dim lights based on the sun's elevation

The allowance is used to indicate how much the brightness is allowed to change by someone else between each trigger of the automation.

Say that the sun is at 10 degrees and the light is at 100% brightness then you manually change the brightness to 50% of the light. When the automation is triggered the next time by the sun elevation, it will check if the brightness of the light is still the same as the last time it was triggered by the sun. If not, it will see how much it has changed and compare the change to the allowance. If the allowance is 100% then the automation will always set the new brightness otherwise it will only allow setting the new brightness if the change is within the allowance value.

This is to avoid manually be able to adjust the brightness.

Once the light is turned off and on again, the calculated brightness based on the sun angle will be set always.

Ok, then I’ve understood it correctly. Sadly, it doesn’t seem to work for me however. No matter what I put the allowance at, it will always ignore my manual change. Most importantly, it will turn the lights on if I manually switched them off.

Can you post your configuration and also if you have debugging enabled?

This is my config (from the new ‘trace’ screen):

id: '1618590071158'
alias: Woonkamer LED en zon-hoogte
description: ''
use_blueprint:
  path: EvTheFuture/dim_lights_based_on_sun_elevation.yaml
  input:
    min_brightness: 10
    allowance: 0
    turn_on: true
    start_elevation_setting: 8.5
    turn_off: false
    transition_time: 0
    end_elevation_rising: 5
    start_elevation_rising: -5.5
    target_lights:
      entity_id: light.woonkamer_led_vide
    end_elevation_setting: -18
    max_brightness: 90
    debugging: true

I’m not sure what to expect from your debugging option? I have it switched on, but it appears to have set all logging to DEBUG, so I have no clue what to look for now.
[edit] I was too quick, here’s a part of my log. I’ve set up a ‘rising’ bit to test for now and I manually increased the brightness at the end to 80 pct. Funnily enough it appears to work in this situation (even though ‘skip’ is false).



2021-04-25 10:16:33 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 34.0 (32, 40)

 last elevation: 33.44

 new brightness: 76

 last brightness: 61

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 61}]

 

 force_turn_on: False

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: ['light.woonkamer_led_vide']

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 33.44, azimuth: 113.2)

 to:   (elevation: 34.0, azimuth: 114.15)

2021-04-25 10:16:34 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 34.0 (32, 40)

 last elevation: 34.0

 new brightness: 76

 last brightness: 76

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 61}]

 

 force_turn_on: False

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: ['light.woonkamer_led_vide']

 service_data_length: 3

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 76, 'transition': 0}}


2021-04-25 10:20:33 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 34.56 (32, 40)

 last elevation: 34.0

 new brightness: 90

 last brightness: 76

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 76}]

 

 force_turn_on: False

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: ['light.woonkamer_led_vide']

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 34.0, azimuth: 114.15)

 to:   (elevation: 34.56, azimuth: 115.11)

2021-04-25 10:20:33 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 34.56 (32, 40)

 last elevation: 34.56

 new brightness: 90

 last brightness: 90

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 76}]

 

 force_turn_on: False

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: ['light.woonkamer_led_vide']

 service_data_length: 3

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 90, 'transition': 0}}

2021-04-25 10:21:12 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 34.56 (32, 40)

 last elevation: 34.56

 new brightness: 90

 last brightness: 90

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 90}]

 

 force_turn_on: False

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: light.woonkamer_led_vide

 service_data_length: 2

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': 'light.woonkamer_led_vide', 'brightness_pct': 80}}


2021-04-25 10:24:33 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 35.12 (32, 40)

 last elevation: 34.56

 new brightness: 104

 last brightness: 90

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 204}]

 

 force_turn_on: False

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 34.56, azimuth: 115.11)

 to:   (elevation: 35.12, azimuth: 116.08)










2021-04-25 10:28:33 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 35.67 (32, 40)

 last elevation: 35.12

 new brightness: 118

 last brightness: 104

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 204}]

 

 force_turn_on: False

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 35.12, azimuth: 116.08)

 to:   (elevation: 35.67, azimuth: 117.07)

Config for testing is:

id: '1618590071158'
alias: Woonkamer LED en zon-hoogte
description: ''
use_blueprint:
  path: EvTheFuture/dim_lights_based_on_sun_elevation.yaml
  input:
    min_brightness: 10
    allowance: 0
    turn_on: true
    start_elevation_setting: 8.5
    turn_off: true
    transition_time: 0
    end_elevation_rising: 40
    start_elevation_rising: 32
    target_lights:
      entity_id: light.woonkamer_led_vide
    end_elevation_setting: -18
    max_brightness: 90
    debugging: true

I now have debug log where the current brightness is clearly ignored (see ‘current states’):


2021-04-26 20:38:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:,
 skip_event: True,
 allowance_value: 0.0,
 affected_entities: [],
 last elevation: 2.61,
 elevation: 2.61 (8.5, -18),
 new brightness: 183,
 last brightness: 183,
 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 97}],
 force_turn_on: True,
 force_turn_off: False,
 entities: ['light.woonkamer_led_vide'],
 turn_on_entities: [],
 dim_entities: [],
 turn_off_entities: [],
 Triggered by: event,
  entity_id: ['light.woonkamer_led_vide'],
 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 183, 'transition': 0}},
 service_data_length: 3

This indicate that it will ignore this trigger.

It is triggered by a service call to turn on the light.

I wonder if you get a timing error that i was worried could occur on some installations.

What hardware are you running this on?

It would be interesting to see more logging to understand more what’s going on.

I think you might be correct, looks like I copied the wrong part of the log, there’s two rough duplicates and the other one doesn’t have the skip: true! Here’s more or less the entire context, check for the same timestamp as above:

2021-04-26 20:32:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 3.43 (8.5, -18)

 last elevation: 3.71

 new brightness: 189

 last brightness: 191

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 193}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: ['light.woonkamer_led_vide']

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 3.71, azimuth: 288.41)

 to:   (elevation: 3.43, azimuth: 288.8)

2021-04-26 20:32:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 3.43 (8.5, -18)

 last elevation: 3.43

 new brightness: 189

 last brightness: 189

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 193}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: ['light.woonkamer_led_vide']

 service_data_length: 3

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 189, 'transition': 0}}

2021-04-26 20:34:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 3.16 (8.5, -18)

 last elevation: 3.43

 new brightness: 187

 last brightness: 189

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 189}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: ['light.woonkamer_led_vide']

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 3.43, azimuth: 288.8)

 to:   (elevation: 3.16, azimuth: 289.19)

2021-04-26 20:34:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 3.16 (8.5, -18)

 last elevation: 3.16

 new brightness: 187

 last brightness: 187

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 189}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: ['light.woonkamer_led_vide']

 service_data_length: 3

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 187, 'transition': 0}}

2021-04-26 20:36:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 2.88 (8.5, -18)

 last elevation: 3.16

 new brightness: 185

 last brightness: 187

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 187}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: ['light.woonkamer_led_vide']

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 3.16, azimuth: 289.19)

 to:   (elevation: 2.88, azimuth: 289.58)

2021-04-26 20:36:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 2.88 (8.5, -18)

 last elevation: 2.88

 new brightness: 185

 last brightness: 185

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 187}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: ['light.woonkamer_led_vide']

 service_data_length: 3

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 185, 'transition': 0}}

2021-04-26 20:37:24 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 2.88 (8.5, -18)

 last elevation: 2.88

 new brightness: 185

 last brightness: 185

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 185}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: light.woonkamer_led_vide

 service_data_length: 2

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': 'light.woonkamer_led_vide', 'brightness_pct': 38}}

2021-04-26 20:38:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 2.61 (8.5, -18)

 last elevation: 2.88

 new brightness: 183

 last brightness: 185

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 97}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: ['light.woonkamer_led_vide']

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 2.88, azimuth: 289.58)

 to:   (elevation: 2.61, azimuth: 289.97)

2021-04-26 20:38:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 2.61 (8.5, -18)

 last elevation: 2.61

 new brightness: 183

 last brightness: 183

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 97}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: ['light.woonkamer_led_vide']

 service_data_length: 3

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 183, 'transition': 0}}

2021-04-26 20:40:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 2.34 (8.5, -18)

 last elevation: 2.61

 new brightness: 181

 last brightness: 183

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 183}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: ['light.woonkamer_led_vide']

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 2.61, azimuth: 289.97)

 to:   (elevation: 2.34, azimuth: 290.36)

2021-04-26 20:40:48 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 2.34 (8.5, -18)

 last elevation: 2.34

 new brightness: 181

 last brightness: 181

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 183}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: ['light.woonkamer_led_vide']

 service_data_length: 3

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 181, 'transition': 0}}

2021-04-26 20:42:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 2.07 (8.5, -18)

 last elevation: 2.34

 new brightness: 179

 last brightness: 181

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 181}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: ['light.woonkamer_led_vide']

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 2.34, azimuth: 290.36)

 to:   (elevation: 2.07, azimuth: 290.75)

2021-04-26 20:42:48 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 2.07 (8.5, -18)

 last elevation: 2.07

 new brightness: 179

 last brightness: 179

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 181}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: ['light.woonkamer_led_vide']

 service_data_length: 3

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 179, 'transition': 0}}

2021-04-26 20:44:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 1.8 (8.5, -18)

 last elevation: 2.07

 new brightness: 177

 last brightness: 179

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 179}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: ['light.woonkamer_led_vide']

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 2.07, azimuth: 290.75)

 to:   (elevation: 1.8, azimuth: 291.14)

2021-04-26 20:44:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 1.8 (8.5, -18)

 last elevation: 1.8

 new brightness: 177

 last brightness: 177

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 179}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: ['light.woonkamer_led_vide']

 service_data_length: 3

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 177, 'transition': 0}}

2021-04-26 20:46:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 1.54 (8.5, -18)

 last elevation: 1.8

 new brightness: 175

 last brightness: 177

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 177}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: ['light.woonkamer_led_vide']

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 1.8, azimuth: 291.14)

 to:   (elevation: 1.54, azimuth: 291.54)

2021-04-26 20:46:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 1.54 (8.5, -18)

 last elevation: 1.54

 new brightness: 175

 last brightness: 175

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 177}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: ['light.woonkamer_led_vide']

 service_data_length: 3

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 175, 'transition': 0}}

2021-04-26 20:48:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 1.28 (8.5, -18)

 last elevation: 1.54

 new brightness: 173

 last brightness: 175

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 175}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: ['light.woonkamer_led_vide']

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 1.54, azimuth: 291.54)

 to:   (elevation: 1.28, azimuth: 291.93)

2021-04-26 20:48:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 1.28 (8.5, -18)

 last elevation: 1.28

 new brightness: 173

 last brightness: 173

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 175}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: ['light.woonkamer_led_vide']

 service_data_length: 3

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 173, 'transition': 0}}

2021-04-26 20:50:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 1.03 (8.5, -18)

 last elevation: 1.28

 new brightness: 171

 last brightness: 173

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 173}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: ['light.woonkamer_led_vide']

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 1.28, azimuth: 291.93)

 to:   (elevation: 1.03, azimuth: 292.32)

2021-04-26 20:50:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 1.03 (8.5, -18)

 last elevation: 1.03

 new brightness: 171

 last brightness: 171

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 173}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: ['light.woonkamer_led_vide']

 service_data_length: 3

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 171, 'transition': 0}}

2021-04-26 20:52:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 0.78 (8.5, -18)

 last elevation: 1.03

 new brightness: 169

 last brightness: 171

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 171}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: ['light.woonkamer_led_vide']

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 1.03, azimuth: 292.32)

 to:   (elevation: 0.78, azimuth: 292.72)

2021-04-26 20:52:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 0.78 (8.5, -18)

 last elevation: 0.78

 new brightness: 169

 last brightness: 169

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 171}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: ['light.woonkamer_led_vide']

 service_data_length: 3

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 169, 'transition': 0}}

2021-04-26 20:54:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 0.54 (8.5, -18)

 last elevation: 0.78

 new brightness: 167

 last brightness: 169

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 169}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: ['light.woonkamer_led_vide']

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 0.78, azimuth: 292.72)

 to:   (elevation: 0.54, azimuth: 293.11)

2021-04-26 20:54:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 0.54 (8.5, -18)

 last elevation: 0.54

 new brightness: 167

 last brightness: 167

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 169}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: ['light.woonkamer_led_vide']

 service_data_length: 3

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 167, 'transition': 0}}

2021-04-26 20:56:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 0.3 (8.5, -18)

 last elevation: 0.54

 new brightness: 165

 last brightness: 167

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 167}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: ['light.woonkamer_led_vide']

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 0.54, azimuth: 293.11)

 to:   (elevation: 0.3, azimuth: 293.51)

2021-04-26 20:56:47 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 0.3 (8.5, -18)

 last elevation: 0.3

 new brightness: 165

 last brightness: 165

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 167}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: ['light.woonkamer_led_vide']

 service_data_length: 3

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 165, 'transition': 0}}

2021-04-26 20:58:28 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: False

 allowance_value: 0.0

 affected_entities: ['light.woonkamer_led_vide']


 elevation: 0.1 (8.5, -18)

 last elevation: 0.3

 new brightness: 164

 last brightness: 165

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 165}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: ['light.woonkamer_led_vide']

 

 turn_off_entities: []

 

 Triggered by: state

 from: (elevation: 0.3, azimuth: 293.51)

 to:   (elevation: 0.1, azimuth: 293.84)

2021-04-26 20:58:28 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:

 skip_event: True

 allowance_value: 0.0

 affected_entities: []


 elevation: 0.1 (8.5, -18)

 last elevation: 0.1

 new brightness: 164

 last brightness: 164

 

 current_states: [{'entity_id': 'light.woonkamer_led_vide', 'state': 'on', 'brightness': 165}]

 

 force_turn_on: True

 force_turn_off: False

 

 entities: ['light.woonkamer_led_vide']

 

 turn_on_entities: []

 

 dim_entities: []

 

 turn_off_entities: []

 

 Triggered by: event

  entity_id: ['light.woonkamer_led_vide']

 service_data_length: 3

 complete event data: {'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': ['light.woonkamer_led_vide'], 'brightness': 164, 'transition': 0}}

I’m running this on my own server. Which has a Pentium(R) CPU G4560 with 8GB of memory and an SSD (those are the most important bits I think)

Hi @mukens, in a search I bumped on this blueprint and I have a few questions:

  1. can this be used to only switch on lights at sunset and increase brightness (seems to be reversed brightness), so doing nothing at sunrise?
  2. how could I use a condition, so not run this automatically every evening?

TIA

Yes, you have two independent check boxes. One for switching on the light at sunset and another to switch off the light at sunrise.

There is also a checkbox to reverse the brightness, so it goes from dim to bright when the sun sets.

There are currently no such feature implemented, but that could be added to the blueprint if desired. I’m thinking of a text field that contain a template you can write to decide if it should be run or not.

1 Like

Any idea why this would trigger this automation @mukens ? Only state of sun is supposed to trigger it I tought?

Yes, in order to know when state changes on any of the lights specified, the only way to trigger the automation properly (at least when blueprints were introduced) was to listen to events and more specifically call_service for turn on of the light.

The reason at the time was that if you specified multiple lights, you could not enter the target input as the trigger for some reason.

But why is below automation triggering “your” automation? Any ideas?

It is triggered for all service calls regarding lights (if i remember correctly), but it doesn’t update anything unless the call was for one of the lights specified in the automation.

Also please note that only entities can be selected. If you select areas or devices, the automation will not work.

it would be good if you could set a condition based on the presence of people (using the person entity)

I’ll look into having a custom template input for this.

Hello and thank you for a awesome blueprint, it is my most appreciated one.

However, I have encounter a issue: brightness doesn’t update automatically anymore. I don’t know for how long this have been since the automation haven’t been active during summer, but I notice the other day when the dark is approaching.
The lights are turning on and off as usual according to elevation, I can also see in the log that the updates are coming but without actions. “Run actions” doesn’t trigger the updates either. The lights are only adjusting to correct brightness if I turn off and on the lights.
Change allowance is at 100%, I’m using latest version and don’t have any other automations that triggers the brightness.

Any ideas why this happens?

That’s weird. Seems to work just fine here…
Have you changed anything, new hardware for instance?
Can you see anything in the log file?

Yeah I also find it weird.
Nothing new on hardware.
I tried to get a log from based upon earlier comments made in this thread, but I couldn’t find where the logs are located? Maybe a guide would be helpful to read out logs would be appreciated, if more people than me want to debug this automation.

It’s in the standard home assistant log located in /config and also available via the web GUI. Unfortunately I’m flooded with work atm and don’t have much time to help out. Maybe some other nice user in here could help out finding the logs?

Hello again, for people like me who have not looked into logs before check for keyword “debug” in file editor → config → home-assistant.log

This is from a usual update from the automation, as you can see the allowance is set to 100%:

2021-10-05 21:26:10 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:
skip_event: False
allowance_value: 254.0
affected_entities: [‘light.ikea_e27_light’]

elevation: -22.82 (11, -12)
last elevation: -20.44
new brightness: 50
last brightness: 50

current_states: [{‘entity_id’: ‘light.ikea_e27_light’, ‘state’: ‘on’, ‘brightness’: 33}]

force_turn_on: False
force_turn_off: False

entities: [‘light.ikea_e27_light’]

turn_on_entities: []

dim_entities: []

turn_off_entities: []

Triggered by: state
from: (elevation: -20.44, azimuth: 294.63)
to: (elevation: -22.82, azimuth: 299.34)

This is from when the light is turned from off to on, starting at brightness 38:

2021-10-05 21:08:11 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:
skip_event: False
allowance_value: 254.0
affected_entities: [‘light.ikea_e27_light’]

elevation: -20.44 (11, -12)
last elevation: -20.44
new brightness: 50
last brightness: 50

current_states: [{‘entity_id’: ‘light.ikea_e27_light’, ‘state’: ‘off’, ‘brightness’: None}]

force_turn_on: False
force_turn_off: False

entities: [‘light.ikea_e27_light’]

turn_on_entities: []

dim_entities: [‘light.ikea_e27_light’]

turn_off_entities: []

Triggered by: event
entity_id: light.ikea_e27_light
service_data_length: 1
complete event data: {‘domain’: ‘light’, ‘service’: ‘turn_on’, ‘service_data’: {‘entity_id’: ‘light.ikea_e27_light’}}

2021-10-05 21:08:12 DEBUG (MainThread) [homeassistant.components.blueprint.dim_lights_based_on_sun_elevation] DEBUG:
skip_event: True
allowance_value: 254.0
affected_entities: []

elevation: -20.44 (11, -12)
last elevation: -20.44
new brightness: 50
last brightness: 50

current_states: [{‘entity_id’: ‘light.ikea_e27_light’, ‘state’: ‘on’, ‘brightness’: 38}]

force_turn_on: False
force_turn_off: False

entities: [‘light.ikea_e27_light’]

turn_on_entities: []

dim_entities: []

turn_off_entities: []

Triggered by: event
entity_id: [‘light.ikea_e27_light’]
service_data_length: 3
complete event data: {‘domain’: ‘light’, ‘service’: ‘turn_on’, ‘service_data’: {‘entity_id’: [‘light.ikea_e27_light’], ‘brightness’: 50, ‘transition’: 0}}

Could it be related to the skip_event flag, I don’t know what is does? For some reason the entity is not put into the dim_entities array. This goes for both IKEA E27 and GU10 bulbs if its relevant.