Help Creating Virtual Temp Sensor (+Sun Calc)

Hi All,

I have been using the awesome suncalc driver (essentially creates a device that reports azimuth and elevation of the sun) to automate some of my blinds - very simply to close them when the sun gets to a certain position and it is 'hot'.

I have a 2 x Hue Outdoor Motion Sensor - 1 at the front of the house, and 1 at the back.

I'd like to use them as outdoor temperature sensors, but the issue I have is they are nonsense (for my need) when the sun is directly on them.

That got me thinking, can I create a 'Virtual' Temperature sensor that pulls the Temperature reading from one or other of the Sensors, depending on the sun position? Thus creating a single, more reliable Temp Sensor I can query/reference in rules?

I'm sure that is possible, But I have no idea how I would create it!

Simply:

If sunposition is between x&y, Virtual Sensor = Front Sensor
if sunposition is between a&b Virtual Sensor = Back Sensor

and if we wanted to be really clever:

if sun position is between c&d (middle ground), Virtual Sensor = Average of Front and Back Sensor

Am I a wild fantasist, or should this be possible?

1 Like

Should be simple enough to do using RM - I'd personally use 3 rules, but it could be done in less.

Not the same as a trigger when "hot" but another way to do it is through the illuminance measured by a weather station. In other words, how bright is the sun shining?

I have an Ambient Weather WS-2000 in the back yard, and among the several dozen variables/states it passes along is "illuminance". This is measured in w/m^2.

You will have to tune the trigger value to define "sunny". I'm still tweaking mine, but I've been on hubitat only for about two weeks now and some days it has been cloudy all day. I've settled on 400 for now, but may go higher, as that can be kind of bright, but still no direct sun (cloudy).

The Suncalc virtual device ("The Sun") is part of the defined required expression in RM. In other words, the sun has to be greater than the azimuth where the sun starts to hit that side of the house (which changes every day of course) before the trigger is evaluated.