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?
dev = indigo.devices[DEVICEIDHERE] # "Some Device"
print dev
dir(dev)
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?
>>> dev = indigo.devices[10496130]
>>> print dev.name
DS2408 Switch 0
>>> print dev.configured
True
>>> print dev.states['owsPrimaryValue']
207
>>> print dev.states['owsType']
DS2408
>>> dev.globalProps['DS2408PIOOutputLatchState']
u'254'
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
>>> print dev.states['sensorValue.ui']
0
DaveL17 wrote:For globalProps:
- Code: Select all
>>> dev.globalProps['DS2408PIOOutputLatchState']
u'254'
[code]>>> dev.globalProps['com.fogbert.indigoplugin.OWServer']['DS2408PIOOutputLatchState']
u'254'
[/code]
>>> dev.ownerProps['DS2408PIOOutputLatchState']
u'254'
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'
Users browsing this forum: No registered users and 21 guests