mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +00:00
Use custom off states in picture glance (#1462)
This commit is contained in:
parent
6db76c8ab4
commit
7c5c5ea9b6
@ -5,7 +5,6 @@ import '@polymer/paper-icon-button/paper-icon-button.js';
|
|||||||
import '../../../components/ha-card.js';
|
import '../../../components/ha-card.js';
|
||||||
import '../components/hui-image.js';
|
import '../components/hui-image.js';
|
||||||
|
|
||||||
import { STATES_OFF } from '../../../common/const.js';
|
|
||||||
import computeStateDisplay from '../../../common/entity/compute_state_display.js';
|
import computeStateDisplay from '../../../common/entity/compute_state_display.js';
|
||||||
import computeStateName from '../../../common/entity/compute_state_name.js';
|
import computeStateName from '../../../common/entity/compute_state_name.js';
|
||||||
import stateIcon from '../../../common/entity/state_icon.js';
|
import stateIcon from '../../../common/entity/state_icon.js';
|
||||||
@ -23,6 +22,13 @@ const DOMAINS_TOGGLE = new Set([
|
|||||||
'switch'
|
'switch'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const STATES_OFF = new Set([
|
||||||
|
'closed',
|
||||||
|
'locked',
|
||||||
|
'not_home',
|
||||||
|
'off'
|
||||||
|
]);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @appliesMixin EventsMixin
|
* @appliesMixin EventsMixin
|
||||||
* @appliesMixin LocalizeMixin
|
* @appliesMixin LocalizeMixin
|
||||||
@ -153,7 +159,7 @@ class HuiPictureGlanceCard extends NavigateMixin(LocalizeMixin(EventsMixin(Polym
|
|||||||
}
|
}
|
||||||
|
|
||||||
_computeButtonClass(entityId, states) {
|
_computeButtonClass(entityId, states) {
|
||||||
return STATES_OFF.includes(states[entityId].state) ? '' : 'state-on';
|
return STATES_OFF.has(states[entityId].state) ? '' : 'state-on';
|
||||||
}
|
}
|
||||||
|
|
||||||
_computeTooltip(entityId, states) {
|
_computeTooltip(entityId, states) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user