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 ?
Getting the property of device
Forum rules
This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
- matt (support)
- Site Admin
- Posts: 21542
- Joined: Mon Jan 27, 2003 1:17 pm
- Location: Texas
- Contact:
Re: Getting the property of device
Try this:
And copy/paste the Event Log results.
Code: Select all
ledevice=indigo.devices["cabanon"]
indigo.server.log(str(ledevice))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...
------
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...
- matt (support)
- Site Admin
- Posts: 21542
- Joined: Mon Jan 27, 2003 1:17 pm
- Location: Texas
- Contact:
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"]