Simple way to show all methods/properties of a device?

Posted on
Thu Jan 12, 2017 3:16 pm
superholz offline
Posts: 52
Joined: Jun 10, 2015
Location: The Netherlands

Simple way to show all methods/properties of a device?

I found it hard to find the right commands/properties of devices to use in python coding in the documetation.

Is there a simple way to print out all properties and methods a specific device supports?

Posted on
Thu Jan 12, 2017 5:36 pm
jay (support) offline
Site Admin
User avatar
Posts: 18223
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Simple way to show all methods/properties of a device?

Easiest way to see all properties is to open a scripting shell and:

Code: Select all
dev = indigo.devices[DEVICEIDHERE] # "Some Device"
print dev


Seeing methods is harder. You can:

Code: Select all
dir(dev)


Which shows all properties and methods, but you don't know which is which. The documentation is really the best way to see what methods there are and what they do.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jan 13, 2017 2:59 am
superholz offline
Posts: 52
Joined: Jun 10, 2015
Location: The Netherlands

Re: Simple way to show all methods/properties of a device?

Hi thanks for the quick answer! Are all these parameters also available through python scripting? How would I, for example, get the value from "sensorValue.ui" to use it as string in a python script?


copied from below:
states : States : (dict)
batteryLevel : 60 (integer)
batteryLevel.ui : 60% (string)
sensorValue : 38.000000 (real)
sensorValue.ui : 38.0 °C (string)


>>> print dev
address : 24
allowOnStateChange : False
allowSensorValueChange : False
batteryLevel : 60
buttonGroupCount : 0
configured : True
description : Temperature

