Turn on lights depending on cloudiness

Hi all, I’m fairly new to Node-Red, I’m trying to make a sequence where I turn on a group of lights depending on how cloudy it is outside.
So, basically:
If t’s over 90% clouds turn lights on 3h before sunset.
80% 2,5h before…
70% 2h…
60% 1,5h…
50% …
You get it…
Ending on if 0% lets say 15 minutes before sunset.
The ultimate would be to “calculate” the time “before sunset” to turn on the lights depending on coverage…

Is there anyone out there who have done this?

Best regards Erik

Pretty sure that can be done with a function node that outputs when the calculated time has come and does not output otherwise. However, why not deploy a simple illuminance sensor with a threshold? Cloud coverage is hard to measure or predict and I guess the brightness variation high summer / high winter is dramatic, illuminance measurement is drop dead simple.

I would agree, you’re probably not going to get great results with what your approach.

However, I would start with using something like:

  • bigtimer node to trigger at your worse case time (sunset -3hrs.
  • Followed by however you get the cloud cover feeding into a Range node to map 0 - 100 (cloud cover) to 150-0 (delay value)
  • Feed this into a delay node, setting the relevant property to get the delay value from msg.delay (you will likely need a Change node to set the msg.delay from msg.payload.

The logic being this is that the with 100% cloud cover, there will be no delay, hense the light will turn on at sunset.

HI, thank you for the answer! Yes, I have thought about it. The problem being for me that I don’t have a good location to put it. Either it’s light from the street or out own outside lighting. And putting it in the chimney is not an option… Yet… :slight_smile:

Thank you, I had something like that in mind, but I hoped for a better solution. Lot’s can happen in 3 hours… :slight_smile: