Use cached states for neato when possible (#15218)

This commit is contained in:
Daniel Shokouhi 2018-06-29 14:27:18 -07:00 committed by Paulus Schoutsen
parent 56f17b8651
commit 2524dca7bf
2 changed files with 8 additions and 8 deletions

View file

@ -67,7 +67,7 @@ class NeatoConnectedSwitch(ToggleEntity):
_LOGGER.debug('self._state=%s', self._state)
if self.type == SWITCH_TYPE_SCHEDULE:
_LOGGER.debug("State: %s", self._state)
if self.robot.schedule_enabled:
if self._state['details']['isScheduleEnabled']:
self._schedule_state = STATE_ON
else:
self._schedule_state = STATE_OFF

View file

@ -96,14 +96,14 @@ class NeatoConnectedVacuum(VacuumDevice):
elif self._state['state'] == 4:
self._status_state = ERRORS.get(self._state['error'])
if (self.robot.state['action'] == 1 or
self.robot.state['action'] == 2 or
self.robot.state['action'] == 3 and
self.robot.state['state'] == 2):
if (self._state['action'] == 1 or
self._state['action'] == 2 or
self._state['action'] == 3 and
self._state['state'] == 2):
self._clean_state = STATE_ON
elif (self.robot.state['action'] == 11 or
self.robot.state['action'] == 12 and
self.robot.state['state'] == 2):
elif (self._state['action'] == 11 or
self._state['action'] == 12 and
self._state['state'] == 2):
self._clean_state = STATE_ON
else:
self._clean_state = STATE_OFF