deviceTypeId : zwValueSensorType
displayStateId : sensorValue
displayStateImageSel : TemperatureSensor
displayStateValRaw : 38.0
displayStateValUi : 38.0 °C
enabled : True
energyAccumBaseTime : None
energyAccumTimeDelta : None
energyAccumTotal : None
energyCurLevel : None
errorState :
folderId : 418951730
globalProps : MetaProps : (dict)
com.perceptiveautomation.indigoplugin.zwave : (dict)
AllowSensorValueChange : false (bool)
SensorUnits : 1 (integer)
SupportsBatteryLevel : true (bool)
SupportsEnergyMeter : false (bool)
SupportsEnergyMeterCurPower : false (bool)
SupportsEnergyMeterReset : false (bool)
SupportsOnState : false (bool)
SupportsSensorValue : true (bool)
SupportsStatusRequest : true (bool)
address : 24 (integer)
disableStatusLogging : false (bool)
indigoObjVersion : 5 (integer)
modelNameAndFirmware : Temperature/Humidity Sensor (ST814), firmware 1.06 (string)
propsPushTickler : 7 (string)
tempAlwaysFalse : false (bool)
userConfigVal002 : 99 (integer)
userConfigVal003 : 99 (integer)
userConfigVal004 : 99 (integer)
userConfigVal005 : 99 (integer)
userConfigVal006 : 4 (integer)
userPollAfterActivity : true (bool)
userPollInterval : 0 (integer)
userPollingEnabled : true (bool)
userWakeInterval : 1440 (integer)
version : 1.06 (string)
zwAppVersMajor : 1 (integer)
zwAppVersMinor : 6 (integer)
zwAssociationsMap : (dict)
g1 : (list)
Item : 1 (integer)
g2 : (list)
zwAssociationsMapStr : 1:[1] 2:[] (string)
zwClassCmdBase : 49 (integer)
zwClassCmdMap : (dict)
c112 : 1 (integer)
c114 : 1 (integer)
c128 : 1 (integer)
c132 : 2 (integer)
c133 : 1 (integer)
c134 : 1 (integer)
c32 : 1 (integer)
c49 : 2 (integer)
c96 : 2 (integer)
zwClassCmdMapStr : 20v1 80v1 84v2 85v1 86v1 60v2 70v1 31v2 72v1 (string)
zwClassIds : (list)
Item : 4 (integer)
Item : 33 (integer)
Item : 1 (integer)
zwClassInstanceCountMap : (dict)
zwClassInstanceCountMapStr : - none - (string)
zwClassName : Multilevel Sensor (routing) (string)
zwConfigVals : (dict)
p2 : 99 (integer)
p3 : 99 (integer)
p4 : 99 (integer)
p5 : 99 (integer)
p6 : 2 (integer)
p7 : 0 (integer)
p8 : 0 (integer)
zwConfigValsStr : 2:99 3:99 4:99 5:99 6:2 7:0 8:0 (string)
zwDevEndPoint : 1 (integer)
zwDevSubIndex : 0 (integer)
zwEncryptionStatusStr : (string)
zwEndpointClassMap : (dict)
e1 : (list)
Item : 49 (integer)
e2 : (list)
Item : 49 (integer)
zwEndpointClassMapStr : 1:[31], 2:[31] (string)
zwEndpointDevTypeMap : (dict)
e1 : (list)
Item : 33 (integer)
Item : 1 (integer)
e2 : (list)
Item : 33 (integer)
Item : 1 (integer)
zwEndpointDevTypeMapStr : 1:(21 : 01), 2:(21 : 01) (string)
zwFeatureListStr : routing, battery, beaming, waking (string)
zwLibType : 6 (integer)
zwManufactureId : 96 (integer)
zwManufactureName : Everspring (string)
zwMeterSubTypeFlags : 0 (integer)
zwMeterSupportsReset : false (bool)
zwMeterType : 0 (integer)
zwModelDefnVers : 1 (integer)
zwModelId : 393217 (integer)
zwModelName : Temperature/Humidity Sensor (ST814) (string)
zwNodeNeighbors : (list)
Item : 1 (integer)
Item : 3 (integer)
Item : 4 (integer)
Item : 5 (integer)
Item : 7 (integer)
Item : 19 (integer)
Item : 20 (integer)
Item : 23 (integer)
zwNodeNeighborsStr : 1, 3, 4, 5, 7, 19, 20, 23 (string)
zwProtoVersMajor : 2 (integer)
zwProtoVersMinor : 64 (integer)
zwShowMainUI : true (bool)
zwShowManualModifyConfigParmUI : false (bool)
zwShowPollingUI : false (bool)
zwShowSubmitModelInfoUI : false (bool)
zwShowWakeIntervalUI : true (bool)
zwWakeInterval : 1440 (integer)
emptyDict : (dict)
id : 813495010
lastChanged : 2017-01-13 09:11:36
lastSuccessfulComm : 2017-01-13 09:11:36
model : Temperature/Humidity Sensor (ST814)
name : TBalkon
onState : None
ownerProps : com.perceptiveautomation.indigoplugin.zwave : (dict)
AllowSensorValueChange : false (bool)
SensorUnits : 1 (integer)
SupportsBatteryLevel : true (bool)
SupportsEnergyMeter : false (bool)
SupportsEnergyMeterCurPower : false (bool)
SupportsEnergyMeterReset : false (bool)
SupportsOnState : false (bool)
SupportsSensorValue : true (bool)
SupportsStatusRequest : true (bool)
address : 24 (integer)
disableStatusLogging : false (bool)
indigoObjVersion : 5 (integer)
modelNameAndFirmware : Temperature/Humidity Sensor (ST814), firmware 1.06 (string)
propsPushTickler : 7 (string)
tempAlwaysFalse : false (bool)
userConfigVal002 : 99 (integer)
userConfigVal003 : 99 (integer)
userConfigVal004 : 99 (integer)
userConfigVal005 : 99 (integer)
userConfigVal006 : 4 (integer)
userPollAfterActivity : true (bool)
userPollInterval : 0 (integer)
userPollingEnabled : true (bool)
userWakeInterval : 1440 (integer)
version : 1.06 (string)
zwAppVersMajor : 1 (integer)
zwAppVersMinor : 6 (integer)
zwAssociationsMap : (dict)
g1 : (list)
Item : 1 (integer)
g2 : (list)
zwAssociationsMapStr : 1:[1] 2:[] (string)
zwClassCmdBase : 49 (integer)
zwClassCmdMap : (dict)
c112 : 1 (integer)
c114 : 1 (integer)
c128 : 1 (integer)
c132 : 2 (integer)
c133 : 1 (integer)
c134 : 1 (integer)
c32 : 1 (integer)
c49 : 2 (integer)
c96 : 2 (integer)
zwClassCmdMapStr : 20v1 80v1 84v2 85v1 86v1 60v2 70v1 31v2 72v1 (string)
zwClassIds : (list)
Item : 4 (integer)
Item : 33 (integer)
Item : 1 (integer)
zwClassInstanceCountMap : (dict)
zwClassInstanceCountMapStr : - none - (string)
zwClassName : Multilevel Sensor (routing) (string)
zwConfigVals : (dict)
p2 : 99 (integer)
p3 : 99 (integer)
p4 : 99 (integer)
p5 : 99 (integer)
p6 : 2 (integer)
p7 : 0 (integer)
p8 : 0 (integer)
zwConfigValsStr : 2:99 3:99 4:99 5:99 6:2 7:0 8:0 (string)
zwDevEndPoint : 1 (integer)
zwDevSubIndex : 0 (integer)
zwEncryptionStatusStr : (string)
zwEndpointClassMap : (dict)
e1 : (list)
Item : 49 (integer)
e2 : (list)
Item : 49 (integer)
zwEndpointClassMapStr : 1:[31], 2:[31] (string)
zwEndpointDevTypeMap : (dict)
e1 : (list)
Item : 33 (integer)
Item : 1 (integer)
e2 : (list)
Item : 33 (integer)
Item : 1 (integer)
zwEndpointDevTypeMapStr : 1:(21 : 01), 2:(21 : 01) (string)
zwFeatureListStr : routing, battery, beaming, waking (string)
zwLibType : 6 (integer)
zwManufactureId : 96 (integer)
zwManufactureName : Everspring (string)
zwMeterSubTypeFlags : 0 (integer)
zwMeterSupportsReset : false (bool)
zwMeterType : 0 (integer)
zwModelDefnVers : 1 (integer)
zwModelId : 393217 (integer)
zwModelName : Temperature/Humidity Sensor (ST814) (string)
zwNodeNeighbors : (list)
Item : 1 (integer)
Item : 3 (integer)
Item : 4 (integer)
Item : 5 (integer)
Item : 7 (integer)
Item : 19 (integer)
Item : 20 (integer)
Item : 23 (integer)
zwNodeNeighborsStr : 1, 3, 4, 5, 7, 19, 20, 23 (string)
zwProtoVersMajor : 2 (integer)
zwProtoVersMinor : 64 (integer)
zwShowMainUI : true (bool)
zwShowManualModifyConfigParmUI : false (bool)
zwShowPollingUI : false (bool)
zwShowSubmitModelInfoUI : false (bool)
zwShowWakeIntervalUI : true (bool)
zwWakeInterval : 1440 (integer)
pluginId : com.perceptiveautomation.indigoplugin.zwave
pluginProps : emptyDict : (dict)
protocol : ZWave
remoteDisplay : True
sensorValue : 38.0
states : States : (dict)
batteryLevel : 60 (integer)
batteryLevel.ui : 60% (string)
sensorValue : 38.000000 (real)
sensorValue.ui : 38.0 °C (string)
subModel : Temperature
supportsAllLightsOnOff : False
supportsAllOff : False
supportsOnState : False
supportsSensorValue : True
supportsStatusRequest : True
version : 1.06

