Here's the device definition:
- Code: Select all
<Device type="sensor" id="oregonDevice">
<Name>Oregon Scientific Device</Name>
<ConfigUI>
<SupportURL>http://forums.indigodomo.com/viewforum.php?f=214</SupportURL>
<Field id="SupportsOnState" type="checkbox" defaultValue="false" hidden="true" />
<Field id="SupportsSensorValue" type="checkbox" defaultValue="true" hidden="true" />
<Field id="SupportsStatusRequest" type="checkbox" defaultValue="false" hidden="true" />
<Field id="AllowOnStateChange" type="checkbox" defaultValue="false" hidden="true" />
<Field id="address" type="menu">
<Label>Device:</Label>
<List class="self" filter="5" method="availableDeviceList"/>
</Field>
</ConfigUI>
</Device>
The base definition does not have SupportBatteryLevel true because I reuse this definition for all devices of this type.
I have this code run when the device is started for the first time:
- Code: Select all
# update the master device, depending on the actual device type
if subType not in ['0x1A89', '0x2A19', '0xDA78']:
device.updateStateImageOnServer(indigo.kStateImageSel.TemperatureSensor)
device.name = devAddress + " Thermometer"
device.subModel = "Thermometer"
device.replaceOnServer()
newProps = device.pluginProps
newProps["configDone"] = True
newProps["valueType"] = "temperature"
newProps["SupportsBatteryLevel"] = True
device.replacePluginPropsOnServer(newProps)
SupportsBatteryLevel is set True here, for the "master" device. Then, depending on the specific model, I run:
- Code: Select all
# create any subdevices
if subType in ['0x1A2D', '0xCA2C', '0x0ACC', '0x1A3D', '0xFA28']:
self.logger.info(u"Adding Hygrometer subDevice to '%s' (%s) @ %s" % (device.name, device.id, devAddress))
newdev = indigo.device.create(indigo.kProtocol.Plugin,
address=devAddress,
name=devAddress + " Hygrometer",
deviceTypeId="oregonDevice",
groupWithDevice=device.id,
props={ 'valueType': 'hygrometry',
'configDone': True,
'AllowOnStateChange': False,
'SupportsOnState': False,
'SupportsSensorValue': True,
'SupportsStatusRequest': False
},
folder=device.folderId)
newdev.updateStateImageOnServer(indigo.kStateImageSel.HumiditySensor)
newdev.model = device.model
newdev.subModel = "Hygrometer" # Manually need to set the model and subModel names (for UI only)
newdev.replaceOnServer()
So, no SupportsBatteryLevel for the sub device. But what I get battery level indicators for both devices. See screen grabs. Yes, I'm updating both levels at the moment, but when I wasn't it was showing the correct value for the main device and 0% for the secondary device.
I've deleted and recreated the devices multiple times. No changes.