Add new service clean_spot to vacuums (#8862)
* Add new service `clean_spot` to vacuums
- Add as base component service, with associated support flag to make it optional
- Implement on Demo vacuum
- Implement on Xiaomi vacuum
- Update tests for platforms Demo and Xiaomi
- Change default icon for vacuums to `mdi:roomba`, but keep the one for the Xiaomi
- (In a polymer PR: add new service to command toolbar in the 'more-info' card)
* Add `clean_spot` service description
* fix default properties for vacuum component
This commit is contained in:
1 parent
d8ca04a4bc
commit
c6aaacbb08
6 files changed
+89
-25
No files matched your search
@@ -39,7 +39,7 @@ class TestVacuumDemo(unittest.TestCase):
|
||||
def test_supported_features(self):
|
||||
"""Test vacuum supported features."""
|
||||
state = self.hass.states.get(ENTITY_VACUUM_COMPLETE)
|
||||
self.assertEqual(1023, state.attributes.get(ATTR_SUPPORTED_FEATURES))
|
||||
self.assertEqual(2047, state.attributes.get(ATTR_SUPPORTED_FEATURES))
|
||||
self.assertEqual("Charging", state.attributes.get(ATTR_STATUS))
|
||||
self.assertEqual(100, state.attributes.get(ATTR_BATTERY_LEVEL))
|
||||
self.assertEqual("medium", state.attributes.get(ATTR_FAN_SPEED))
|
||||
@@ -141,6 +141,12 @@ class TestVacuumDemo(unittest.TestCase):
|
||||
state = self.hass.states.get(ENTITY_VACUUM_COMPLETE)
|
||||
self.assertEqual(FAN_SPEEDS[-1], state.attributes.get(ATTR_FAN_SPEED))
|
||||
|
||||
vacuum.clean_spot(self.hass, entity_id=ENTITY_VACUUM_COMPLETE)
|
||||
self.hass.block_till_done()
|
||||
state = self.hass.states.get(ENTITY_VACUUM_COMPLETE)
|
||||
self.assertIn("spot", state.attributes.get(ATTR_STATUS))
|
||||
self.assertEqual(STATE_ON, state.state)
|
||||
|
||||
def test_unsupported_methods(self):
|
||||
"""Test service calls for unsupported vacuums."""
|
||||
self.hass.states.set(ENTITY_VACUUM_NONE, STATE_ON)
|
||||
@@ -189,6 +195,12 @@ class TestVacuumDemo(unittest.TestCase):
|
||||
self.assertNotEqual(FAN_SPEEDS[-1],
|
||||
state.attributes.get(ATTR_FAN_SPEED))
|
||||
|
||||
vacuum.clean_spot(self.hass, entity_id=ENTITY_VACUUM_BASIC)
|
||||
self.hass.block_till_done()
|
||||
state = self.hass.states.get(ENTITY_VACUUM_BASIC)
|
||||
self.assertNotIn("spot", state.attributes.get(ATTR_STATUS))
|
||||
self.assertEqual(STATE_OFF, state.state)
|
||||
|
||||
def test_services(self):
|
||||
"""Test vacuum services."""
|
||||
# Test send_command
|
||||
|
||||
Reference in new issue
Block a user