Convert to Python

Posted on
Sat Aug 13, 2022 4:41 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Convert to Python

Oh, right, you're still running Python2.
Code: Select all
indigo.variable.updateValue('RainSeason',  "{:.2f}".format(rainSeason)

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

Posted on
Sat Aug 13, 2022 6:41 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Convert to Python

Sorry, same error.

Thanks,

Carl
Attachments
79B3CB68-8FEE-47A2-B71B-2DD2A9787B2F.jpeg
79B3CB68-8FEE-47A2-B71B-2DD2A9787B2F.jpeg (162.23 KiB) Viewed 1311 times

Posted on
Sat Aug 13, 2022 7:03 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Convert to Python

Missing right parenthesis at the end.

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

Posted on
Sat Aug 13, 2022 7:08 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Convert to Python

Perfect, thanks!

Carl

Posted on
Sat Aug 13, 2022 7:30 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Convert to Python

Thought based on the prior scripts I could do this one but no go.
Here's the AS:
Code: Select all
tell application "IndigoServer"
   set the value of variable "WUForecastAll" to (value of variable "WUForecast") & " " & (value of variable "WUHighTemp") & (ASCII character 188) & "/" & (value of variable "WULowTemp") & (ASCII character 188)
end tell


Here's what I have so far:
Code: Select all
WUForecastAll = indigo.variables[320389015].value  # ID of `WUForecastAll `
WUForecast = indigo.variables[431199923].value  # ID of `WUForecast `
WUHighTemp = indigo.variables[1796297015].value  # ID of `WUHighTemp `
WULowTemp = indigo.variables[1401542304].value  # ID of `WULowTemp

indigo.variable.updateValue(320389015, WUForecast + " " + WUHighTemp + "°" + "/" WULowTemp + "°") # ID of `WUForecastAll `


The format I'm after would be: Sunny 87°/56°

Hope I'm not overstepping with all these conversions.

Thanks,

Carl

Posted on
Sat Aug 13, 2022 7:35 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Convert to Python

Don't use concatenation (the "+" signs). Use string formatting. Start here: https://www.w3schools.com/python/ref_string_format.asp

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

Posted on
Sat Aug 13, 2022 8:38 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Convert to Python

Think I got it. Many thanks!

Carl

Who is online

Users browsing this forum: No registered users and 1 guest