I'm trying to declare some custom states for a device, but always end up with a the following errors:
- Code: Select all
Error device "Expected Rainfall" state key status not defined (ignoring update request)
Error device "Expected Rainfall" state key lastReportedAt not defined (ignoring update request)
"Expected Rainfall" is a 'gauge' device. I've deleted it, added it back, disabled / enabled plugin, etc. The Custom States are not showing in the UI below the Device Details, either.
plugin.py, during a device update request:
- Code: Select all
dev.updateStateOnServer('status', value=status_value)
dev.updateStateOnServer('lastReportedAt', value=time.strftime('%c'))
Devices.xml:
- Code: Select all
<Device type="custom" id="gauge">
<Name>Gauge</Name>
<ConfigUI>
<Field id="device_id" type="menu" defaultValue="">
<Label>Device:</Label>
<List class="self" filter="" method="getDeviceList" dynamicReload="true" />
<CallbackMethod>updateConfigUI</CallbackMethod>
</Field>
<Field id="state_id" type="menu" defaultValue="">
<Label>Device State:</Label>
<List class="self" filter="" method="getDeviceStateList" dynamicReload="true" />
</Field>
<Field id="user_info" type="textfield" defaultValue="">
<Label>User Info:</Label>
</Field>
<Field id="user_info_help" type="label" fontSize="mini" alignWithControl="true">
<Label>(optional) reported in 'user_info' label - supports Indigo substitutions</Label>
</Field>
<Field id="address" type="textfield" hidden="yes" />
</ConfigUI>
<States>
<State id="status">
<ValueType>String</ValueType>
<TriggerLabel>Metric Value</TriggerLabel>
<ControlPageLabel>Metric Value</ControlPageLabel>
</State>
<State id="lastReportedAt">
<ValueType>String</ValueType>
<TriggerLabel>Last Reported</TriggerLabel>
<ControlPageLabel>Last Reported</ControlPageLabel>
</State>
</States>
<UiDisplayStateId>status</UiDisplayStateId>
</Device>