# 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.

2 Likes

Thatās what I was going to suggest

This is a classic! LOL

sigh
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