Try as I might, am am not able to get it to have either a slider for speed (0-100) or more than 4 speed indexes.
The documentation is a little confusing as well.
Property Type Writable Description
onState boolean No indicates whether the device is on - shortcut to dev.states['onOffState']
speedIndex integer No indicates the current speed index for devices that support some fixed # of speeds - shortcut to dev.states['speedIndex']
speedIndexCount boolean No indicates the number of indexes available for this device
speedLevel boolean No indicates the level the device is set to (0-100) - shortcut to dev.states['speedLevel']
It says the speedLevel is a boolean.. and then it says it should be 0-100
May I suggest a better naming for the class properties, more in the line with the dimmer devices ?
SupportsSpeedLevel
Anyway, I would be greatful for a hint how to do this.. for now I just made it a dimmer device...
P.S. This is to control a pump motor with variable speed.
Devices.xml
- Code: Select all
<Device type="speedcontrol" id="speed0" address="300">
<Name>Motor Speed 1</Name>
<ConfigUI>
<Field id="address" type="textfield" defaultValue="300" readonly="true">
<Label>Module Address:</Label>
</Field>
</ConfigUI>
<UiDisplayStateId>speedLevel</UiDisplayStateId>
</Device>
And plugin.py
- Code: Select all
def deviceStartComm(self, dev):
self.debugLog(u"deviceStartComm: %s (%s)" % (dev.name, dev.deviceTypeId))
props = dev.pluginProps
props["onState"] = False # Wether the device is on - shortcut to dev.states['onOffState'
props["speedLevel"] = 100 # Level the device is set to (0-100) - shortcut to dev.states['speedLevel']
props["speedIndex"] = 0 # Current speed index for devices that support some fixed # of dev.states['speedIndex']
props["speedIndexCount"] = 11 # number of indexes available for this device
dev.replacePluginPropsOnServer(props)