From 2524dca7bfc006b9dd1b4aaaf9b90e2b2d7a1ad7 Mon Sep 17 00:00:00 2001 From: Daniel Shokouhi Date: Fri, 29 Jun 2018 14:27:18 -0700 Subject: [PATCH] Use cached states for neato when possible (#15218) --- homeassistant/components/switch/neato.py | 2 +- homeassistant/components/vacuum/neato.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/switch/neato.py b/homeassistant/components/switch/neato.py index dca5d63b43d..34dad9bb581 100644 --- a/homeassistant/components/switch/neato.py +++ b/homeassistant/components/switch/neato.py @@ -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 diff --git a/homeassistant/components/vacuum/neato.py b/homeassistant/components/vacuum/neato.py index 1b32fff9e5b..6289fed265d 100644 --- a/homeassistant/components/vacuum/neato.py +++ b/homeassistant/components/vacuum/neato.py @@ -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