mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-13 04:16:34 +00:00
Update canToggleState with toggleable climate (#782)
This commit is contained in:
parent
1d13126bb5
commit
0b9bd62251
@ -6,6 +6,9 @@ export default function canToggleState(hass, stateObj) {
|
||||
if (domain === 'group') {
|
||||
return stateObj.state === 'on' || stateObj.state === 'off';
|
||||
}
|
||||
if (domain === 'climate') {
|
||||
return !!((stateObj.attributes || {}).supported_features & 4096);
|
||||
}
|
||||
|
||||
return canToggleDomain(hass, domain);
|
||||
}
|
||||
|
@ -37,4 +37,21 @@ describe('canToggleState', () => {
|
||||
};
|
||||
assert.isFalse(canToggleState(hass, stateObj));
|
||||
});
|
||||
|
||||
it('Detects climate with toggle', () => {
|
||||
const stateObj = {
|
||||
entity_id: 'climate.bla',
|
||||
attributes: {
|
||||
supported_features: 4096,
|
||||
},
|
||||
};
|
||||
assert.isTrue(canToggleState(hass, stateObj));
|
||||
});
|
||||
|
||||
it('Detects climate without toggle', () => {
|
||||
const stateObj = {
|
||||
entity_id: 'climate.bla',
|
||||
};
|
||||
assert.isFalse(canToggleState(hass, stateObj));
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user