- Code: Select all
<Device type="sensor" id="oregonSensor">
<Name>Oregon Scientific Sensor</Name>
<ConfigUI>
<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="OREGON" method="availableDeviceList"/>
</Field>
</Field>
</ConfigUI>
</Device>
The device is later updated with:
- Code: Select all
device.updateStateImageOnServer(indigo.kStateImageSel.TemperatureSensor)
device.name = address + " Thermometer"
device.subModel = "Thermometer"
device.replaceOnServer()
newProps = device.pluginProps
newProps["configDone"] = True
newProps["valueType"] = "temperature"
device.replacePluginPropsOnServer(newProps)
Devices created using the standard new device creation dialogs work fine. I have other devices that I'm creating programmatically to group with the "base" sensor. Code to do that is:
- Code: Select all
newdev = indigo.device.create(indigo.kProtocol.Plugin,
address=address,
name=address + " Hygrometer",
deviceTypeId="oregonSensor",
groupWithDevice=device.id,
props={'configDone': True, 'valueType': "hygrometry"},
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()
Now, when I go to update the sensor value, the original sensor updates fine. But the second sensor fails to update with this error:
- Code: Select all
Error device "OREGON-46081 Hygrometer" state key sensorValue not defined (ignoring update request)
So there's something wonky going on with the definition of the second device. It's using the same device definition, so those attributes should be there, shouldn't they? It's clearly not picking up any of them, because the device status UI is totally different. Second one shows the status request button, for example. First does not.