Time dependant temerature sensor

I have 2 temperature sensors outside on different sides of my house. About half of the time the sun shines on one of them, and the other half it shines on the other. I want to have a sensor which shows the temperature from the one that do not have the sun shining on it. The timings of the sun I have, so that is sorted. Anyone know how to solve this?


I have the same, the easy way is to just use the lowest reading.


That’s what I was going to suggest :+1:

This is a classic! LOL

OK. I will solve this another way then.

Okay you want this the ‘hard’ way.?
So you chose your flip-flop method of choosing sensors
(I’d go with sun azimuth (say) sun >= 76 or azimuth <= 256)
Then you have an ‘east’ is true
So : -
{{ states(‘sensor.1’) if east else states(‘sensor.2’) }}

Cast both to float if you need to (you shouldn’t need it)

Seriously, use the lower one. Create a template sensor that takes the minimum of the two real sensors and use that.

The Stevenson screen is also a good idea: I have a 3D-printed one for my single sensor. It almost eliminates the sun effect.

Aaah - That’s not hard. Thanks.

Also very easy to make a diy Stevenson screen out of a few plastic bowls or planter dishes.

You should post your resultant code to the thread and mark the post that helped you most as the solution.

But, to everyone else coming to this thread

The easy minimum of the two would have been : -
"{{ [ states('sensor.1') | float , states('sensor.2') | float ] | min }}"

The sensor (as duckboot wanted it, though he hasn’t specified his method of choosing, and ‘times’ won’t cut it as sun position is not reliable just on a time value) should finally end up something like : -

{% set azi = state_attr('sun.sun', 'azimuth') | float %}
{% set nrthwall = 26 %}
{% set sthwall = 206 %}
{% set temp1 = states('sensor.1') %}
{% set temp2 = states('sensor.2') %}
{% set east = nrthwall <= azi <= south %}
{{ temp1 if east else temp2 }}

I guess some peoples DIY skills aren’t upto building a screen, they don’t have somewhere to place it or the time involved just means its cheaper to buy another sensor

Uuuh - Toxic.
Well - I went down the Node-Red road and used node-red-contrib-sun-position and a compass for making my calculations. Pretty decent for a guy which “DIY skills arn’t upto building a screen”. (And the extra temp-sensors I did get for free, so…)

Sorry, you misunderstand, I was merely stating for general information why somebody would want to do as you did and not build a ‘special box’
I did not intend to criticise you in any way merely explain possible motivations.

And who can resist free ?

No worries. I love it when internet-discussions go down the drain. After spending my professional and spare time on the internet since about 1994 I’m not easily offended in any way. I’ve probably seen and experienced it all. And agreed - Free is good. (I work at a company which have FOSS as a core value)

As an update, I now do this myself and here’s a plot showing how important it is:


Sensor 1 is on the east side of my garage, and is in a proper screen, yet still experiences significant over-reading in sunlight. Sensor 2 is on the west side of my garage in a black box to make it inconspicuous (this is the front of the house).

Yesterday was a sunny day, and you can see the effect on the east-facing sensor in the morning and the west-facing sensor in the afternoon. I take the minimum of the red and green plots as my combined outside temperature sensor.

1 Like