Outdoor illumination as a trigger?

Not even sure if this is possible…

I have an automation that turns the kitchen light on at the later of 7:00 pm or sunset. I was shown two ways to do this – one involved writing a template sensor and the other involved two triggers and two conditions. Out of laziness, I opted for the second approach and it works fine.

The reason I am turning on the light in the manner described is so that the light is on in the kitchen when we want to use it. Interestingly, it was cloudy/rainy here the other day and the kitchen was rather dim after 7:00 pm but before sunset. So, I am wondering if it is possible to add a third condition to the above two that basically says if the time is after 7:00 pm and the outside brightness level is below some level, then turn on the light? If this is possible, is some type of illumination sensor required or can this information be obtained somehow?

here is a template sensor you can use (not mine, I stole it…):

  - platform: template
        friendly_name: It Is Dark Outside
        value_template: >
          {% if (state_attr('sun.sun', 'elevation') | int < -2) %}
          {% elif (state_attr('sun.sun', 'elevation') | int < 1) and (states('sensor.dark_sky_cloud_coverage') | int > 80) %}
          {% elif (state_attr('sun.sun', 'elevation') | int < 2) and (states('sensor.dark_sky_cloud_coverage') | int > 85) %}
          {% elif (state_attr('sun.sun', 'elevation') | int < 3) and (states('sensor.dark_sky_cloud_coverage') | int > 95) %}
          {% else %}
          {% endif %}

you just need a sensor that gives cloud coverage data.

I can’t tell you how accurate it will be since “it’s dark” is subjective so you’ll need to play with the numbers.

Ha! This is how it starts! Welcome to the (wonderful) rabbit hole of home automation. Believe me, this won’t be the last time you experience “I could really improve my automation if I just had a better sensor that did x…”

As suggested above, you can use a weather app to glean what you need reasonably well. Or there are Zwave or Zigbe sensors that include luminance output. Or you could go the full Personal Weather Station route. Or you can go the ESP device route if you want to make your own.

The choice is really a function of your budget and interest in tinkering/playing. Enjoy!

I just checked my weather integrations for this (dark sky and national weather service), and also looked out the window. They both say 100% cloud coverage, and out the window I see big swaths of blue sky. Yesterday it was 100% as well, and that was truly dark and dismal day where the interior lights were indeed needed.

All that to say, with my n=1 (or 2?), I would not bother fussing around with any synthesized brightness calculations, and just get a luminance sensor. I have one for the interior and one for the exterior ( HomeSeer HS-FLS100+), although the exterior one is a bit underwhelming as it is basically at max brightness all day, and then suddenly drops to 0 brightness in the course of about 10 minutes. It reads max brightness all day except for on very very dark days.

I agree, the simplest way is to install a 10€ Ikea Vallhorn motion and luminance sensor outside (but protected from rain)