cap:spot-cleaning
- support for spot cleaning¶
This capability is commonly used together with autonomous cleaning to also support cleaning a specific spot.
if(thing.matches('cap:spot-cleaning')) {
// Do some cleaning around this spot
await thing.cleanSpot();
}
API¶
-
cleanSpot
()¶ Activate cleaning for the current spot.
Returns: Promise that resolves to null
.Example:
// Using async/await await thing.cleanSpot(); // Using promise then/catch thing.cleanSpot() .then(...) .catch(...);
Protected methods¶
-
activateCleanSpot
()¶ Abstract. Activate spot cleaning for this thing. Should call
updateCleaning
when spot cleaning is activated.Returns: Promise if asynchronous. Example:
activateCleanSpot() { return activateViaPromise(...); }
Implementing capability¶
When implementing this capability refer to the requirements of
cleaning-state. In addition to that the method
activateCleanSpot
needs to be implemented.
Example:
const { Thing } = require('abstract-things');
const { SpotCleaning } = require('abstract-things/climate');
class Example extends Thing.with(SpotCleaning) {
activateCleanSpot() {
return ...;
}
}