'NoneType' object has no attribute 'updateStateOnServer' ???
Posted: Tue Dec 22, 2020 12:09 am
I added a couple lines to allow a variable or device state to be used to update a state on my plugin. Most of the fields are working just fine. The last field I updated doesn't play well with others... File "plugin.py", line 47, in setUserLocation
AttributeError: 'NoneType' object has no attribute 'updateStateOnServer'
this is what I have.... but it's basically identical (except for swapping out keys and stuff) to other lines that are working just fine... (Line 47 is the 3rd line down)
And this one, for example, works just fine with a string, varID or device state entered.
AttributeError: 'NoneType' object has no attribute 'updateStateOnServer'
this is what I have.... but it's basically identical (except for swapping out keys and stuff) to other lines that are working just fine... (Line 47 is the 3rd line down)
- Code: Select all
def setUserLocation(self, pluginAction, dev):
substitutedTitle = self.substitute(pluginAction.props.get("userLocationField", ""))
dev.updateStateOnServer(key="userLocation", value=substitutedTitle)
self.debugLog("Set User Location: " + str(pluginAction.props.get(u"userLocationField")) + " Entered. State userLocation set to: " + substitutedTitle)
- Code: Select all
<State id="userLocation">
<ValueType>String</ValueType>
<TriggerLabel>User Location</TriggerLabel>
<ControlPageLabel>User Location</ControlPageLabel>
</State>
- Code: Select all
<Action id="setUserLocation">
<Name>Set User Location</Name>
<CallbackMethod>setUserLocation</CallbackMethod>
<ConfigUI>
<Field type="textfield" id="userLocationField">
<Label>User Location:</Label>
</Field>
</ConfigUI>
</Action>
And this one, for example, works just fine with a string, varID or device state entered.
- Code: Select all
def setUserIDNumber(self, pluginAction, dev): #<- Substitute Test
substitutedTitle = self.substitute(pluginAction.props.get("userIDNumberField", ""))
dev.updateStateOnServer(key="userIDNumber", value=substitutedTitle)
self.debugLog("Set User ID: " + str(pluginAction.props.get(u"userIDNumberField")) + " Entered. " + "State userIDNumber set to: " + substitutedTitle)