Outdoor luminance/lux without Nest Weather


#1

1) Give a description of the problem
I used to have a lot of automations that used the local lux outside gathered from Nest Weather (the virtual ST device NST Manager made). That has always been dodgy as I often found the Nest sync had broken and I stopped using it for a while. I need it again and Nest isn’t a reliable basis for anything in the long term. TWC doesn’t offer lux or solar radiation. How do people get outside light levels without having your own station to poll/how do you know it is dusk/dark (without relying on sunset as darkness varies depending on cloud cover so it’s a guess at best using sunrise and sunset (that is of course my fall back but I’d like it to be a bit more responsive to long summer nights and cold dark winter ones)

2) What is the expected behaviour?
Return integer value (I assume)


#2

Lux changes so frequently, that no triggers exist, but we can create conditions using $twcweather.

Sample conditions with sample outputs::

$twcweather.conditions.cloudCeiling
null, 100, 2100, 8500

$twcweather.conditions.cloudCoverPhrase
“Clear”, “Partly Cloudy”, “Mostly Cloudy”, “Cloudy”

$twcweather.conditions.uvIndex
0 - 16

$twcweather.conditions.visibility
16.09

$twcweather.conditions.wxPhraseLong
There’s many examples here, so it may be tough to code this last one


Just keep in mind that these are recorded at a weather station somewhere in your city, so it will not capture a cloud as it passes your house.


Pro Tip:

If you want lux to be a trigger (and/or more accurate for your exact location), then I would recommend an inexpensive lux sensor and keep it out of direct sunlight and away from moving trees or shadows. (more info here)


#3

You can also try the Accu-Weather plugin for webCoRE.
It is pretty decent for cloud coverage, UV and more…

You can test this plugin by loading the ST app on your phone, and going to:
Market Place > Smart Apps > Climate Control > AccuWeather Connect

This Simulated device gathers a bunch of data, but the most likely parameters for your project are:

uvIndex: 0-16
cloudCover: 0-100

Two caveats:

(1) From what I have seen, AccuWeather does not update as frequently as WUnderground did.

(2) Accu-Weather is based on zip code, so not nearly as precise as a local sensor. (see my last post)


#4

Thanks I’ll try accuweather. I only need to know if it’s dusk/dark so it doesn’t have to be accurate - it will be dusk/dark at about the same time across the whole region.

I don’t think conditions will help as I have too many combinations if I try to mix that with,say,uv. (0 UV, 1 UV and Partly Cloudy, 2 and Mostly Cloudy etc)

Lux worked/works fine as a trigger currently as I just do a <= to catch as it gets dark. It’s rapid change isn’t a problem like this.

I could get a light sensor but that’s yet more money spent and I already have a backlog of things to buy (aeotec needs to have another sale!) - but that again feels like overkill to know if it’s getting dark

I might see at what point in the day UV becomes <=1 and see if that catches dusk better than using sunset +/- (something appropriate to each month)


#5

I have not seen your piston, but it sounds more like a condition, not a trigger.
(exposed to sunlight, a true lux trigger will execute a piston thousands of times each day)


Oh. I thought you wanted it adjusting based on real time events (giant cloud, fog, storm, etc)

If you want to base it on the amount of sunlight that should be reaching us, have you considered basing it on the altitude of the sun?

The lower the sun is, the less light that reaches us… and the time of day that a certain threshold is crossed can be very different throughout the year… That piston estimates (with surprising accuracy) how high the sun is above the horizon at any given moment.

The piston is quite complex, but the resulting data can be stored in a @global variable, making it easy to program other devices to automate at more precise times.

IE: IF @sunAltitude drops below 8 degrees, then turn on porch light

My approach may be unconventional, but it is truly one of my masterpieces…


Edit for later reference:

If we make a fist, and extend it at arms length, then we can “fit” about 20 suns strung together in a straight line. (10° fist / 0.5° sun diameter = 20) So my example above (8° or 4.4% of the sky) is about 16 diameters, or 80% of your fist’s width. (of course, it’s totally customizable per household or device)

Or as this beautiful pic (poorly) demonstrates, the piston fires whenever the sun drops below that 8° line.

(yes, that’s a pic of the moon, but they both have a similar size diameter (from our point of view) and the moon is a whole lot easier to look at in an example, LOL)


#6

Good god, you can be proud of that! It’s a complex way to solve the problem but I like it. I need to adjust it for UK but I can cope with that

(And yes good point condition not trigger)


#7

Thanks!

The UK is entirely in the “acceptable” zone.
(IE: it works well for you blokes across the pond :grin:)

Mine is currently refreshing the data every ten minutes… with the sun’s altitude changing about 1.5 degrees each time. (changing slightly each day, of course)


Edited last post to add more detail (and a pic).