Improve how neato displays alerts and add alerts for persistent maps (#19593)

* Improve how neato displays alerts and add alerts for persistent maps

* Review comments
This commit is contained in:
Daniel Shokouhi 2018-12-27 09:57:38 -08:00 committed by Martin Hjelmare
parent f9aa364b6d
commit d05450487c
2 changed files with 9 additions and 3 deletions

View File

@ -143,7 +143,9 @@ ALERTS = {
'maint_brush_change': 'Change the brush',
'maint_filter_change': 'Change the filter',
'clean_completed_to_start': 'Cleaning completed',
'nav_floorplan_not_created': 'No floorplan found'
'nav_floorplan_not_created': 'No floorplan found',
'nav_floorplan_load_fail': 'Failed to load floorplan',
'nav_floorplan_localization_fail': 'Failed to load floorplan'
}

View File

@ -82,6 +82,7 @@ class NeatoConnectedVacuum(StateVacuumDevice):
self._available = False
return
_LOGGER.debug('self._state=%s', self._state)
robot_alert = ALERTS.get(self._state['alert'])
if self._state['state'] == 1:
if self._state['details']['isCharging']:
self._clean_state = STATE_DOCKED
@ -93,14 +94,17 @@ class NeatoConnectedVacuum(StateVacuumDevice):
else:
self._clean_state = STATE_IDLE
self._status_state = 'Stopped'
if robot_alert is not None:
self._status_state = robot_alert
elif self._state['state'] == 2:
if ALERTS.get(self._state['error']) is None:
if robot_alert is None:
self._clean_state = STATE_CLEANING
self._status_state = (
MODE.get(self._state['cleaning']['mode'])
+ ' ' + ACTION.get(self._state['action']))
else:
self._status_state = ALERTS.get(self._state['error'])
self._status_state = robot_alert
elif self._state['state'] == 3:
self._clean_state = STATE_PAUSED
self._status_state = 'Paused'