Calculate average temperature ds18b20

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Kudryash
New user
Posts: 2
Joined: 19 Mar 2020, 16:47

Calculate average temperature ds18b20

#1 Post by Kudryash » 19 Mar 2020, 16:58

Hi, I'm from Russia, I apologize for my poor English. :)
Need your help.
I need to add the temperature of two ds18b20 sensors and divide by 2 to get the average temperature.
temp1+temp2/2=?
Thanks !

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Calculate average temperature ds18b20

#2 Post by TD-er » 19 Mar 2020, 17:38

You can do this in the rules and assign them to a dummy task.
See: https://espeasy.readthedocs.io/en/lates ... skvalueset

Kudryash
New user
Posts: 2
Joined: 19 Mar 2020, 16:47

Re: Calculate average temperature ds18b20

#3 Post by Kudryash » 19 Mar 2020, 17:48

Thank you, I found an example here on the forum and tweaked it a little.
Works.

Code: Select all

On System#Boot do
  timerSet,1,3
endon
On Rules#Timer=1 do
 TaskValueSet,12,1,[ds18b201#temp1]/2+[ds18b202#temp2]/2
 timerSet,1,3
endon

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 90 guests