Posted on
Fri Jan 13, 2017 4:33 am
DaveL17 offline
User avatar
Posts: 6758
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Simple way to show all methods/properties of a device?

superholz wrote:
Hi thanks for the quick answer! Are all these parameters also available through python scripting? How would I, for example, get the value from "sensorValue.ui" to use it as string in a python script?

It depends on what type of value you want to access.

For a device property, you would use dev.PROPERTY:
Code: Select all
>>> dev = indigo.devices[10496130]
>>> print dev.name
DS2408 Switch 0
>>> print dev.configured
True


For a device state, you would use dev.states['STATENAME']:
Code: Select all
>>> print dev.states['owsPrimaryValue']
207
>>> print dev.states['owsType']
DS2408


For globalProps:
Code: Select all
>>> dev.globalProps['DS2408PIOOutputLatchState']
u'254'


The above examples are from this device dict (it's helpful to post such things in a code block so that you can see the formatting):
Code: Select all
address : FA0000000C56E529
allowOnStateChange : False
allowSensorValueChange : False
batteryLevel : None
buttonGroupCount : 0
configured : True
description :
deviceTypeId : owsUserSwitch
displayStateId : sensorValue
displayStateImageSel : SensorOff
displayStateValRaw : 0.0
displayStateValUi : 0
enabled : False
energyAccumBaseTime : None
energyAccumTimeDelta : None
energyAccumTotal : None
energyCurLevel : None
errorState :
folderId : 1453848350
globalProps : MetaProps : (dict)
     com.fogbert.indigoplugin.OWServer : (dict)
          AllowOnStateChange : false (bool)
          AllowSensorValueChange : false (bool)
          DS2406PIOActivityLatchState : 255 (string)
          DS2406PIOOutputLatchState : 254 (string)
          DS2406PowerOnResetLatch : 1 (string)
          DS2406RSTZconfiguration : 0 (string)
          DS2408PIOActivityLatchState : 255 (string)
          DS2408PIOOutputLatchState : 254 (string)
          DS2408PowerOnResetLatch : 1 (string)
          DS2408RSTZconfiguration : 0 (string)
          SupportsOnState : true (bool)
          SupportsSensorValue : true (bool)
          SupportsStatusRequest : true (bool)
          address : FA0000000C56E529 (string)
          prefSensorValue2408 : S_0 (string)
          romID : FA0000000C56E529 (string)
          serverList : 10.0.1.X (string)
id : 10496130
lastChanged : 2016-04-07 09:36:04
lastSuccessfulComm : 2016-04-07 09:36:04
model : 8-Channel Addressable Switch (DS2408)
name : DS2408 Switch 0
onState : False
ownerProps : com.fogbert.indigoplugin.OWServer : (dict)
     AllowOnStateChange : false (bool)
     AllowSensorValueChange : false (bool)
     DS2406PIOActivityLatchState : 255 (string)
     DS2406PIOOutputLatchState : 254 (string)
     DS2406PowerOnResetLatch : 1 (string)
     DS2406RSTZconfiguration : 0 (string)
     DS2408PIOActivityLatchState : 255 (string)
     DS2408PIOOutputLatchState : 254 (string)
     DS2408PowerOnResetLatch : 1 (string)
     DS2408RSTZconfiguration : 0 (string)
     SupportsOnState : true (bool)
     SupportsSensorValue : true (bool)
     SupportsStatusRequest : true (bool)
     address : FA0000000C56E529 (string)
     prefSensorValue2408 : S_0 (string)
     romID : FA0000000C56E529 (string)
     serverList : 10.0.1.X (string)
pluginId : com.fogbert.indigoplugin.OWServer
pluginProps : com.fogbert.indigoplugin.multitool : (dict)
protocol : Plugin
remoteDisplay : True
sensorValue : 0.0
states : States : (dict)
     onOffState : off (on/off bool)
     owsChannel : 0 (integer)
     owsFamily : 29 (string)
     owsHealth : 7 (real)
     owsInput1 : false (bool)
     owsInput2 : false (bool)
     owsInput3 : false (bool)
     owsInput4 : false (bool)
     owsInput5 : false (bool)
     owsInput6 : false (bool)
     owsInput7 : false (bool)
     owsInput8 : false (bool)
     owsPIOActivityLatchState : 255 (real)
     owsPIOLogicState : 207 (real)
     owsPIOOutputLatchState : 254 (real)
     owsPowerOnResetLatch : 1 (real)
     owsPrimaryValue : 207 (string)
     owsRSTZConfiguration : 0 (integer)
     owsRawData : CFFFFF00008800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 (string)
     owsRomID : FA0000000C56E529 (string)
     owsType : DS2408 (string)
     owsVccPowerStatus : 1 (real)
     sensorValue : 0.000000 (real)
     sensorValue.ui : 0 (string)
subModel :
supportsAllLightsOnOff : False
supportsAllOff : False
supportsOnState : True
supportsSensorValue : True
supportsStatusRequest : True
version : None

So in answer to your original question...
Code: Select all
>>> print dev.states['sensorValue.ui']
0

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

[My Plugins] - [My Forums]

Posted on
Fri Jan 13, 2017 3:39 pm
jay (support) offline
Site Admin
User avatar
Posts: 18223
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Simple way to show all methods/properties of a device?

DaveL17 wrote:
For globalProps:
Code: Select all
>>> dev.globalProps['DS2408PIOOutputLatchState']
u'254'


Slight correction:

Code: Select all
[code]>>> dev.globalProps['com.fogbert.indigoplugin.OWServer']['DS2408PIOOutputLatchState']
u'254'
[/code]


dev.globalProps is a dictionary of property dictionaries - one for each plugin that adds custom properties to the device. The properties for the owner of the device are identified by the plugin ID (as in the above example). There's also a shortcut however so you don't have to know what the plugin id is for the device owner:

Code: Select all
>>> dev.ownerProps['DS2408PIOOutputLatchState']
u'254'

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jan 13, 2017 4:46 pm
DaveL17 offline
User avatar
Posts: 6758
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Simple way to show all methods/properties of a device?

jay (support) wrote:
Slight correction:

Code: Select all
[code]>>> dev.globalProps['com.fogbert.indigoplugin.OWServer']['DS2408PIOOutputLatchState']
u'254'
[/code]


dev.globalProps is a dictionary of property dictionaries - one for each plugin that adds custom properties to the device. The properties for the owner of the device are identified by the plugin ID (as in the above example). There's also a shortcut however so you don't have to know what the plugin id is for the device owner:

Code: Select all
>>> dev.ownerProps['DS2408PIOOutputLatchState']
u'254'

Thanks Jay. Not sure how I managed to foobar that one.

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

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 21 guests