I am unable to get setErrorStateOnServer() to work. (see code below). The lines before and after (I had log statements surrounding the command) are executed and its in a try block and Exception path is not followed - so, I know it is being executed. Could it be because I have assigned a custom state in getDeviceDisplayStateId()?
- Code: Select all
if metric in self.apcupsdCap[dev.id]:
dev.updateStateOnServer(key=metric, value=value) # FIRST update the state
if metric == 'STATUS' and value == 'COMMLOST' and not self.apcupsdCommError:
dev.setErrorStateOnServer(u'x') # THEN set the state error
self.apcupsdCommError = True
elif metric == 'STATUS' and value == 'ONLINE' and self.apcupsdCommError:
dev.setErrorStateOnServer(None)
self.apcupsdCommError = False