Any ideas for turning lights on when its dark outside during the day

We have controlled lights in our living space. They come on automatically when the sun is down (until bedtime anyway), but I’m looking for a way to switch them on during the day if it’s dark outside due to (etc) cloud and then off again when it brightens up. I’ve looked to see if there is anything in the openweather integration, but can’t anything suitable.

I use a light sensor for this sort of thing.

Any suggestions? I have zwave and zigbee to play with.

I use a mix of Aqara and Tuya zigbee sensors. All seem to work well.

Many of the motion detectors use light sensors. I use the Zooz zse40 as a light detector, I also use the humidity and temperature sensors, don’t use the motion detection. The Zooz was a good price, but I know there are many other light detectors. This one is Indoor, but I use it outside on a covered patio, works fine.

Don’t remember where I found this template but it creates an illumination sensor which you can then use in your automations

- platform: template
  sensors:
    illuminance:
      value_template: >-
        {%- set elevation = state_attr('sun.sun','elevation') | float(0) %}
        {%- set cloud_coverage =  states('sensor.openweathermap_cloud_coverage') | float(0) %}
        {%- set cloud_factor = (1 - (0.75 * ( cloud_coverage / 100) ** 3 )) %}
        {%- set min_elevation = -6 %}
        {%- set max_elevation = 90 %}
        {%- set adjusted_elevation = elevation - min_elevation %}
        {%- set adjusted_elevation = [adjusted_elevation,0] | max %}
        {%- set adjusted_elevation = [adjusted_elevation,max_elevation - min_elevation] | min %}
        {%- set adjusted_elevation = adjusted_elevation / (max_elevation - min_elevation) %}
        {%- set adjusted_elevation = adjusted_elevation %}
        {%- set adjusted_elevation = adjusted_elevation * 100 %}
        {%- set brightness = adjusted_elevation * cloud_factor %}
        {{ brightness | round }}
      unit_of_measurement: '%'
1 Like

ESPHome, Wemos D1 Mini, and BH1750 light sensor for the win.
Many example threads here, VERY simple to assemble.

I use an Aeotec Multisensor 6 (Z-Wave) on my back porch. Works great and has sensors for motion detection, temperature and humidity in addition to illuminance (lux). I use it in plugged in mode so I don’t have to mess with replacing the battery. It’s very easy to make an “It’s dark out” threshold sensor based on the illuminance value.

Thanks. I’ll take a look.

I use the output from my solar panels to detect light levels. It’s not linear, but I just looked at the output at each desired level and I automate on that