Ideas needed for calculating the impact of cloud cover

Hi.

In my goal of making dynamic indoor lighting with a script (HERE) i need some ideas on calculating the impact of cloud cover.

Credit for the “Above Cloud Lux” sensor goes to: @Kobold Here

Below, the cloud cover have direct impact from 0% to 100%, so when cloud cover is 100% it’s “dark”, but depending on the “amount” of sunlight above the clouds that’s not always the case.
So even though cloud cover is 100% the amount of outside light can still be enough for the inside lights to not turn all the way up.

First i have three sensors serving values depending on “Above cloud lux”:
The 0.05 in interior_lux is the 5% percent of the Daylight Factor taken from here.

sensors:
  above_cloud_lux:
    friendly_name: "Above Cloud Lux"
    unit_of_measurement: "Lux"
    value_template: '{{ states.sun.sun.attributes.daylight | round(0) }}'
  exterior_lux:
    friendly_name: "Exterior Lux"
    unit_of_measurement: "lux"
    value_template: '{{ ((100-states.sensor.vejret_cloudiness.state|float)/100 * states.sun.sun.attributes.daylight) | round(0)  }}'
  interior_lux:
    friendly_name: "Interior Lux"
    unit_of_measurement: "lux"
    value_template: '{{ (0.05 * (states.sensor.exterior_lux.state | float)/10) | round(2) }}'

Then i have an automation which calls the script:

action:
  - service: script.light_brightness_up
    data:
      override: 'gang'            # My override, so the light can kept on/off manually
      light: 'group.gang_paneler' # The lights that needs to be turned on 
      transition: 1               # The transition time.
      area: 20                    # The square meters of the room.
      sum_lux: 5400               # The sum of lux of all the fixtures/bulbs.
      wanted_lux: 250             # The amount of lux wanted in the room.

My value_template look like this (syntax maybe wrong, I have not tested it with variables):

value_template: '{{ (( {{wanted_lux}} - (states.sensor.interior_lux.state)) / (( {{sum_lux}} / {{area}} ) / 254)) | round(0)|int }}'
value_template: '{{ ((250-(5.02))/((5400/20)/254)) | round(0)|int }}'

(The 254 is the “steps” my Tradfri lights can handle)

So any ideas of how to calculate the real impact of cloud cover is much appreciated!

Sincerely,
Jeppe Nielsen

1 Like

This could be done a lot easier with a cheap BH1750 lux sensor:

The biggest problem with your cloud cover idea is it that it does not take into account the type of cloud. 100% cumulonimbus is going to have a bigger effect than 100% altostratus.

Yes. Or other hardware sensors. That’s not the point. Thanks though. :wink:

1 Like

You cant get the information you want purely from a cloud cover measurement. It does not tell you the how thick the clouds are and this will have an effect on the light level. In some cases cloud cover can actually increase the light level, e.g. a towering thunderstorm to the west reflecting light in the morning. Have a read of the conclusions in this (pdf):

https://rmets.onlinelibrary.wiley.com/doi/pdf/10.1002/joc.2432

In particular, paragraphs 6.5, 6.8 and 6.9.

1 Like

I considered going down a similar path regarding adjusting my lights based on other factors for the effect of outside light level rather than purely sunrise / sunset however due to the position of the sun at different times of day, rooms may or may not need an internal light to be switched on so I’m going with lux levels from my aeotec multisensors instead. That way the kitchen light can be switched on automatically despite the afternoon sun providing adequate light to my bedroom for example.

Yep, if you want light level, it seems to be more sensible to measure it, rather than guess it, particularly as measurement is so simple these days.

@tom_l:
I’m aware that a theoretical approach is not a stable one, but i just need to feed a brightness value to my lights from 1 to 254, therefore it should be possible to hit a value that suits the room.
Hardware sensors for lux or “AIO” sensors which are powered are not an option at this time.

@sparkydave:
I know that, but i fundamentally don’t wanna chew through batteries on my sensors, and powering them, well, that’s a project for another day.

@nickrout:
Measurements are simple, yes. If I can wire my sensors up so they don’t consume batteries, which, as above, is a project for another day.

Thank you all for your replies! Much appreciated! :+1:

@skeptizzle What kind of values are you getting from your sensors.
Currently my readings are:

sensor.above_cloud_lux: 68653
sensor,exterior_lux: 61788
sensor.interior_lux: 308.94

Also what value is considered “light” and what value is “dark”?

My configuration is as follows:

  - platform: template
    sensors:
      above_cloud_lux:
        friendly_name: "Above Cloud Lux"
        unit_of_measurement: "Lux"
        value_template: >-
          {{ states.sun.sun.attributes.daylight | round(0) }}

      exterior_lux:
        friendly_name: "Exterior Lux"
        unit_of_measurement: "lux"
        value_template: '{{ ((100-states.sensor.dark_sky_cloud_coverage.state|float)/100 * states.sun.sun.attributes.daylight) | round(0)  }}'

      interior_lux:
        friendly_name: "Interior Lux"
        unit_of_measurement: "lux"
        value_template: '{{ (0.05 * (states.sensor.exterior_lux.state | float)/10) | round(2) }}'

The time is now 6:31AM here, and my above cloud sensor reads 13742 and because my cloud cover is 100% my exterior lux reads 0 therefore my interior lux reads 0.0.
Even though interior lux reads 0.0, there is some kind of light inside, I would guess maybe 50-100. So my lights would go full on instead of taking the 50-100 lux already there into account.
You can find recommended lux levels on Google.

The Weather underground component has a solar radiation sensor, I use it to get the light in my neighborhood and it works great. It works better the closer someone has a personal weather station to you, obviously.

Could you give an example on how it’s setup, like how are you using it?

Cheers!

Mine is simple. I’m using node-red now, but sometimes it’s darker earlier because of storms or clouds. So at 6 hours before sunset, a node (LightScheduler) arms another node (Stoplight). Then, it checks the pws_solarradiation sensor every 5 minutes, and when that sensor falls below 30 W/M2, it turns on the lights.

I like this because it is tied to the actual amount of light available, not just the sunset time. Lights tun off when we go to bed, so it is only used to turn them on in the afternoon/evening (and only if we’re home or vacation mode is on, but that is another whole thing)