Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions homeassistant/components/vacuum/xiaomi_miio.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
'Turbo': 77,
'Max': 90}

ATTR_CLEAN_START = 'clean_start'
ATTR_CLEAN_STOP = 'clean_stop'
ATTR_CLEANING_TIME = 'cleaning_time'
ATTR_DO_NOT_DISTURB = 'do_not_disturb'
ATTR_DO_NOT_DISTURB_START = 'do_not_disturb_start'
Expand Down Expand Up @@ -169,6 +171,7 @@ def __init__(self, name, vacuum):
self.consumable_state = None
self.clean_history = None
self.dnd_state = None
self.last_clean = None

@property
def name(self):
Expand Down Expand Up @@ -248,6 +251,10 @@ def device_state_attributes(self):
ATTR_STATUS: str(self.vacuum_state.state)
})

if self.last_clean:
attrs[ATTR_CLEAN_START] = self.last_clean.start
attrs[ATTR_CLEAN_STOP] = self.last_clean.end

if self.vacuum_state.got_error:
attrs[ATTR_ERROR] = self.vacuum_state.error
return attrs
Expand Down Expand Up @@ -368,6 +375,7 @@ def update(self):

self.consumable_state = self._vacuum.consumable_status()
self.clean_history = self._vacuum.clean_history()
self.last_clean = self._vacuum.last_clean_details()
self.dnd_state = self._vacuum.dnd_status()

self._available = True
Expand Down