Converting Farenheit to Celsius

Posted on
Mon Feb 21, 2022 7:45 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Converting Farenheit to Celsius

I've written a script that does the conversion, but I can't get the result rounded. I've guess and checked with no success. I hope there is a simple suggestion.
Thanks,
Bob
Code: Select all
#converts 2nd fl temp F into 2nd fl temp C

tempF = indigo.variables[1594639582].getValue(float)
tempC = (tempF - 32) * 5/9
round(tempC, 1)
indigo.variable.updateValue(848160350, value = str(tempC))

# the calculation above for tempF of 67.0 produces tempC of 19.444444444; hoping for 19.4

Posted on
Mon Feb 21, 2022 8:18 pm
DaveL17 offline
User avatar
Posts: 6751
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Converting Farenheit to Celsius

You're very close. Your line
Code: Select all
round(tempC, 1)
needs to carry its result on to the last line.
Code: Select all
tempC = round(tempC, 1)
ought to do it.

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

[My Plugins] - [My Forums]

Posted on
Tue Feb 22, 2022 5:54 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: Converting Farenheit to Celsius

Makes sense - and it works.
Thanks for not giving up on me.

Posted on
Tue Feb 22, 2022 6:43 pm
DaveL17 offline
User avatar
Posts: 6751
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Converting Farenheit to Celsius

SMUSEBY wrote:
Makes sense - and it works.
Thanks for not giving up on me.

Glad to help.

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

[My Plugins] - [My Forums]

Posted on
Tue Feb 22, 2022 6:52 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: Converting Farenheit to Celsius

Maybe this little project of mine will inspire you to make the Ecobee thermostat compatible with Celsius?

Posted on
Tue Feb 22, 2022 7:45 pm
DaveL17 offline
User avatar
Posts: 6751
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Converting Farenheit to Celsius

The plugin(s) that work with Ecobee aren't mine. :wink:

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

[My Plugins] - [My Forums]

Posted on
Tue Feb 22, 2022 7:57 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: Converting Farenheit to Celsius

You're right - I thought I was getting help from Flying Diver - as the icon is his as well? Are you messing with me? - or am I having some kind of massive memory issue?

Posted on
Tue Feb 22, 2022 8:02 pm
FlyingDiver offline
User avatar
Posts: 7211
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Converting Farenheit to Celsius

SMUSEBY wrote:
Maybe this little project of mine will inspire you to make the Ecobee thermostat compatible with Celsius?


It works fine with Celsius now. I fixed that last year. At least, no one that uses Celsius has reported any issues.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Feb 22, 2022 8:05 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: Converting Farenheit to Celsius

good to know.
I'll give it a try - and then toss the little script I just did.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests