mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-15 05:16:34 +00:00
Add new service clean_spot
to vacuums as command in the toolbar (#379)
- Add it with the 'broom' icon between the stop and the locate commands. - Fix an error in the supportsCommandBar function
This commit is contained in:
parent
b34c2a6f92
commit
478f6eb3b1
@ -50,6 +50,10 @@
|
||||
<paper-icon-button icon='mdi:stop'
|
||||
on-tap='onStop' title='Stop'></paper-icon-button>
|
||||
</div>
|
||||
<div hidden$='[[!supportsCleanSpot(stateObj)]]'>
|
||||
<paper-icon-button icon='mdi:broom'
|
||||
on-tap='onCleanSpot' title='Clean spot'></paper-icon-button>
|
||||
</div>
|
||||
<div hidden$='[[!supportsLocate(stateObj)]]'>
|
||||
<paper-icon-button icon='mdi:map-marker'
|
||||
on-tap='onLocate' title='Locate'></paper-icon-button>
|
||||
@ -136,11 +140,16 @@ Polymer({
|
||||
return (stateObj.attributes.supported_features & 512) !== 0;
|
||||
},
|
||||
|
||||
supportsCleanSpot: function (stateObj) {
|
||||
return (stateObj.attributes.supported_features & 1024) !== 0;
|
||||
},
|
||||
|
||||
supportsCommandBar: function (stateObj) {
|
||||
return (((stateObj.attributes.supported_features & 4) !== 0)
|
||||
| ((stateObj.attributes.supported_features & 8) !== 0)
|
||||
| ((stateObj.attributes.supported_features & 8) !== 0)
|
||||
| ((stateObj.attributes.supported_features & 512) !== 0));
|
||||
| ((stateObj.attributes.supported_features & 16) !== 0)
|
||||
| ((stateObj.attributes.supported_features & 512) !== 0)
|
||||
| ((stateObj.attributes.supported_features & 1024) !== 0));
|
||||
},
|
||||
|
||||
/* eslint-enable no-bitwise */
|
||||
@ -177,6 +186,12 @@ Polymer({
|
||||
});
|
||||
},
|
||||
|
||||
onCleanSpot: function () {
|
||||
this.hass.callService('vacuum', 'clean_spot', {
|
||||
entity_id: this.stateObj.entity_id
|
||||
});
|
||||
},
|
||||
|
||||
onReturnHome: function () {
|
||||
this.hass.callService('vacuum', 'return_to_base', {
|
||||
entity_id: this.stateObj.entity_id
|
||||
|
Loading…
x
Reference in New Issue
Block a user