Python does not read Indigo variables correctly

Posted on
Sat Oct 15, 2022 11:30 am
rainman50 offline
Posts: 295
Joined: Feb 13, 2006
Location: Michigan

Python does not read Indigo variables correctly

I have read on the forum trying to find a method of reading a variable and storing it into another variable using Python

I'm very new to Python. I recently found that Indigo variables are stored as strings. So any integers or floats have to be put to a string before storing into a variable. Thanks to FlyingDiver who pointed this out in a previous post of mine.
The problem is that after running the code, the destination variable HumidityTempDiffGarageNorth contains this : "description :"

HumidityOutsideTemp is equal to "45".

Here is my code:

test = indigo.variables[240228976] # "HumidityOutsideTemp"]
indigo.variable.updateValue("HumidityTempDiffGarageNorth", str(test))

After running this, the variable "HumidityTempDiffGarageNorth" has the contents of "description :"
No errors were generated in the Events log:

So I thought I'd just load "test" with a number in this case "23" and see if it stores it correctly: So the code is :


test = 23
indigo.variable.updateValue("HumidityTempDiffGarageNorth", str(test))

After running the code (still no errors) "23" was correctly stored in variable" HumidityTempDiffGarageNorth"

I'm probably overlooking something.

Any help would be appreciated.

Posted on
Sat Oct 15, 2022 12:11 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Python does not read Indigo variables correctly

Is this related or the same as your other forum post:

viewtopic.php?f=82&t=26608&p=214099#p214099

If so, let's keep it on that thread to avoid duplicate answers / confusion.

And use the CODE tag to surround your python code in a post. Just select the code when you are creating the post then press the "Code" button up under Selection style and it will surround it with tags like [code] some code here [/code] which makes it much more readable.

Image

Posted on
Sat Oct 15, 2022 5:24 pm
rainman50 offline
Posts: 295
Joined: Feb 13, 2006
Location: Michigan

Re: Python does not read Indigo variables correctly

it is related in but one was problem with reading a variable and the other writing it.
I'll continue from my original post.
thanks Matt.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 7 guests