Howto round Temperature Sensor values

Posted on
Fri Jan 27, 2017 7:47 am
Umtauscher offline
User avatar
Posts: 566
Joined: Oct 03, 2014
Location: Cologne, Germany

Howto round Temperature Sensor values

Hi,

I am searching for a way to round temperature sensor values. I find it useless to get a temperature value of 23.45 °C from a sensor when I know 0.1 °C is the best accuracy I could get.
So is there a way to round e.g. temperature values when they are sent by the sensor?
BTW I only use z-wave so maybe a trigger on incoming z-wave command would do the trick?
I just don't know how to do it. Any ideas?
Thanks in advance

WIlhelm

Posted on
Fri Jan 27, 2017 9:25 am
RAID5 offline
Posts: 104
Joined: Jan 16, 2015
Location: Sweden

Re: Howto round Temperature Sensor values

Hi

This might not be the best solution but it works

I created a trigger that triggers on temperature change on the sensor device
In the trigger I have three actions
1. Copy the sensor value to a variable (Insert Device State into Variable(Variable Actions))
Variable "CPV1_Indoor_Temp_Interim"

2. Execute a applescript that rounds of the temperature value
tell application "IndigoServer"
set a to value of variable "CPV1_Indoor_Temp_Interim"
set the value of variable "CPV1_Indoor_Temp_Interim" to round (a)
end tell

3.Depending on how you use the value this might not be necessary
I do this last step because I show this variable on a Control panel that is shown 27/4 in my kitchen and I don't want it to flicker every time it recalculates the vale
This step copy (Set variable to variable(variable action)) the variable to a new variable that i show on my Control panel page

RAID5 "A happy Swede addicted to automation"

Posted on
Fri Jan 27, 2017 11:19 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Howto round Temperature Sensor values

Couldn't you use the Adapters plugin for this?


Sent from my iPhone using Tapatalk

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Fri Jan 27, 2017 1:59 pm
Umtauscher offline
User avatar
Posts: 566
Joined: Oct 03, 2014
Location: Cologne, Germany

Re: Howto round Temperature Sensor values

Sorry Adapters plugin? What is that?

I have more than 20 sensors, so I don't want to have redundant code for every sensor.
I was hoping for a more generic solution.
Cheers

Wilhelm

Posted on
Fri Jan 27, 2017 3:22 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Howto round Temperature Sensor values

Umtauscher wrote:
Sorry Adapters plugin? What is that?

Hi Wilhelm, it's a plugin that allows you to create Indigo devices to convert values for many different purposes, including changing the precision of a value or converting a value (say, from Fahrenheit to Celcius). It's incredibly cool and extremely useful. For example, I wanted all my control page temperature values to be of the same precision and followed by ºF, so I create adapters only for those values that don't meet my preferred style. I have a special folder that I use when I create one so that they're all in one place.

http://forums.indigodomo.com/viewtopic.php?f=134&t=15793&hilit=adapters+plugin

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sat Jan 28, 2017 7:29 am
Umtauscher offline
User avatar
Posts: 566
Joined: Oct 03, 2014
Location: Cologne, Germany

Re: Howto round Temperature Sensor values

Thanks for the hint and the explanation.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests