python question

Posted on
Tue Mar 28, 2017 4:00 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

python question

i am trying to use different sensor icons and like to use a pre-defined list

so I would like to do
Code: Select all
icon = list[n]
dev.updateStateImageOnServer(indigo.kStateImageSel.icon)
but that does not do anything

otherwise I need to repeat the whole
if icon =="xx" and dev.updateStateImageOnServer(indigo.kStateImageSel.xx)
for each xx = SensorOn, SensorOff, ...

Karl

Posted on
Tue Mar 28, 2017 4:10 pm
DaveL17 offline
User avatar
Posts: 6744
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: python question

Hi Karl - I think that getattr() is what you need.

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

[My Plugins] - [My Forums]

Posted on
Tue Mar 28, 2017 5:54 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: python question

yes thanks.. that works

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests