Need help to convert Celsius to Fahrenheit

Posted on
Mon Jul 02, 2012 1:07 am
hwitten offline
Posts: 627
Joined: Dec 26, 2007
Location: British Columbia

Need help to convert Celsius to Fahrenheit

I thought I saw a sampling some time ago, but am not having any luck to find it now that I need it :)

I want to convert an Indigo_var_celsius to Indigo_var_fahrenheit

I used to convert in my App but since I moved away from that I want to do it in an action using applescript or python.

A pointer to where I can find a sampling or a sampling is very much appreciated.

Heinz

Posted on
Mon Jul 02, 2012 9:01 am
jay (support) offline
Site Admin
User avatar
Posts: 18216
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Need help to convert Celsius to Fahrenheit

I found this python code with a quick search:

Code: Select all
fah = (cel * (9.0/5.0)) + 32

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Jul 02, 2012 9:37 am
hwitten offline
Posts: 627
Joined: Dec 26, 2007
Location: British Columbia

Re: Need help to convert Celsius to Fahrenheit

Thanks Jay,

Time to jump into the Python pond :)

Posted on
Mon Jul 02, 2012 10:19 am
jay (support) offline
Site Admin
User avatar
Posts: 18216
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Need help to convert Celsius to Fahrenheit

C'mon in - the water's fine.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Jul 02, 2012 11:25 am
johnpolasek offline
Posts: 911
Joined: Aug 05, 2011
Location: Aggieland, Texas

Re: Need help to convert Celsius to Fahrenheit

Actually, that line of code would work in either Python or Applescript; the differences are all in getting "cel" out of a variable string or device state and then trimming/rounding "fah" and getting it back into a string to store and/or display.

Posted on
Mon Jul 02, 2012 9:28 pm
hwitten offline
Posts: 627
Joined: Dec 26, 2007
Location: British Columbia

Re: Need help to convert Celsius to Fahrenheit

Survived my first "swim".
Perhaps not the most stylish, but it works :)
Code: Select all
celsiusVar = indigo.variables[26618308]
tempVar = celsiusVar.getValue(float, default=75.0) # Alarms as HOT if it can't be converted
indigo.variable.updateValue(836995441,str(tempVar * 9/5 + 32))
indigo.variable.updateValue(894772009,str(tempVar * 9/5 + 32))


Thanks for the "push" Jay.

Posted on
Mon Jan 18, 2016 8:32 pm
thomasw offline
Posts: 135
Joined: Feb 13, 2011

Re: Need help to convert Celsius to Fahrenheit

BEWARE: Fibaro advertises on their website and on the product boxes for the US versions of the FGK-101 (door,window, and temp sensor if you ad the DS18B)
and the new FGMS-001 Motion Sensor (motion, light, temperature) that they display Fahrenheit. This is TOTALLY FALSE!
FIbaro is misleading US customers with this. When contacted, they said they "assume" you are going to use
"their" home automation control unit, (instead of Indigo).
BUT, note, the actual devices listed above will ONLY display in Celcius to Indigo. The only option we have is to use a
Python Script in Indigo to do a conversion and send it to a Variable to get Temp readings in Fahrenheit.
The Python Script conversion works well
BUT, that will only put the converted Fahrenheit reading in the Variable window, it will NOT display
in Fahrenheit in the main Indigo device window. (it still shows in Celcius there).
Fibaro has been called out on this misleading advertising for their so called "US versions" of these sensors, but they
still haven't changed the sensor's code or their misleading advertising to US customers. .
Fibaro needs to do the right thing and set the "US version" to display in Fahrenheit, so Indigo doesn't have to "fix" their problem.

Posted on
Mon Jan 18, 2016 8:42 pm
Bollar offline
Posts: 528
Joined: Aug 11, 2013

Re: Need help to convert Celsius to Fahrenheit

thomasw wrote:
BEWARE: Fibaro advertises on their website and on the product boxes for the US versions of the FGK-101 (door,window, and temp sensor if you ad the DS18B)
and the new FGMS-001 Motion Sensor (motion, light, temperature) that they display Fahrenheit. This is TOTALLY FALSE!

Yeah, the motion sensor is really nice and inconspicuous, but the Celsius-only reporting is an annoyance.

Insteon / Z-Wave / Bryant Evolution Connex /Tesla / Roomba / Elk M1 / SiteSage / Enphase Enlighten / NOAA Alerts

Posted on
Tue Jan 19, 2016 8:35 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Need help to convert Celsius to Fahrenheit

Sounds like a plugin might be useful here?

Create a plugin temperature device, select any device in Indigo that supports temperature (C or F) and trigger on any update, and update the state of the device including display value to the opposite conversion.

Use this device on control pages and further triggers instead of original or variable.


Sent from my iPhone using Tapatalk

Posted on
Tue Jan 19, 2016 10:31 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Need help to convert Celsius to Fahrenheit

As useful a plugin/script would be for this kind of scenario it'd be lovely if it were just baked into the indigo UI... A global preference for F or C.

Or of course just get everyone to use C° ;). *flees*

Computer says no.

Posted on
Tue Jan 19, 2016 10:34 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Need help to convert Celsius to Fahrenheit

Hehe!

I agree, but it's not gonna be in 6.next which is coming before 7.invented

Should we all settle on degrees in kelvin?


Sent from my iPhone using Tapatalk

Posted on
Tue Jan 19, 2016 11:35 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Need help to convert Celsius to Fahrenheit

How about Romers? That's a measurement of temperature isn't it?


Sent from my iPad using Tapatalk

Computer says no.

Posted on
Tue Jan 19, 2016 2:06 pm
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Need help to convert Celsius to Fahrenheit

I agree that Celsius is by far the most logical and best choice :D

However, we do get confused in the UK :?

For those of us in the UK: Do you notice how the UK Newspapers always use centigrade when it is going to get cold (e.g the temperature will drop to -10 in Scotland ) but when it gets really hot they use Fahrenheit (e.g. the temperature will hit the 90's on the South Coast)!

Posted on
Tue Jan 19, 2016 2:34 pm
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Need help to convert Celsius to Fahrenheit

Yeah I've noticed that. Of course we aren't completely metric.. We still use miles for distance. That needs to change.


Sent from my iPad using Tapatalk

Computer says no.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 5 guests