My goal is to turn on different lights at different natural sun light intensity, as opposed to by what time of day it is.
I am not sure my approach using scenes is the best solution.
So far I made four different scenes; morning, daytime, evening and night, and four additional scenes for setting brightness for the same lights when motion is detected (dim up the light).
- name: gang_morgen
entities:
light.lys_gang_level:
state: on
brightness: 25
- name: gang_morgen_motion
entities:
light.lys_gang_level:
state: on
brightness: 75
Additionally I use one exterior light sensor to set the state for two sensors dark_inside
and dark_outside
. These are used in automations (see below).
sensor:
dark_inside:
entity_id: sensor.pir_ute_paviljong_luminance
friendly_name: Mørkt innendørs
value_template: >-
{{ states('sensor.pir_ute_paviljong_luminance')|float < 400 }}
dark_outside:
entity_id: sensor.pir_ute_paviljong_luminance
friendly_name: Mørkt utendørs
value_template: >-
{{ states('sensor.pir_ute_paviljong_luminance')|float < 15 }}
automation:
trigger:
- platform: state
entity_id: sensor.dark_inside
to: 'False'
for: '00:02:00'
- platform: time # This is to make sure daytime is set at winter even if the sun is not up
at: '08:00:00' # Then we can still trigger light using luminance on top of day mode.
Can this be done in a more effective and code-neat way?
Any ideas and thoughts are most welcome