state key sensorValue not defined error

Posted on
Sat Apr 08, 2017 11:53 am
FlyingDiver offline
User avatar
Posts: 7216
Joined: Jun 07, 2014
Location: Southwest Florida, USA

state key sensorValue not defined error

Trying to use the standard Indigo "sensor" type device. Device definition is:

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.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Apr 08, 2017 12:23 pm
FlyingDiver offline
User avatar
Posts: 7216
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: state key sensorValue not defined error

Nevermind. :roll:

Code: Select all
            newdev = indigo.device.create(indigo.kProtocol.Plugin,
                                            address=address,
                                            name=address + " Wind Direction",
                                            deviceTypeId="oregonSensor",
                                            groupWithDevice=device.id,
                                            props={ 'valueType': 'direction',
                                                    'configDone': True,
                                                    'AllowOnStateChange': False,
                                                    'SupportsOnState': False,
                                                    'SupportsSensorValue': True,
                                                    'SupportsStatusRequest': False
                                                },
                                            folder=device.folderId)

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests