I'm soooooo annoyed! [with myself]

Posted on
Mon Jan 23, 2023 1:48 pm
jltnol offline
Posts: 994
Joined: Oct 15, 2013

I'm soooooo annoyed! [with myself]

So I'm far from a Python Expert, but over the years, I've collected enough snippets of code to get my kindergarten scripts to work for me, but I am just stuck, stuck, stuck.
Below is the code, but I keep getting this error message:
embedded script, line 4, at top level
AttributeError: 'list' object has no attribute 'updateValue'


I've updated variables in Python countless times, but this just isn't working. Just trying to put the device state into the variable fails. I'm also not sure the math part is going to work, but I guess one thing at a time.

Code: Select all
HeatTimer = indigo.devices[397890962]
D0Heat = HeatTimer.states['secondsDay00'] #time in seconds

indigo.variable.updateValue(523352543, D0Heat) #update variable

Minutes = "{:.2f}".format(float(D0Heat) /60.0) #convert seconds to minutes
indigo.variable.updateValue(1392022438, Minutes) #update variable

Posted on
Mon Jan 23, 2023 4:21 pm
jltnol offline
Posts: 994
Joined: Oct 15, 2013

Re: I'm soooooo annoyed! [with myself]

So just a bit more info.

As it turns out, the device state I'm working with is an integer, not a string. Other custom states that are "strings" work just fine, but custom states that are "integers" do not. I'm working looking for the answer but I'm assuming I need to amend the update line in some fashion.....


********************

found this but it also doesn't work anymore. I'm assuming this is from an older version of Python
Code: Select all
myInteger = 1
indigo.variable.updateValue(1234567, value=unicode(myInteger))

returns this error:
embedded script, line 2, at top level
NameError: name 'unicode' is not defined

Posted on
Mon Jan 23, 2023 5:35 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: I'm soooooo annoyed! [with myself]

Code: Select all
myInteger = 1
indigo.variable.updateValue(1234567, value=str(myInteger))

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

Posted on
Mon Jan 23, 2023 7:05 pm
jltnol offline
Posts: 994
Joined: Oct 15, 2013

Re: I'm soooooo annoyed! [with myself]

As ALWAYS... Thank you Joe. The rest I can manage.... it's the little things like this that trip me up all the time.. But thankfully.... people like you are around to always help!

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests