View unanswered posts | View active topics It is currently Fri May 24, 2013 8:20 pm



Reply to topic  [ 4 posts ] 
 Getting the property of device 
Author Message
User avatar

Joined: Jul 17, 2010
Posts: 71
Post Getting the property of device
In an action group I am trying to access the property of a device created with a plugin, in this case the RFXtrx plugin. The device shows three properties named 'last updated', 'type' and 'status'.

I expected the following would work:

ledevice=indigo.devices["cabanon"]
machin = ledevice.status
indigo.server.log(str(machin))

but it returns an error because the device does not have a 'status' attribute.

Where am I wrong ?


Mon Apr 09, 2012 3:37 pm
Profile
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11698
Location: Texas
Post Re: Getting the property of device
Try this:

Code: Select all
ledevice=indigo.devices["cabanon"]
indigo.server.log(str(ledevice))


And copy/paste the Event Log results.

_________________
Image


Mon Apr 09, 2012 4:05 pm
Profile WWW
User avatar

Joined: Jul 17, 2010
Posts: 71
Post Re: Getting the property of device
Thank you, nice to see the structure of the device. I can see these properties are in a dictionary:

------
Script address : 4739
buttonGroupCount : 0
description :
deviceTypeId : SecuritySensor
enabled : True
errorState :
folderId : 0
globalProps : MetaProps : (dict)
nl.rjdekok.indigoplugin.RFXRDK : (dict)
address : 4739 (string)
sensorNumber : 4739 (string)
space0 : (string)
id : 11176171
lastChanged : 2012-04-10 00:23:49
model : Security Sensor
name : cabanon
pluginId : nl.rjdekok.indigoplugin.RFXRDK
pluginProps : emptyDict : (dict)
protocol : Plugin
remoteDisplay : True
states : States : (dict)
lastUpdated : Tue Apr 10 00:23:49 2012 (string)
status : 0 (integer)
type : 0 (integer)
supportsAllLightsOnOff : False
supportsAllOff : False
supportsStatusRequest : False
version : 0
------

I will have to practice reading dictionaries... :D


Tue Apr 10, 2012 12:32 am
Profile
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11698
Location: Texas
Post Re: Getting the property of device
I think you'll want something like:

Code: Select all
ledevice=indigo.devices["cabanon"]

lastUpdatedStr = ledevice.states["lastUpdated"]
statusInt = ledevice.states["status"]
typeInt = ledevice.states["type"]

_________________
Image


Tue Apr 10, 2012 11:12 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.