329 files
This commit is contained in:
1 parent
0df89406fa
commit
7afe7add1d
330 files changed
+13098
-5942
No files matched your search
@@ -1,5 +1,5 @@
|
||||
(function() {
|
||||
const env = {"DEBUG":true,"BUILD_TIME":"2026-07-17, 12:54 p.m."};
|
||||
const env = {"DEBUG":true,"BUILD_TIME":"2026-08-05, 05:24 p.m."};
|
||||
try {
|
||||
if (process) {
|
||||
process.env = Object.assign({}, process.env);
|
||||
@@ -11,7 +11,7 @@
|
||||
})();
|
||||
|
||||
var name = "simple-thermostat";
|
||||
var version = "4.1.0";
|
||||
var version = "4.2.0";
|
||||
|
||||
function __decorate(decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
@@ -112,6 +112,7 @@ var css_248z = i$4`:host {
|
||||
--st-font-size-compact-mode,
|
||||
var(--ha-font-size-m, 14px)
|
||||
);
|
||||
--st-entity-column-min-width: 160px;
|
||||
--st-active-icon-glow-duration: 4s;
|
||||
--st-active-icon-glow-min-size: 1px;
|
||||
--st-active-icon-glow-mid-size: 4px;
|
||||
@@ -119,6 +120,8 @@ var css_248z = i$4`:host {
|
||||
--st-active-icon-glow-min-strength: 28%;
|
||||
--st-active-icon-glow-mid-strength: 44%;
|
||||
--st-active-icon-glow-max-strength: 60%;
|
||||
--fan-color: #4f7f8d;
|
||||
--fan_only-color: var(--state-climate-fan-only-color, var(--fan-color));
|
||||
}
|
||||
ha-card {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
@@ -142,7 +145,6 @@ ha-card {
|
||||
--manual-color: #44739e;
|
||||
--on-color: var(--primary-color);
|
||||
--off-color: #8a8a8a;
|
||||
--fan_only-color: #8a8a8a;
|
||||
--dry-color: #efbd07;
|
||||
--st-mode-surface-background: color-mix(
|
||||
in srgb,
|
||||
@@ -254,18 +256,12 @@ ha-card.loading {
|
||||
.body {
|
||||
display: grid;
|
||||
grid-auto-flow: column;
|
||||
grid-auto-columns: minmax(0, 1fr);
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
grid-auto-columns: minmax(min-content, auto);
|
||||
align-items: center;
|
||||
justify-items: center;
|
||||
place-items: center;
|
||||
padding: 0 calc(var(--st-spacing, var(--st-default-spacing)) * 4);
|
||||
}
|
||||
.body > * {
|
||||
min-width: 0;
|
||||
}
|
||||
.body.has-entities.setpoint-count-2 {
|
||||
grid-template-columns:
|
||||
minmax(min-content, max-content) minmax(max-content, 1fr)
|
||||
@@ -276,7 +272,8 @@ ha-card.loading {
|
||||
}
|
||||
.body.has-entities.step-column.setpoint-count-2 {
|
||||
grid-template-columns:
|
||||
minmax(160px, max-content) minmax(max-content, 1fr)
|
||||
minmax(var(--st-entity-column-min-width), max-content)
|
||||
minmax(max-content, 1fr)
|
||||
minmax(max-content, 1fr);
|
||||
}
|
||||
|
||||
@@ -421,10 +418,9 @@ ha-card.loading {
|
||||
}
|
||||
.entity-heading {
|
||||
font-weight: 300;
|
||||
min-width: 0;
|
||||
padding-right: 8px;
|
||||
padding-bottom: 0;
|
||||
white-space: normal;
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
@@ -961,7 +957,7 @@ ha-card.cooling .header__icon-wrap::before {
|
||||
currentColor 50%,
|
||||
var(--st-mode-color, var(--primary-color)) 50%
|
||||
);
|
||||
--st-mode-default-active-accent-color: var(--st-mode-accent-color);
|
||||
--st-mode-active-accent-color: var(--st-mode-accent-color);
|
||||
--st-mode-neutral-hover-background: color-mix(
|
||||
in srgb,
|
||||
var(--st-mode-background, var(--secondary-background-color)) 88%,
|
||||
@@ -1025,10 +1021,7 @@ ha-card.cooling .header__icon-wrap::before {
|
||||
box-shadow: inset 0 -2px 0
|
||||
var(
|
||||
--st-mode-active-accent-color,
|
||||
var(
|
||||
--st-mode-default-active-accent-color,
|
||||
color-mix(in srgb, var(--text-primary-color) 72%, transparent)
|
||||
)
|
||||
color-mix(in srgb, var(--text-primary-color) 72%, transparent)
|
||||
);
|
||||
filter: none;
|
||||
transform: none;
|
||||
@@ -1052,9 +1045,10 @@ ha-card.cooling .header__icon-wrap::before {
|
||||
.mode-item.active::after {
|
||||
background: var(
|
||||
--st-mode-active-accent-color,
|
||||
var(--st-mode-default-active-accent-color)
|
||||
color-mix(in srgb, var(--text-primary-color) 72%, transparent)
|
||||
);
|
||||
opacity: 0.64;
|
||||
opacity: var(--st-mode-active-accent-opacity, 0.64);
|
||||
transform: scaleX(1);
|
||||
transition: none;
|
||||
}
|
||||
@@ -1281,11 +1275,19 @@ ha-card.drying {
|
||||
|
||||
.modes.hvac.sparse .mode-item,
|
||||
.modes.state.sparse .mode-item {
|
||||
gap: 2px;
|
||||
gap: var(--st-sparse-control-gap, 2px);
|
||||
min-width: 0;
|
||||
min-height: calc(var(--st-control-icon-size) + 8px);
|
||||
padding-top: var(--st-spacing, var(--st-default-spacing));
|
||||
padding-bottom: var(--st-spacing, var(--st-default-spacing));
|
||||
}
|
||||
|
||||
.modes.hvac.sparse .mode-label,
|
||||
.modes.state.sparse .mode-label {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@media (max-width: 560px) {
|
||||
.modes.hvac .mode-item,
|
||||
.modes.state .mode-item {
|
||||
@@ -1298,9 +1300,9 @@ ha-card.drying {
|
||||
ha-card:not(.standard-visuals) .modes.hvac.sparse .mode-item,
|
||||
ha-card:not(.standard-visuals) .modes.state.sparse .mode-item {
|
||||
flex-direction: row;
|
||||
gap: 6px;
|
||||
min-width: min(100%, 120px);
|
||||
min-width: min(100%, var(--st-hvac-mode-min-width, 120px));
|
||||
gap: 2px;
|
||||
gap: var(--st-sparse-control-gap, 2px);
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
.modes.dense {
|
||||
@@ -1335,6 +1337,15 @@ ha-card.drying {
|
||||
height: var(--st-preset-icon-size);
|
||||
}
|
||||
|
||||
.modes.hvac.dense .mode-icon,
|
||||
.modes.state.dense .mode-icon {
|
||||
--iron-icon-width: var(--st-control-icon-size);
|
||||
--iron-icon-height: var(--st-control-icon-size);
|
||||
--mdc-icon-size: var(--st-control-icon-size);
|
||||
width: var(--st-control-icon-size);
|
||||
height: var(--st-control-icon-size);
|
||||
}
|
||||
|
||||
.modes.dense .mode-label {
|
||||
display: block;
|
||||
min-height: 0;
|
||||
@@ -1420,6 +1431,7 @@ ha-card.drying {
|
||||
}
|
||||
.modes.fan .mode-item,
|
||||
.modes.fan-preset .mode-item {
|
||||
--st-mode-color: var(--fan_only-color);
|
||||
--st-mode-min-width: 88px;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
@@ -1653,32 +1665,74 @@ ha-card.standard-visuals .mode-item.active {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
ha-card .mode-item.active.off,
|
||||
ha-card .mode-item.active.off:hover {
|
||||
background: var(--off-color);
|
||||
--st-mode-active-background: var(--off-color);
|
||||
}
|
||||
|
||||
ha-card .mode-item.active.heat,
|
||||
ha-card .mode-item.active.heat:hover {
|
||||
background: var(--heat-color);
|
||||
--st-mode-active-background: var(--heat-color);
|
||||
}
|
||||
|
||||
ha-card .mode-item.active.cool,
|
||||
ha-card .mode-item.active.cool:hover {
|
||||
background: var(--cool-color);
|
||||
--st-mode-active-background: var(--cool-color);
|
||||
}
|
||||
|
||||
ha-card .mode-item.active.heat_cool,
|
||||
ha-card .mode-item.active.heat_cool:hover {
|
||||
background: var(--heat_cool-color);
|
||||
--st-mode-active-background: var(--heat_cool-color);
|
||||
}
|
||||
|
||||
ha-card .mode-item.active.auto,
|
||||
ha-card .mode-item.active.auto:hover {
|
||||
background: var(--auto-color);
|
||||
--st-mode-active-background: var(--auto-color);
|
||||
}
|
||||
|
||||
ha-card .mode-item.active.dry,
|
||||
ha-card .mode-item.active.dry:hover {
|
||||
background: var(--dry-color);
|
||||
--st-mode-active-background: var(--dry-color);
|
||||
}
|
||||
|
||||
ha-card .mode-item.active.fan_only,
|
||||
ha-card .mode-item.active.fan_only:hover {
|
||||
background: var(--fan_only-color);
|
||||
--st-mode-active-background: var(--fan_only-color);
|
||||
}
|
||||
|
||||
ha-card.standard-visuals .mode-item.active.off {
|
||||
background: var(--st-mode-active-background, var(--off-color));
|
||||
background: var(--off-color);
|
||||
}
|
||||
|
||||
ha-card.standard-visuals .mode-item.active.heat {
|
||||
background: var(--st-mode-active-background, var(--heat-color));
|
||||
background: var(--heat-color);
|
||||
}
|
||||
|
||||
ha-card.standard-visuals .mode-item.active.cool {
|
||||
background: var(--st-mode-active-background, var(--cool-color));
|
||||
background: var(--cool-color);
|
||||
}
|
||||
|
||||
ha-card.standard-visuals .mode-item.active.heat_cool {
|
||||
background: var(--st-mode-active-background, var(--heat_cool-color));
|
||||
background: var(--heat_cool-color);
|
||||
}
|
||||
|
||||
ha-card.standard-visuals .mode-item.active.auto {
|
||||
background: var(--st-mode-active-background, var(--auto-color));
|
||||
background: var(--auto-color);
|
||||
}
|
||||
|
||||
ha-card.standard-visuals .mode-item.active.dry {
|
||||
background: var(--st-mode-active-background, var(--dry-color));
|
||||
background: var(--dry-color);
|
||||
}
|
||||
|
||||
ha-card.standard-visuals .mode-item.active.fan_only {
|
||||
background: var(--st-mode-active-background, var(--fan_only-color));
|
||||
background: var(--fan_only-color);
|
||||
}
|
||||
|
||||
ha-card.standard-visuals .mode-item:active,
|
||||
@@ -1949,8 +2003,12 @@ const fanAdapter = {
|
||||
percentage: attributes.percentage,
|
||||
};
|
||||
},
|
||||
getRange(_attributes) {
|
||||
return { min: 0, max: 100, step: 1 };
|
||||
getRange(attributes) {
|
||||
const percentageStep = Number(attributes?.percentage_step);
|
||||
const step = Number.isFinite(percentageStep) && percentageStep > 0
|
||||
? percentageStep
|
||||
: 1;
|
||||
return { min: 0, max: 100, step };
|
||||
},
|
||||
getCurrentValue(attributes) {
|
||||
return attributes?.current_temperature ?? attributes?.temperature ?? null;
|
||||
@@ -2131,6 +2189,7 @@ const LABELS = {
|
||||
unit: 'Unit',
|
||||
'layout.step': 'Step layout',
|
||||
step_size: 'Step size',
|
||||
setpoint_debounce_ms: 'Target debounce',
|
||||
fallback: 'Fallback text',
|
||||
'hide.temperature': 'Hide current value',
|
||||
hide_current_value_when_off: 'Hide current value while off',
|
||||
@@ -2195,6 +2254,7 @@ const DIRECT_FORM_PATHS = [
|
||||
'layout.entities.labels',
|
||||
'layout.entities.separator',
|
||||
'layout.entities.alignment',
|
||||
'setpoint_debounce_ms',
|
||||
'hide.temperature',
|
||||
'hide_current_value_when_off',
|
||||
'hide.state',
|
||||
@@ -2369,7 +2429,7 @@ function materializeControlOrder(config) {
|
||||
if (orderedTypes.length === 0 && !Array.isArray(control._order)) {
|
||||
return { config, changed: false };
|
||||
}
|
||||
let changed = !Array.isArray(control._order) ||
|
||||
let changed = Array.isArray(control._order) &&
|
||||
!areStringArraysEqual(control._order, orderedTypes);
|
||||
const nextConfig = {
|
||||
...config,
|
||||
@@ -2378,9 +2438,11 @@ function materializeControlOrder(config) {
|
||||
result[type] = materialized.value;
|
||||
changed = changed || materialized.changed;
|
||||
return result;
|
||||
}, { _order: orderedTypes }),
|
||||
}, (Array.isArray(control._order)
|
||||
? { _order: orderedTypes }
|
||||
: {})),
|
||||
};
|
||||
return { config: nextConfig, changed };
|
||||
return { config: changed ? nextConfig : config, changed };
|
||||
}
|
||||
function buildSchema(config, hass) {
|
||||
const supportedControlTypes = getSupportedControlTypes(config, hass);
|
||||
@@ -2583,6 +2645,10 @@ function buildSchema(config, hass) {
|
||||
]
|
||||
: []),
|
||||
{ name: 'fallback', selector: { text: {} } },
|
||||
{
|
||||
name: 'setpoint_debounce_ms',
|
||||
selector: { number: { min: 0, step: 100, mode: 'box' } },
|
||||
},
|
||||
{
|
||||
type: 'grid',
|
||||
column_min_width: '160px',
|
||||
@@ -2678,9 +2744,12 @@ class SimpleThermostatEditor extends i$1 {
|
||||
'layout.mode.headings': this.config.layout?.mode?.headings === true,
|
||||
decimals: this.config.decimals ?? '',
|
||||
unit: typeof this.config.unit === 'string' ? this.config.unit : '',
|
||||
'layout.step': this.config.layout?.step ?? 'column',
|
||||
'layout.step': this.config.enhanced_visuals === false
|
||||
? (this.config.layout?.step ?? 'column')
|
||||
: (this.config.layout?.step ?? 'row'),
|
||||
step_size: this.config.step_size != null ? String(this.config.step_size) : 'auto',
|
||||
fallback: this.config.fallback ?? '',
|
||||
setpoint_debounce_ms: this.config.setpoint_debounce_ms ?? '',
|
||||
'hide.temperature': this.config.hide?.temperature === true,
|
||||
hide_current_value_when_off: this.config.hide_current_value_when_off === true ||
|
||||
this.config.hide?.current_value_when_off === true ||
|
||||
@@ -3169,6 +3238,21 @@ class SimpleThermostatGroupEditor extends i$1 {
|
||||
...(enabled ? { auto_select: { mode: 'recent_activity' } } : {}),
|
||||
});
|
||||
}
|
||||
updateRememberSelection(enabled) {
|
||||
const { remember_selection: _rememberSelection, ...config } = this.config;
|
||||
this.commit({
|
||||
...config,
|
||||
...(enabled ? {} : { remember_selection: false }),
|
||||
});
|
||||
}
|
||||
updateStorageKey(value) {
|
||||
const storageKey = value.trim();
|
||||
const { storage_key: _storageKey, ...config } = this.config;
|
||||
this.commit({
|
||||
...config,
|
||||
...(storageKey ? { storage_key: storageKey } : {}),
|
||||
});
|
||||
}
|
||||
getTargetCardConfig(target) {
|
||||
const { name: name$1, icon, ...config } = target;
|
||||
const header = config.header && typeof config.header === 'object'
|
||||
@@ -3292,10 +3376,16 @@ class SimpleThermostatGroupEditor extends i$1 {
|
||||
</div>
|
||||
<div class="selector-options">
|
||||
${this.renderOption('Follow active device', 'Switch to a card when its mode or on/off activity changes.', this.isAutoSelectEnabled(), (checked) => this.updateAutoSelect(checked))}
|
||||
${this.renderOption('Remember selection', 'Keep the last selected card after the dashboard reloads.', this.config.remember_selection !== false, (checked) => this.updateRememberSelection(checked))}
|
||||
${this.renderOption('Show icons', 'Show each card icon in the selector and menu.', selector.icons !== false, (checked) => this.updateSelector('icons', checked))}
|
||||
${this.renderOption('Show names', 'Show card names in the selector and menu.', selector.names !== false, (checked) => this.updateSelector('names', checked))}
|
||||
${this.renderOption('Show states', 'Show current states in the selector menu.', selector.states === true, (checked) => this.updateSelector('states', checked))}
|
||||
</div>
|
||||
<ha-textfield
|
||||
label="Storage key"
|
||||
.value=${this.config.storage_key ?? ''}
|
||||
@input=${(ev) => this.updateStorageKey(ev.target.value)}
|
||||
></ha-textfield>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
@@ -3400,7 +3490,7 @@ const CLIMATE_COOLING_STATE_ICONS = {
|
||||
const CLIMATE_HEATING_STATE_ICONS = {
|
||||
...STATE_ICONS,
|
||||
auto: 'mdi:radiator',
|
||||
idle: 'mdi:radiator',
|
||||
idle: STATE_ICONS.idle,
|
||||
off: 'mdi:radiator',
|
||||
};
|
||||
const DOMAIN_STATE_ICONS = {
|
||||
@@ -3552,10 +3642,13 @@ function parseToggles(config, hass) {
|
||||
}
|
||||
function getDefaultHeaderIcon(entity) {
|
||||
const [entityDomain] = entity.entity_id.split('.');
|
||||
return (entity.attributes.icon ??
|
||||
const action = getEntityAction(entity);
|
||||
const climateActionIcons = action ? getClimateHeaderIcons(entity) : undefined;
|
||||
return (climateActionIcons ??
|
||||
entity.attributes.icon ??
|
||||
getClimateHeaderIcons(entity) ??
|
||||
DOMAIN_STATE_ICONS[entityDomain]?.[entity.state] ??
|
||||
(getEntityAction(entity) ? STATE_ICONS : MODE_ICONS));
|
||||
(action ? STATE_ICONS : MODE_ICONS));
|
||||
}
|
||||
function getLegacyHeaderIcon(entity) {
|
||||
return getEntityAction(entity) ? STATE_ICONS : MODE_ICONS;
|
||||
@@ -3711,7 +3804,7 @@ class SimpleThermostatGroup extends i$1 {
|
||||
);
|
||||
min-width: 0;
|
||||
box-sizing: border-box;
|
||||
transform: translateY(var(--st-group-header-top-buffer, 6px));
|
||||
transform: translateY(var(--st-group-header-top-buffer, 2px));
|
||||
}
|
||||
|
||||
.group-title {
|
||||
@@ -3720,6 +3813,7 @@ class SimpleThermostatGroup extends i$1 {
|
||||
overflow: hidden;
|
||||
text-overflow: clip;
|
||||
white-space: nowrap;
|
||||
transition: color 180ms var(--st-motion-ease, ease);
|
||||
font-size: var(
|
||||
--st-group-title-fit-size,
|
||||
var(
|
||||
@@ -3772,7 +3866,7 @@ class SimpleThermostatGroup extends i$1 {
|
||||
appearance: none;
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
background: var(--secondary-background-color);
|
||||
background: transparent;
|
||||
color: var(--primary-text-color);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -3783,6 +3877,17 @@ class SimpleThermostatGroup extends i$1 {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.group-nav:hover:not(:disabled),
|
||||
.group-nav:focus-visible,
|
||||
.group-menu:hover,
|
||||
.group-menu:focus-visible {
|
||||
background: color-mix(
|
||||
in srgb,
|
||||
var(--primary-text-color) 10%,
|
||||
transparent
|
||||
);
|
||||
}
|
||||
|
||||
.group-nav ha-icon,
|
||||
.group-menu ha-icon {
|
||||
--mdc-icon-size: 24px;
|
||||
@@ -3799,7 +3904,6 @@ class SimpleThermostatGroup extends i$1 {
|
||||
grid-area: menu;
|
||||
width: 20px;
|
||||
height: 34px;
|
||||
background: transparent;
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
|
||||
@@ -3958,6 +4062,26 @@ class SimpleThermostatGroup extends i$1 {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.header__main.clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.header__main.clickable:focus-visible {
|
||||
outline: 2px solid var(--primary-color);
|
||||
outline-offset: 2px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.header__main.clickable:focus-visible .header__title {
|
||||
color: var(--st-interactive-tint, var(--primary-color));
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
.header__main.clickable:hover .header__title {
|
||||
color: var(--st-interactive-tint, var(--primary-color));
|
||||
}
|
||||
}
|
||||
|
||||
.header__icon-wrap {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
@@ -4159,6 +4283,19 @@ class SimpleThermostatGroup extends i$1 {
|
||||
this.syncOutsideClickListener();
|
||||
this.syncTitleFit();
|
||||
}
|
||||
getCardSize() {
|
||||
if (!this.config || !this.targets.length)
|
||||
return 1;
|
||||
const target = this.getSelectedTarget();
|
||||
const cardConfig = this.getTargetCardConfig(target);
|
||||
const entityCount = Array.isArray(cardConfig.entities)
|
||||
? cardConfig.entities.length
|
||||
: 0;
|
||||
const entityRows = entityCount ? Math.max(1, Math.ceil(entityCount / 2)) : 0;
|
||||
const modeRows = this.getConfiguredModeRowCount(cardConfig);
|
||||
const setpointRows = cardConfig.hide_setpoint === true ? 0 : 1;
|
||||
return Math.max(2, 1 + entityRows + setpointRows + modeRows);
|
||||
}
|
||||
disconnectedCallback() {
|
||||
this.clearOutsideClickListener();
|
||||
this.clearAutoSelectResumeTimer();
|
||||
@@ -4257,6 +4394,18 @@ class SimpleThermostatGroup extends i$1 {
|
||||
getActivityStorageKey(config) {
|
||||
return `${this.getStorageKey(config)}:recent-activity`;
|
||||
}
|
||||
getConfiguredModeRowCount(cardConfig) {
|
||||
const control = cardConfig.control;
|
||||
if (control === false)
|
||||
return 0;
|
||||
if (Array.isArray(control)) {
|
||||
return control.filter(Boolean).length;
|
||||
}
|
||||
if (control && typeof control === 'object') {
|
||||
return Object.entries(control).filter(([key, value]) => !key.startsWith('_') && value !== false).length;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
clearAutoSelectResumeTimer() {
|
||||
if (this.autoSelectResumeTimer === undefined)
|
||||
return;
|
||||
@@ -4271,6 +4420,20 @@ class SimpleThermostatGroup extends i$1 {
|
||||
const target = this.getSelectedTarget();
|
||||
return this.hass?.states?.[target.entity];
|
||||
}
|
||||
openSelectedPopover() {
|
||||
const target = this.getSelectedTarget();
|
||||
if (!target?.entity)
|
||||
return;
|
||||
fireEvent(this, 'hass-more-info', {
|
||||
entityId: target.entity,
|
||||
});
|
||||
}
|
||||
onSelectorHeaderKeyDown(ev) {
|
||||
if (ev.key !== 'Enter' && ev.key !== ' ')
|
||||
return;
|
||||
ev.preventDefault();
|
||||
this.openSelectedPopover();
|
||||
}
|
||||
getGroupCardClasses() {
|
||||
const state = this.getSelectedState();
|
||||
if (!state)
|
||||
@@ -4727,7 +4890,7 @@ class SimpleThermostatGroup extends i$1 {
|
||||
}
|
||||
}
|
||||
getEmbeddedHeaderReserve(embedded, selector) {
|
||||
const fallback = 'calc(var(--st-group-header-control-height, 34px) + var(--st-group-header-top-buffer, 6px) + calc(var(--st-spacing, var(--st-default-spacing, 4px)) * 6))';
|
||||
const fallback = 'calc(var(--st-group-header-control-height, 34px) + var(--st-group-header-top-buffer, 2px) + calc(var(--st-spacing, var(--st-default-spacing, 4px)) * 6))';
|
||||
const minimum = this.getEmbeddedHeaderReserveMinimum();
|
||||
if (!selector)
|
||||
return fallback;
|
||||
@@ -4741,7 +4904,7 @@ class SimpleThermostatGroup extends i$1 {
|
||||
const styles = getComputedStyle(this);
|
||||
const controlHeight = parseFloat(styles.getPropertyValue('--st-group-header-control-height')) ||
|
||||
34;
|
||||
const topBuffer = parseFloat(styles.getPropertyValue('--st-group-header-top-buffer')) || 6;
|
||||
const topBuffer = parseFloat(styles.getPropertyValue('--st-group-header-top-buffer')) || 2;
|
||||
const spacing = parseFloat(styles.getPropertyValue('--st-spacing')) ||
|
||||
parseFloat(styles.getPropertyValue('--st-default-spacing')) ||
|
||||
4;
|
||||
@@ -4927,7 +5090,13 @@ class SimpleThermostatGroup extends i$1 {
|
||||
return b `
|
||||
<div class="group-selector">
|
||||
<div class="group-header-content">
|
||||
<div class="header__main">
|
||||
<div
|
||||
class="header__main clickable"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
@click=${() => this.openSelectedPopover()}
|
||||
@keydown=${(ev) => this.onSelectorHeaderKeyDown(ev)}
|
||||
>
|
||||
${this.renderHeaderIcon(target)}
|
||||
<div class="group-title header__title" title=${label}>${label}</div>
|
||||
</div>
|
||||
@@ -5502,7 +5671,7 @@ function renderTemplate({ template, stateObj, attribute, hass, config = {}, vari
|
||||
}));
|
||||
});
|
||||
squirrelly_minExports.filters.define('relativetime', (str) => {
|
||||
return `<ha-relative-time fwd-datetime=${str} with-hass></ha-relative-time>`;
|
||||
return `<ha-relative-time datetime="${escapeAttribute(str)}"></ha-relative-time>`;
|
||||
});
|
||||
squirrelly_minExports.filters.define('translate', (str, prefix = '') => {
|
||||
if (!prefix &&
|
||||
@@ -5897,7 +6066,8 @@ function renderEntities({ _hide, entity, unit, hass, entities, config, localize,
|
||||
: (adapter.getCurrentValueUnit?.(entity.attributes, hass.config) ?? unit);
|
||||
const showLabels = config?.layout?.entities?.labels ?? true;
|
||||
const showSeparator = config?.layout?.entities?.separator !== false;
|
||||
const stateString = getEntityStateText(entity, hass, localize);
|
||||
const stateString = config?.state_labels?.[entity.state] ??
|
||||
getEntityStateText(entity, hass, localize);
|
||||
const hideTemperatureWhenOff = (config?.hide_current_value_when_off === true ||
|
||||
config?.hide?.current_value_when_off === true ||
|
||||
config?.hide?.temperature_when_off === true) &&
|
||||
@@ -6112,7 +6282,8 @@ function renderModeType({ state, entity, hass, mode: options, adapter, modeOptio
|
||||
const headings = modeOptions?.headings === true || heading === true;
|
||||
const showHeading = headings && title !== false;
|
||||
const isFanPreset = type === 'preset' && adapter.getLocalizationDomain() === 'fan';
|
||||
const sparseMainControls = (type === 'hvac' || type === 'state') && list.length <= 3;
|
||||
const sparseMainControls = (type === 'hvac' || type === 'state' || type === 'fan') &&
|
||||
list.length <= 4;
|
||||
const compact = (type === 'preset' && list.length <= 4) ||
|
||||
[
|
||||
'swing',
|
||||
@@ -6122,8 +6293,8 @@ function renderModeType({ state, entity, hass, mode: options, adapter, modeOptio
|
||||
'vane_vertical',
|
||||
].includes(type);
|
||||
const dense = list.length > 4 ||
|
||||
(type === 'hvac' && list.length > 3) ||
|
||||
(type === 'fan' && list.length > 3);
|
||||
(type === 'hvac' && list.length > 4) ||
|
||||
(type === 'fan' && list.length > 4);
|
||||
const safeClass = (value) => String(value).replace(/[^a-z0-9_-]/gi, '');
|
||||
return b `
|
||||
<div
|
||||
@@ -6503,7 +6674,7 @@ function shouldPreserveConfiguredControlOrder(control) {
|
||||
return true;
|
||||
if (!control || typeof control !== 'object')
|
||||
return false;
|
||||
return Object.keys(control).length > 0;
|
||||
return Array.isArray(control._order);
|
||||
}
|
||||
class SimpleThermostat extends i$1 {
|
||||
constructor() {
|
||||
@@ -6848,8 +7019,9 @@ class SimpleThermostat extends i$1 {
|
||||
const unit = this.getUnit();
|
||||
const entityDomain = config.entity.split('.')[0];
|
||||
const setpointCount = Object.keys(_values).length;
|
||||
const configuredStepLayout = this.config?.layout?.step;
|
||||
const stepLayout = configuredStepLayout ?? 'column';
|
||||
const stepLayout = this.config.enhanced_visuals === false
|
||||
? (this.config?.layout?.step ?? 'column')
|
||||
: (this.config?.layout?.step ?? 'row');
|
||||
const row = stepLayout === 'row';
|
||||
const isUnavailable = ['unavailable', 'unknown'].includes(entity.state);
|
||||
const safeClass = (value) => typeof value === 'string' ? value.replace(/[^a-z0-9_-]/gi, '') : '';
|
||||
@@ -7029,6 +7201,14 @@ class SimpleThermostat extends i$1 {
|
||||
...this.config,
|
||||
locale: this._hass.locale,
|
||||
});
|
||||
const unitText = showUnit && typeof unit === 'string' ? unit : '';
|
||||
const unitSeparator = unitText === '%' ? '' : ' ';
|
||||
const valueText = unitText && displayValue.endsWith(unitText)
|
||||
? displayValue.slice(0, -unitText.length).trimEnd()
|
||||
: displayValue;
|
||||
const displayWithUnit = unitText
|
||||
? `${valueText}${unitSeparator}${unitText}`
|
||||
: displayValue;
|
||||
return b `
|
||||
<h3
|
||||
@pointerdown=${this._onActionPointerDown}
|
||||
@@ -7038,7 +7218,7 @@ class SimpleThermostat extends i$1 {
|
||||
@keydown=${this._onSetpointKeyDown}
|
||||
role="button"
|
||||
tabindex="0"
|
||||
aria-label=${`${field}: ${displayValue}${showUnit ? ` ${unit}` : ''}`}
|
||||
aria-label=${`${field}: ${displayWithUnit}`}
|
||||
class=${[
|
||||
'current--value',
|
||||
showOffFallback && 'current--off',
|
||||
@@ -7047,7 +7227,9 @@ class SimpleThermostat extends i$1 {
|
||||
.filter(Boolean)
|
||||
.join(' ')}
|
||||
>
|
||||
${appendUnit(displayValue, showUnit ? unit : false)}
|
||||
${valueText}${unitText
|
||||
? b `${unitSeparator}<span class="current--unit">${unitText}</span>`
|
||||
: A}
|
||||
</h3>
|
||||
`;
|
||||
}
|
||||
@@ -7103,7 +7285,12 @@ class SimpleThermostat extends i$1 {
|
||||
this.entity?.state === HVAC_MODES.OFF)
|
||||
? 0
|
||||
: 1;
|
||||
const modeRows = this.modes?.length ?? 0;
|
||||
const modeRows = this.modes?.filter((mode) => {
|
||||
if (mode.hide_when_off === true && this.entity?.state === HVAC_MODES.OFF) {
|
||||
return false;
|
||||
}
|
||||
return (mode.list ?? []).some(({ hide_when_off }) => !(hide_when_off === true && this.entity?.state === HVAC_MODES.OFF));
|
||||
}).length ?? 0;
|
||||
const warningRows = this.stepSize < 1 && this.config.decimals === 0 ? 1 : 0;
|
||||
return Math.max(1, headerRows + entityRows + setpointRows + modeRows + warningRows);
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
!function(){const t={DEBUG:!1,BUILD_TIME:"2026-07-17, 12:54 p.m."};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}();var t="simple-thermostat",e="4.1.0";function i(t,e,i,o){var a,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(n=(r<3?a(n):r>3?a(e,i,n):a(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n}"function"==typeof SuppressedError&&SuppressedError;const o=globalThis,a=o.ShadowRoot&&(void 0===o.ShadyCSS||o.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),n=new WeakMap;let s=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(a&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=n.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&n.set(e,t))}return t}toString(){return this.cssText}};const c=(t,...e)=>{const i=1===t.length?t[0]:e.reduce((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1],t[0]);return new s(i,t,r)},l=a?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new s("string"==typeof t?t:t+"",void 0,r))(e)})(t):t,{is:d,defineProperty:h,getOwnPropertyDescriptor:u,getOwnPropertyNames:p,getOwnPropertySymbols:g,getPrototypeOf:m}=Object,f=globalThis,v=f.trustedTypes,y=v?v.emptyScript:"",_=f.reactiveElementPolyfillSupport,b=(t,e)=>t,w={toAttribute(t,e){switch(e){case Boolean:t=t?y:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},x=(t,e)=>!d(t,e),$={attribute:!0,type:String,converter:w,reflect:!1,useDefault:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;let S=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=$){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),o=this.getPropertyDescriptor(t,i,e);void 0!==o&&h(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){const{get:o,set:a}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:o,set(e){const r=o?.call(this);a?.call(this,e),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??$}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const t=m(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const t=this.properties,e=[...p(t),...g(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(a)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of e){const e=document.createElement("style"),a=o.litNonce;Line truncated
|
||||
!function(){const t={DEBUG:!1,BUILD_TIME:"2026-08-05, 05:24 p.m."};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}();var t="simple-thermostat",e="4.2.0";function i(t,e,i,o){var a,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(n=(r<3?a(n):r>3?a(e,i,n):a(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n}"function"==typeof SuppressedError&&SuppressedError;const o=globalThis,a=o.ShadowRoot&&(void 0===o.ShadyCSS||o.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),n=new WeakMap;let s=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(a&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=n.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&n.set(e,t))}return t}toString(){return this.cssText}};const c=(t,...e)=>{const i=1===t.length?t[0]:e.reduce((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1],t[0]);return new s(i,t,r)},l=a?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new s("string"==typeof t?t:t+"",void 0,r))(e)})(t):t,{is:d,defineProperty:h,getOwnPropertyDescriptor:u,getOwnPropertyNames:p,getOwnPropertySymbols:g,getPrototypeOf:m}=Object,f=globalThis,v=f.trustedTypes,y=v?v.emptyScript:"",_=f.reactiveElementPolyfillSupport,b=(t,e)=>t,w={toAttribute(t,e){switch(e){case Boolean:t=t?y:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},x=(t,e)=>!d(t,e),$={attribute:!0,type:String,converter:w,reflect:!1,useDefault:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;let S=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=$){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),o=this.getPropertyDescriptor(t,i,e);void 0!==o&&h(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){const{get:o,set:a}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:o,set(e){const r=o?.call(this);a?.call(this,e),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??$}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const t=m(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const t=this.properties,e=[...p(t),...g(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(a)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of e){const e=document.createElement("style"),a=o.litNonce;Line truncated
|
||||
display: block;
|
||||
isolation: isolate;
|
||||
max-width: 100%;
|
||||
@@ -18,6 +18,7 @@
|
||||
--st-font-size-compact-mode,
|
||||
var(--ha-font-size-m, 14px)
|
||||
);
|
||||
--st-entity-column-min-width: 160px;
|
||||
--st-active-icon-glow-duration: 4s;
|
||||
--st-active-icon-glow-min-size: 1px;
|
||||
--st-active-icon-glow-mid-size: 4px;
|
||||
@@ -25,6 +26,8 @@
|
||||
--st-active-icon-glow-min-strength: 28%;
|
||||
--st-active-icon-glow-mid-strength: 44%;
|
||||
--st-active-icon-glow-max-strength: 60%;
|
||||
--fan-color: #4f7f8d;
|
||||
--fan_only-color: var(--state-climate-fan-only-color, var(--fan-color));
|
||||
}
|
||||
ha-card {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
@@ -48,7 +51,6 @@ ha-card {
|
||||
--manual-color: #44739e;
|
||||
--on-color: var(--primary-color);
|
||||
--off-color: #8a8a8a;
|
||||
--fan_only-color: #8a8a8a;
|
||||
--dry-color: #efbd07;
|
||||
--st-mode-surface-background: color-mix(
|
||||
in srgb,
|
||||
@@ -160,18 +162,12 @@ ha-card.loading {
|
||||
.body {
|
||||
display: grid;
|
||||
grid-auto-flow: column;
|
||||
grid-auto-columns: minmax(0, 1fr);
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
grid-auto-columns: minmax(min-content, auto);
|
||||
align-items: center;
|
||||
justify-items: center;
|
||||
place-items: center;
|
||||
padding: 0 calc(var(--st-spacing, var(--st-default-spacing)) * 4);
|
||||
}
|
||||
.body > * {
|
||||
min-width: 0;
|
||||
}
|
||||
.body.has-entities.setpoint-count-2 {
|
||||
grid-template-columns:
|
||||
minmax(min-content, max-content) minmax(max-content, 1fr)
|
||||
@@ -182,7 +178,8 @@ ha-card.loading {
|
||||
}
|
||||
.body.has-entities.step-column.setpoint-count-2 {
|
||||
grid-template-columns:
|
||||
minmax(160px, max-content) minmax(max-content, 1fr)
|
||||
minmax(var(--st-entity-column-min-width), max-content)
|
||||
minmax(max-content, 1fr)
|
||||
minmax(max-content, 1fr);
|
||||
}
|
||||
|
||||
@@ -327,10 +324,9 @@ ha-card.loading {
|
||||
}
|
||||
.entity-heading {
|
||||
font-weight: 300;
|
||||
min-width: 0;
|
||||
padding-right: 8px;
|
||||
padding-bottom: 0;
|
||||
white-space: normal;
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
@@ -867,7 +863,7 @@ ha-card.cooling .header__icon-wrap::before {
|
||||
currentColor 50%,
|
||||
var(--st-mode-color, var(--primary-color)) 50%
|
||||
);
|
||||
--st-mode-default-active-accent-color: var(--st-mode-accent-color);
|
||||
--st-mode-active-accent-color: var(--st-mode-accent-color);
|
||||
--st-mode-neutral-hover-background: color-mix(
|
||||
in srgb,
|
||||
var(--st-mode-background, var(--secondary-background-color)) 88%,
|
||||
@@ -931,10 +927,7 @@ ha-card.cooling .header__icon-wrap::before {
|
||||
box-shadow: inset 0 -2px 0
|
||||
var(
|
||||
--st-mode-active-accent-color,
|
||||
var(
|
||||
--st-mode-default-active-accent-color,
|
||||
color-mix(in srgb, var(--text-primary-color) 72%, transparent)
|
||||
)
|
||||
color-mix(in srgb, var(--text-primary-color) 72%, transparent)
|
||||
);
|
||||
filter: none;
|
||||
transform: none;
|
||||
@@ -958,9 +951,10 @@ ha-card.cooling .header__icon-wrap::before {
|
||||
.mode-item.active::after {
|
||||
background: var(
|
||||
--st-mode-active-accent-color,
|
||||
var(--st-mode-default-active-accent-color)
|
||||
color-mix(in srgb, var(--text-primary-color) 72%, transparent)
|
||||
);
|
||||
opacity: 0.64;
|
||||
opacity: var(--st-mode-active-accent-opacity, 0.64);
|
||||
transform: scaleX(1);
|
||||
transition: none;
|
||||
}
|
||||
@@ -1187,11 +1181,19 @@ ha-card.drying {
|
||||
|
||||
.modes.hvac.sparse .mode-item,
|
||||
.modes.state.sparse .mode-item {
|
||||
gap: 2px;
|
||||
gap: var(--st-sparse-control-gap, 2px);
|
||||
min-width: 0;
|
||||
min-height: calc(var(--st-control-icon-size) + 8px);
|
||||
padding-top: var(--st-spacing, var(--st-default-spacing));
|
||||
padding-bottom: var(--st-spacing, var(--st-default-spacing));
|
||||
}
|
||||
|
||||
.modes.hvac.sparse .mode-label,
|
||||
.modes.state.sparse .mode-label {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@media (max-width: 560px) {
|
||||
.modes.hvac .mode-item,
|
||||
.modes.state .mode-item {
|
||||
@@ -1204,9 +1206,9 @@ ha-card.drying {
|
||||
ha-card:not(.standard-visuals) .modes.hvac.sparse .mode-item,
|
||||
ha-card:not(.standard-visuals) .modes.state.sparse .mode-item {
|
||||
flex-direction: row;
|
||||
gap: 6px;
|
||||
min-width: min(100%, 120px);
|
||||
min-width: min(100%, var(--st-hvac-mode-min-width, 120px));
|
||||
gap: 2px;
|
||||
gap: var(--st-sparse-control-gap, 2px);
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
.modes.dense {
|
||||
@@ -1241,6 +1243,15 @@ ha-card.drying {
|
||||
height: var(--st-preset-icon-size);
|
||||
}
|
||||
|
||||
.modes.hvac.dense .mode-icon,
|
||||
.modes.state.dense .mode-icon {
|
||||
--iron-icon-width: var(--st-control-icon-size);
|
||||
--iron-icon-height: var(--st-control-icon-size);
|
||||
--mdc-icon-size: var(--st-control-icon-size);
|
||||
width: var(--st-control-icon-size);
|
||||
height: var(--st-control-icon-size);
|
||||
}
|
||||
|
||||
.modes.dense .mode-label {
|
||||
display: block;
|
||||
min-height: 0;
|
||||
@@ -1326,6 +1337,7 @@ ha-card.drying {
|
||||
}
|
||||
.modes.fan .mode-item,
|
||||
.modes.fan-preset .mode-item {
|
||||
--st-mode-color: var(--fan_only-color);
|
||||
--st-mode-min-width: 88px;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
@@ -1559,32 +1571,74 @@ ha-card.standard-visuals .mode-item.active {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
ha-card .mode-item.active.off,
|
||||
ha-card .mode-item.active.off:hover {
|
||||
background: var(--off-color);
|
||||
--st-mode-active-background: var(--off-color);
|
||||
}
|
||||
|
||||
ha-card .mode-item.active.heat,
|
||||
ha-card .mode-item.active.heat:hover {
|
||||
background: var(--heat-color);
|
||||
--st-mode-active-background: var(--heat-color);
|
||||
}
|
||||
|
||||
ha-card .mode-item.active.cool,
|
||||
ha-card .mode-item.active.cool:hover {
|
||||
background: var(--cool-color);
|
||||
--st-mode-active-background: var(--cool-color);
|
||||
}
|
||||
|
||||
ha-card .mode-item.active.heat_cool,
|
||||
ha-card .mode-item.active.heat_cool:hover {
|
||||
background: var(--heat_cool-color);
|
||||
--st-mode-active-background: var(--heat_cool-color);
|
||||
}
|
||||
|
||||
ha-card .mode-item.active.auto,
|
||||
ha-card .mode-item.active.auto:hover {
|
||||
background: var(--auto-color);
|
||||
--st-mode-active-background: var(--auto-color);
|
||||
}
|
||||
|
||||
ha-card .mode-item.active.dry,
|
||||
ha-card .mode-item.active.dry:hover {
|
||||
background: var(--dry-color);
|
||||
--st-mode-active-background: var(--dry-color);
|
||||
}
|
||||
|
||||
ha-card .mode-item.active.fan_only,
|
||||
ha-card .mode-item.active.fan_only:hover {
|
||||
background: var(--fan_only-color);
|
||||
--st-mode-active-background: var(--fan_only-color);
|
||||
}
|
||||
|
||||
ha-card.standard-visuals .mode-item.active.off {
|
||||
background: var(--st-mode-active-background, var(--off-color));
|
||||
background: var(--off-color);
|
||||
}
|
||||
|
||||
ha-card.standard-visuals .mode-item.active.heat {
|
||||
background: var(--st-mode-active-background, var(--heat-color));
|
||||
background: var(--heat-color);
|
||||
}
|
||||
|
||||
ha-card.standard-visuals .mode-item.active.cool {
|
||||
background: var(--st-mode-active-background, var(--cool-color));
|
||||
background: var(--cool-color);
|
||||
}
|
||||
|
||||
ha-card.standard-visuals .mode-item.active.heat_cool {
|
||||
background: var(--st-mode-active-background, var(--heat_cool-color));
|
||||
background: var(--heat_cool-color);
|
||||
}
|
||||
|
||||
ha-card.standard-visuals .mode-item.active.auto {
|
||||
background: var(--st-mode-active-background, var(--auto-color));
|
||||
background: var(--auto-color);
|
||||
}
|
||||
|
||||
ha-card.standard-visuals .mode-item.active.dry {
|
||||
background: var(--st-mode-active-background, var(--dry-color));
|
||||
background: var(--dry-color);
|
||||
}
|
||||
|
||||
ha-card.standard-visuals .mode-item.active.fan_only {
|
||||
background: var(--st-mode-active-background, var(--fan_only-color));
|
||||
background: var(--fan_only-color);
|
||||
}
|
||||
|
||||
ha-card.standard-visuals .mode-item:active,
|
||||
@@ -1667,7 +1721,7 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
font-size: 12px;
|
||||
font-size: var(--ha-font-size-s, 12px);
|
||||
}
|
||||
`;function vt(t,e,i,o={}){o=o||{},i=null==i?{}:i;const a=new Event(e,{bubbles:void 0===o.bubbles||o.bubbles,cancelable:Boolean(o.cancelable),composed:void 0===o.composed||o.composed});return a.detail=i,t.dispatchEvent(a),a}function yt(t){return Array.isArray(t)?t.map(t=>{const{label:e,...i}=t;return!i.name&&e&&(i.name=e),i}):t}function _t(t){const e={...t,layout:t.layout?{...t.layout}:void 0};return 3===e.version&&!e.layout?.step&&(e.layout={...e.layout??{},step:"column"}),!e.current_value_entity&&e.current_temperature_entity&&(e.current_value_entity=e.current_temperature_entity),void 0===e.entities&&void 0!==e.sensors&&function(t){if(!Array.isArray(t.sensors))return;const e=[];t.sensors.forEach(i=>{const o=i;return"temperature"===o.id?(o.label&&(t.label={...t.label??{},temperature:o.label}),void(!1===o.show&&(t.hide={...t.hide??{},temperature:!0}))):"state"===o.id?(o.label&&(t.label={...t.label??{},state:o.label}),void(!1===o.show&&(t.hide={...t.hide??{},state:!0}))):void e.push(i)}),t.entities=yt(e)}(e),e.entities=yt(e.entities),e.layout&&void 0===e.layout.entities&&void 0!==e.layout.sensors&&(e.layout.entities=e.layout.sensors),delete e.current_temperature_entity,delete e.sensors,delete e.layout?.sensors,delete e.version,e}!function(t,e){void 0===e&&(e={});var i=e.insertAt;if(t&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===i&&o.firstChild?o.insertBefore(a,o.firstChild):o.appendChild(a),a.styleSheet?a.styleSheet.cssText=t:a.appendChild(document.createTextNode(t))}}(ft),function(t){t.HVAC="hvac",t.FAN="fan",t.STATE="state",t.PRESET="preset",t.SWING="swing",t.SWING_HORIZONTAL="swing_horizontal",t.SWING_VERTICAL="swing_vertical",t.VANE_HORIZONTAL="vane_horizontal",t.VANE_VERTICAL="vane_vertical",t.DIRECTION="direction",t.OSCILLATING="oscillating",t.MODE="mode"}(mt||(mt={}));const bt="dual";const wt={getSetpoints:t=>function(t){return"number"==typeof t.target_temp_high&&"number"==typeof t.target_temp_low?bt:"single"}(t)===bt?{target_temp_low:t.target_temp_low,target_temp_high:t.target_temp_high}:{temperature:t.temperature},getRange:t=>({min:t?.min_temp??null,max:t?.max_temp??null,step:t?.target_temp_step??null}),getCurrentValue:t=>t?.current_temperature??null,getCurrentValueTemplate:()=>"{{current_temperature|formatNumber}}",getSetpointService:()=>({domain:"climate",service:"set_temperature"}),getModeService:t=>"vane_horizontal"===t||"vane_vertical"===t?`set_${t}`:`set_${t}_mode`,getModePayloadKey:t=>"vane_horizontal"===t||"vane_vertical"===t?t:`${t}_mode`,getModeAttribute:t=>"vane_horizontal"===t||"vane_vertical"===t?`${t}_positions`:`${t}_modes`,getDefaultControl:()=>["hvac","preset"],getLocalizationDomain:()=>"climate"},xt={climate:wt,fan:{getSetpoints:t=>"number"!=typeof t?.percentage?{}:{percentage:t.percentage},getRange:t=>({min:0,max:100,step:1}),getCurrentValue:t=>t?.current_temperature??t?.temperature??null,getCurrentValueUnit:(t,e)=>null!=t?.current_temperature?e?.unit_system?.temperature??!1:null!=t?.temperature&&(t?.unit_of_measurement??e?.unit_system?.temperature??!1),getCurrentValueTemplate:()=>"{{current_temperature|formatNumber}}",getSetpointService:()=>({domain:"fan",service:"set_percentage"}),getModeService:t=>"state"===t?"turn_on":"direction"===t?"set_direction":"oscillating"===t?"oscillate":`set_${t}_mode`,getModePayloadKey:t=>"state"===t?"state":"direction"===t?"direction":"oscillating"===t?"oscillating":`${t}_mode`,getModeAttribute:t=>"state"===t?"state":"direction"===t?"direction":"oscillating"===t?"oscillating":`${t}_modes`,getDefaultControl:()=>["preset","direction","oscillating","state"],transformModePayloadValue:(t,e)=>"oscillating"===t?"true"===e:e,getLocalizationDomain:()=>"fan"},humidifier:{getSetpoints:t=>({humidity:t?.humidity}),getRange:t=>({min:t?.min_humidity??0,max:t?.max_humidity??100,step:1}),getCurrentValue:t=>t?.current_humidity??null,getCurrentValueTemplate:()=>"{{current_humidity|formatNumber}}",getSetpointService:()=>({domain:"humidifier",service:"set_humidity"}),getModeService:t=>"state"===t?"turn_on":"mode"===t?"set_mode":`set_${t}`,getModePayloadKey:t=>"state"===t?"state":"mode"===t?"mode":t,getModeAttribute:t=>"state"===t?"state":"mode"===t?"available_modes":`${t}_modes`,getDefaultControl:()=>["mode","state"],getLocalizationDomain:()=>"humidifier"}};function $t(t){if(!t)return wt;const e=t.split(".")[0];return xt[e]??wt}const St=process.env.BUILD_TIME,At=["climate","fan","humidifier"],kt=[mt.HVAC,mt.FAN,mt.STATE,mt.PRESET,mt.SWING,mt.SWING_HORIZONTAL,mt.SWING_VERTICAL,mt.VANE_HORIZONTAL,mt.VANE_VERTICAL,mt.DIRECTION,mt.OSCILLATING,mt.MODE],Ct=Object.values(mt),Et={[mt.HVAC]:"HVAC modes",[mt.FAN]:"Fan modes",[mt.STATE]:"On/off state",[mt.PRESET]:"Preset modes",[mt.SWING]:"Swing modes",[mt.SWING_HORIZONTAL]:"Horizontal swing",[mt.SWING_VERTICAL]:"Vertical swing",[mt.VANE_HORIZONTAL]:"Horizontal vane",[mt.VANE_VERTICAL]:"Vertical vane",[mt.DIRECTION]:"Directio
Line truncated
|
||||
`;function vt(t,e,i,o={}){o=o||{},i=null==i?{}:i;const a=new Event(e,{bubbles:void 0===o.bubbles||o.bubbles,cancelable:Boolean(o.cancelable),composed:void 0===o.composed||o.composed});return a.detail=i,t.dispatchEvent(a),a}function yt(t){return Array.isArray(t)?t.map(t=>{const{label:e,...i}=t;return!i.name&&e&&(i.name=e),i}):t}function _t(t){const e={...t,layout:t.layout?{...t.layout}:void 0};return 3===e.version&&!e.layout?.step&&(e.layout={...e.layout??{},step:"column"}),!e.current_value_entity&&e.current_temperature_entity&&(e.current_value_entity=e.current_temperature_entity),void 0===e.entities&&void 0!==e.sensors&&function(t){if(!Array.isArray(t.sensors))return;const e=[];t.sensors.forEach(i=>{const o=i;return"temperature"===o.id?(o.label&&(t.label={...t.label??{},temperature:o.label}),void(!1===o.show&&(t.hide={...t.hide??{},temperature:!0}))):"state"===o.id?(o.label&&(t.label={...t.label??{},state:o.label}),void(!1===o.show&&(t.hide={...t.hide??{},state:!0}))):void e.push(i)}),t.entities=yt(e)}(e),e.entities=yt(e.entities),e.layout&&void 0===e.layout.entities&&void 0!==e.layout.sensors&&(e.layout.entities=e.layout.sensors),delete e.current_temperature_entity,delete e.sensors,delete e.layout?.sensors,delete e.version,e}!function(t,e){void 0===e&&(e={});var i=e.insertAt;if(t&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===i&&o.firstChild?o.insertBefore(a,o.firstChild):o.appendChild(a),a.styleSheet?a.styleSheet.cssText=t:a.appendChild(document.createTextNode(t))}}(ft),function(t){t.HVAC="hvac",t.FAN="fan",t.STATE="state",t.PRESET="preset",t.SWING="swing",t.SWING_HORIZONTAL="swing_horizontal",t.SWING_VERTICAL="swing_vertical",t.VANE_HORIZONTAL="vane_horizontal",t.VANE_VERTICAL="vane_vertical",t.DIRECTION="direction",t.OSCILLATING="oscillating",t.MODE="mode"}(mt||(mt={}));const bt="dual";const wt={getSetpoints:t=>function(t){return"number"==typeof t.target_temp_high&&"number"==typeof t.target_temp_low?bt:"single"}(t)===bt?{target_temp_low:t.target_temp_low,target_temp_high:t.target_temp_high}:{temperature:t.temperature},getRange:t=>({min:t?.min_temp??null,max:t?.max_temp??null,step:t?.target_temp_step??null}),getCurrentValue:t=>t?.current_temperature??null,getCurrentValueTemplate:()=>"{{current_temperature|formatNumber}}",getSetpointService:()=>({domain:"climate",service:"set_temperature"}),getModeService:t=>"vane_horizontal"===t||"vane_vertical"===t?`set_${t}`:`set_${t}_mode`,getModePayloadKey:t=>"vane_horizontal"===t||"vane_vertical"===t?t:`${t}_mode`,getModeAttribute:t=>"vane_horizontal"===t||"vane_vertical"===t?`${t}_positions`:`${t}_modes`,getDefaultControl:()=>["hvac","preset"],getLocalizationDomain:()=>"climate"},xt={climate:wt,fan:{getSetpoints:t=>"number"!=typeof t?.percentage?{}:{percentage:t.percentage},getRange(t){const e=Number(t?.percentage_step);return{min:0,max:100,step:Number.isFinite(e)&&e>0?e:1}},getCurrentValue:t=>t?.current_temperature??t?.temperature??null,getCurrentValueUnit:(t,e)=>null!=t?.current_temperature?e?.unit_system?.temperature??!1:null!=t?.temperature&&(t?.unit_of_measurement??e?.unit_system?.temperature??!1),getCurrentValueTemplate:()=>"{{current_temperature|formatNumber}}",getSetpointService:()=>({domain:"fan",service:"set_percentage"}),getModeService:t=>"state"===t?"turn_on":"direction"===t?"set_direction":"oscillating"===t?"oscillate":`set_${t}_mode`,getModePayloadKey:t=>"state"===t?"state":"direction"===t?"direction":"oscillating"===t?"oscillating":`${t}_mode`,getModeAttribute:t=>"state"===t?"state":"direction"===t?"direction":"oscillating"===t?"oscillating":`${t}_modes`,getDefaultControl:()=>["preset","direction","oscillating","state"],transformModePayloadValue:(t,e)=>"oscillating"===t?"true"===e:e,getLocalizationDomain:()=>"fan"},humidifier:{getSetpoints:t=>({humidity:t?.humidity}),getRange:t=>({min:t?.min_humidity??0,max:t?.max_humidity??100,step:1}),getCurrentValue:t=>t?.current_humidity??null,getCurrentValueTemplate:()=>"{{current_humidity|formatNumber}}",getSetpointService:()=>({domain:"humidifier",service:"set_humidity"}),getModeService:t=>"state"===t?"turn_on":"mode"===t?"set_mode":`set_${t}`,getModePayloadKey:t=>"state"===t?"state":"mode"===t?"mode":t,getModeAttribute:t=>"state"===t?"state":"mode"===t?"available_modes":`${t}_modes`,getDefaultControl:()=>["mode","state"],getLocalizationDomain:()=>"humidifier"}};function $t(t){if(!t)return wt;const e=t.split(".")[0];return xt[e]??wt}const St=process.env.BUILD_TIME,At=["climate","fan","humidifier"],kt=[mt.HVAC,mt.FAN,mt.STATE,mt.PRESET,mt.SWING,mt.SWING_HORIZONTAL,mt.SWING_VERTICAL,mt.VANE_HORIZONTAL,mt.VANE_VERTICAL,mt.DIRECTION,mt.OSCILLATING,mt.MODE],Ct=Object.values(mt),Et={[mt.HVAC]:"HVAC modes",[mt.FAN]:"Fan modes",[mt.STATE]:"On/off state",[mt.PRESET]:"Preset modes",[mt.SWING]:"Swing modes",[mt.SWING_HORIZONTAL]:"Horizontal swing",[mt.SWING_VERTICAL]:"Vertical swing",[mt.VANE_HORIZONTAL]:"Horizontal
Line truncated
|
||||
<section class="editor-extra-entities">
|
||||
<div class="editor-extra-entities__header">
|
||||
<div>
|
||||
@@ -1708,7 +1762,7 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
<ha-form
|
||||
.hass=${this.hass}
|
||||
.data=${this._buildFormData()}
|
||||
.schema=${function(t,e){const i=Ut(t,e),o=t.entity?.split(".")[0],a=$t(t.entity),r=t.entity?e?.states?.[t.entity]:void 0,n=!0===t.hide_setpoint||!r||Object.keys(a.getSetpoints(r.attributes??{})).length>0,s="fan"!==o&&("climate"===o||"humidifier"===o),c="fan"===o?[]:[{name:"current_value_entity",selector:{entity:{domain:["sensor","input_number"]}}}],l=[...s?[{name:"hide.temperature",selector:{boolean:{}}},{name:"hide_current_value_when_off",selector:{boolean:{}}}]:[],{name:"hide.state",selector:{boolean:{}}}],d=[...s?[{name:"label.temperature",selector:{text:{}}}]:[],{name:"label.state",selector:{text:{}}},...n?[{name:"label.setpoint",selector:{text:{}}}]:[]],h=!1===t.header?[]:[{type:"grid",schema:[{name:"name",selector:{text:{}}},{name:"icon",selector:{icon:{}}}]},{name:"toggle.entity",selector:{entity:{}}},{name:"toggle.name",selector:{text:{}}},...t.header&&"object"==typeof t.header&&t.header.toggle?.entity?[{name:"toggle.icon",selector:{icon:{}}}]:[]];return[{name:"entity",required:!0,selector:{entity:{domain:At}}},{type:"expandable",title:"Card header",schema:[{name:"show_header",selector:{boolean:{}}},...h]},...i.length>0?[{type:"expandable",title:"Controls",schema:[{type:"grid",column_min_width:"150px",schema:i.map(t=>({name:`control.${t}`,selector:{boolean:{}}}))}]}]:[],...n?[{type:"expandable",title:"Target",schema:[{type:"grid",schema:[{name:"layout.step",selector:{select:{mode:"dropdown",options:Rt}}},{name:"step_size",selector:{select:{mode:"dropdown",options:jt}}}]},{type:"grid",column_min_width:"160px",schema:[{name:"hide_setpoint",selector:{boolean:{}}},{name:"hide_setpoint_when_off",selector:{boolean:{}}},{name:"hide.setpoint_label",selector:{boolean:{}}},{name:"disable_setpoint_change_when_off",selector:{boolean:{}}}]}]}]:[],{type:"expandable",title:"Extra entity rows",schema:[{type:"grid",column_min_width:"160px",schema:[{name:"layout.entities.type",selector:{select:{mode:"dropdown",options:Pt}}},{name:"layout.entities.labels",selector:{boolean:{}}},{name:"layout.entities.separator",selector:{boolean:{}}},{name:"layout.entities.alignment",selector:{select:{mode:"dropdown",options:Ht}}}]}]},{type:"expandable",title:"Appearance",schema:[{name:"enhanced_visuals",selector:{boolean:{}}},{type:"grid",column_min_width:"160px",schema:l}].filter(Nt)},{type:"expandable",title:"Advanced",schema:[...c,...s?[{type:"grid",schema:[{name:"decimals",selector:{number:{min:0,max:5,step:1,mode:"box"}}},{name:"unit",selector:{text:{}}}]}]:[],{name:"fallback",selector:{text:{}}},{type:"grid",column_min_width:"160px",schema:d},{type:"grid",column_min_width:"150px",schema:[{name:"layout.mode.names",selector:{boolean:{}}},{name:"layout.mode.icons",selector:{boolean:{}}},{name:"layout.mode.headings",selector:{boolean:{}}}]},{type:"grid",column_min_width:"150px",schema:[{name:"tap_action.action",selector:{select:{mode:"dropdown",options:Mt}}},{name:"hold_action.action",selector:{select:{mode:"dropdown",options:Mt}}},{name:"double_tap_action.action",selector:{select:{mode:"dropdown",options:Mt}}}]}].filter(Nt)}]}(this.config,this.hass)}
|
||||
.schema=${function(t,e){const i=Ut(t,e),o=t.entity?.split(".")[0],a=$t(t.entity),r=t.entity?e?.states?.[t.entity]:void 0,n=!0===t.hide_setpoint||!r||Object.keys(a.getSetpoints(r.attributes??{})).length>0,s="fan"!==o&&("climate"===o||"humidifier"===o),c="fan"===o?[]:[{name:"current_value_entity",selector:{entity:{domain:["sensor","input_number"]}}}],l=[...s?[{name:"hide.temperature",selector:{boolean:{}}},{name:"hide_current_value_when_off",selector:{boolean:{}}}]:[],{name:"hide.state",selector:{boolean:{}}}],d=[...s?[{name:"label.temperature",selector:{text:{}}}]:[],{name:"label.state",selector:{text:{}}},...n?[{name:"label.setpoint",selector:{text:{}}}]:[]],h=!1===t.header?[]:[{type:"grid",schema:[{name:"name",selector:{text:{}}},{name:"icon",selector:{icon:{}}}]},{name:"toggle.entity",selector:{entity:{}}},{name:"toggle.name",selector:{text:{}}},...t.header&&"object"==typeof t.header&&t.header.toggle?.entity?[{name:"toggle.icon",selector:{icon:{}}}]:[]];return[{name:"entity",required:!0,selector:{entity:{domain:At}}},{type:"expandable",title:"Card header",schema:[{name:"show_header",selector:{boolean:{}}},...h]},...i.length>0?[{type:"expandable",title:"Controls",schema:[{type:"grid",column_min_width:"150px",schema:i.map(t=>({name:`control.${t}`,selector:{boolean:{}}}))}]}]:[],...n?[{type:"expandable",title:"Target",schema:[{type:"grid",schema:[{name:"layout.step",selector:{select:{mode:"dropdown",options:Rt}}},{name:"step_size",selector:{select:{mode:"dropdown",options:jt}}}]},{type:"grid",column_min_width:"160px",schema:[{name:"hide_setpoint",selector:{boolean:{}}},{name:"hide_setpoint_when_off",selector:{boolean:{}}},{name:"hide.setpoint_label",selector:{boolean:{}}},{name:"disable_setpoint_change_when_off",selector:{boolean:{}}}]}]}]:[],{type:"expandable",title:"Extra entity rows",schema:[{type:"grid",column_min_width:"160px",schema:[{name:"layout.entities.type",selector:{select:{mode:"dropdown",options:Pt}}},{name:"layout.entities.labels",selector:{boolean:{}}},{name:"layout.entities.separator",selector:{boolean:{}}},{name:"layout.entities.alignment",selector:{select:{mode:"dropdown",options:Ht}}}]}]},{type:"expandable",title:"Appearance",schema:[{name:"enhanced_visuals",selector:{boolean:{}}},{type:"grid",column_min_width:"160px",schema:l}].filter(Nt)},{type:"expandable",title:"Advanced",schema:[...c,...s?[{type:"grid",schema:[{name:"decimals",selector:{number:{min:0,max:5,step:1,mode:"box"}}},{name:"unit",selector:{text:{}}}]}]:[],{name:"fallback",selector:{text:{}}},{name:"setpoint_debounce_ms",selector:{number:{min:0,step:100,mode:"box"}}},{type:"grid",column_min_width:"160px",schema:d},{type:"grid",column_min_width:"150px",schema:[{name:"layout.mode.names",selector:{boolean:{}}},{name:"layout.mode.icons",selector:{boolean:{}}},{name:"layout.mode.headings",selector:{boolean:{}}}]},{type:"grid",column_min_width:"150px",schema:[{name:"tap_action.action",selector:{select:{mode:"dropdown",options:Mt}}},{name:"hold_action.action",selector:{select:{mode:"dropdown",options:Mt}}},{name:"double_tap_action.action",selector:{select:{mode:"dropdown",options:Mt}}}]}].filter(Nt)}]}(this.config,this.hass)}
|
||||
.computeLabel=${this._computeLabel}
|
||||
@value-changed=${this._valueChanged}
|
||||
></ha-form>
|
||||
@@ -1851,7 +1905,7 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
`}setConfig(t){this.config={...t}}commit(t){const e=this.cleanConfig(t);this.config=e,vt(this,"config-changed",{config:e})}cleanConfig(t){const e={...t};for(const t of Object.keys(e))void 0===e[t]&&delete e[t];return e.selector&&0===Object.keys(e.selector).length&&delete e.selector,e}getTargets(){return function(t){const e=(t.cards??t.entities??[]).map(le);return e.length?e:[{entity:""},{entity:""}]}(this.config)}updateTarget(t,e){const i=this.getTargets();i[t]={...i[t],...e},this.commitTargets(i)}cleanTargets(t){return t.map(t=>{const e=t.entity?.trim()??"",i=t.name?.trim(),o=t.icon?.trim(),{name:a,icon:r,entity:n,...s}=t;return i||o||0!==Object.keys(s).length?{...s,entity:e,...i?{name:i}:{},...o?{icon:o}:{}}:e})}addTarget(){const t=[...this.getTargets(),{entity:""}];this.commitTargets(t)}removeTarget(t){const e=this.getTargets().filter((e,i)=>i!==t);this.commitTargets(e.length?e:[{entity:""}])}commitTargets(t){const{entities:e,...i}=this.config;this.commit({...i,cards:this.cleanTargets(t)})}updateSelector(t,e){const i={...this.config.selector??{}},o=Boolean(e);o===ce[t]?delete i[t]:i[t]=o,this.commit({...this.config,selector:i})}isAutoSelectEnabled(){const t=this.config.auto_select;return!0===t||"recent_activity"===t||"object"==typeof t&&"recent_activity"===t?.mode}updateAutoSelect(t){const{auto_select:e,...i}=this.config;this.commit({...i,...t?{auto_select:{mode:"recent_activity"}}:{}})}getTargetCardConfig(e){const{name:i,icon:o,...a}=e,r=a.header&&"object"==typeof a.header?{...a.header}:{};return i&&!1!==a.header&&void 0===r.name&&(r.name=i),o&&!1!==a.header&&void 0===r.icon&&(r.icon=o),{type:a.type??`custom:${t}`,...a,...!1===a.header?{header:!1}:{header:r}}}configureNestedEditor(t,e){if(!t)return;const i=t,o=this.getTargetCardConfig(e),a=JSON.stringify(o);i.hass=this.hass,this.editorConfigKeys.get(t)!==a&&(i.setConfig?.(o),this.editorConfigKeys.set(t,a))}updateTargetCardConfig(t,e){e.stopPropagation();const i=this.getTargets();i[t]=le(e.detail.config),this.commitTargets(i)}toggleTargetEditor(t){this.expandedTargetIndex=this.expandedTargetIndex===t?null:t}renderEntityPicker(t,e){return B`
|
||||
`}setConfig(t){this.config={...t}}commit(t){const e=this.cleanConfig(t);this.config=e,vt(this,"config-changed",{config:e})}cleanConfig(t){const e={...t};for(const t of Object.keys(e))void 0===e[t]&&delete e[t];return e.selector&&0===Object.keys(e.selector).length&&delete e.selector,e}getTargets(){return function(t){const e=(t.cards??t.entities??[]).map(le);return e.length?e:[{entity:""},{entity:""}]}(this.config)}updateTarget(t,e){const i=this.getTargets();i[t]={...i[t],...e},this.commitTargets(i)}cleanTargets(t){return t.map(t=>{const e=t.entity?.trim()??"",i=t.name?.trim(),o=t.icon?.trim(),{name:a,icon:r,entity:n,...s}=t;return i||o||0!==Object.keys(s).length?{...s,entity:e,...i?{name:i}:{},...o?{icon:o}:{}}:e})}addTarget(){const t=[...this.getTargets(),{entity:""}];this.commitTargets(t)}removeTarget(t){const e=this.getTargets().filter((e,i)=>i!==t);this.commitTargets(e.length?e:[{entity:""}])}commitTargets(t){const{entities:e,...i}=this.config;this.commit({...i,cards:this.cleanTargets(t)})}updateSelector(t,e){const i={...this.config.selector??{}},o=Boolean(e);o===ce[t]?delete i[t]:i[t]=o,this.commit({...this.config,selector:i})}isAutoSelectEnabled(){const t=this.config.auto_select;return!0===t||"recent_activity"===t||"object"==typeof t&&"recent_activity"===t?.mode}updateAutoSelect(t){const{auto_select:e,...i}=this.config;this.commit({...i,...t?{auto_select:{mode:"recent_activity"}}:{}})}updateRememberSelection(t){const{remember_selection:e,...i}=this.config;this.commit({...i,...t?{}:{remember_selection:!1}})}updateStorageKey(t){const e=t.trim(),{storage_key:i,...o}=this.config;this.commit({...o,...e?{storage_key:e}:{}})}getTargetCardConfig(e){const{name:i,icon:o,...a}=e,r=a.header&&"object"==typeof a.header?{...a.header}:{};return i&&!1!==a.header&&void 0===r.name&&(r.name=i),o&&!1!==a.header&&void 0===r.icon&&(r.icon=o),{type:a.type??`custom:${t}`,...a,...!1===a.header?{header:!1}:{header:r}}}configureNestedEditor(t,e){if(!t)return;const i=t,o=this.getTargetCardConfig(e),a=JSON.stringify(o);i.hass=this.hass,this.editorConfigKeys.get(t)!==a&&(i.setConfig?.(o),this.editorConfigKeys.set(t,a))}updateTargetCardConfig(t,e){e.stopPropagation();const i=this.getTargets();i[t]=le(e.detail.config),this.commitTargets(i)}toggleTargetEditor(t){this.expandedTargetIndex=this.expandedTargetIndex===t?null:t}renderEntityPicker(t,e){return B`
|
||||
<ha-entity-picker
|
||||
.hass=${this.hass}
|
||||
.value=${t.entity}
|
||||
@@ -1919,10 +1973,16 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
</div>
|
||||
<div class="selector-options">
|
||||
${this.renderOption("Follow active device","Switch to a card when its mode or on/off activity changes.",this.isAutoSelectEnabled(),t=>this.updateAutoSelect(t))}
|
||||
${this.renderOption("Remember selection","Keep the last selected card after the dashboard reloads.",!1!==this.config.remember_selection,t=>this.updateRememberSelection(t))}
|
||||
${this.renderOption("Show icons","Show each card icon in the selector and menu.",!1!==t.icons,t=>this.updateSelector("icons",t))}
|
||||
${this.renderOption("Show names","Show card names in the selector and menu.",!1!==t.names,t=>this.updateSelector("names",t))}
|
||||
${this.renderOption("Show states","Show current states in the selector menu.",!0===t.states,t=>this.updateSelector("states",t))}
|
||||
</div>
|
||||
<ha-textfield
|
||||
label="Storage key"
|
||||
.value=${this.config.storage_key??""}
|
||||
@input=${t=>this.updateStorageKey(t.target.value)}
|
||||
></ha-textfield>
|
||||
</div>
|
||||
`}renderOption(t,e,i,o){return B`
|
||||
<div class="option-row">
|
||||
@@ -1935,7 +1995,7 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
@change=${t=>o(t.currentTarget.checked)}
|
||||
></ha-switch>
|
||||
</div>
|
||||
`}}function he(t){if("string"!=typeof t.entity_id)return;const[e]=t.entity_id.split(".");return"climate"===e?"hvac_action":"humidifier"===e?"action":void 0}function ue(t){const e=he(t),i=e?t.attributes?.[e]:void 0;return"string"==typeof i&&i?i:void 0}function pe(t,e,i){if("string"!=typeof t.entity_id)return void 0===t.state?"":String(t.state);const[o]=t.entity_id.split("."),a=ue(t),r=he(t);if(a)return"function"==typeof e.formatEntityAttributeValue&&r?e.formatEntityAttributeValue(t,r):i(a,function(t){if("string"!=typeof t.entity_id)return"";const[e]=t.entity_id.split("."),i=he(t);return e&&i?`state_attributes.${e}.${i}.`:""}(t));if("fan"===o&&"on"===t.state){if(t.attributes?.preset_mode)return"function"==typeof e.formatEntityAttributeValue?e.formatEntityAttributeValue(t,"preset_mode"):i(t.attributes.preset_mode,"state_attributes.fan.preset_mode.");if("number"==typeof t.attributes?.percentage)return`${t.attributes.percentage}%`;if(t.attributes?.speed)return String(t.attributes.speed)}return"function"==typeof e.formatEntityState?e.formatEntityState(t):i(String(t.state),`component.${o}.state._.`)}i([pt({attribute:!1})],de.prototype,"hass",void 0),i([gt()],de.prototype,"config",void 0),i([gt()],de.prototype,"expandedTargetIndex",void 0);const ge={auto:"mdi:radiator",cooling:"mdi:snowflake",fan:"mdi:fan",heating:"mdi:radiator",idle:"mdi:radiator-disabled",on:"mdi:power",off:"mdi:radiator-off"},me={auto:"mdi:air-conditioner",cooling:"mdi:snowflake",fan:"mdi:fan",heating:"mdi:radiator",idle:"mdi:air-conditioner",on:"mdi:air-conditioner",off:"mdi:air-conditioner"},fe={...ge,auto:"mdi:radiator",idle:"mdi:radiator",off:"mdi:radiator"},ve={fan:{on:"mdi:fan",off:"mdi:fan-off"},humidifier:{on:"mdi:air-humidifier",off:"mdi:air-humidifier-off"}},ye={auto:"hass:autorenew",cool:"hass:snowflake",dry:"hass:water-percent",fan_only:"hass:fan",heat_cool:"hass:autorenew",heat:"hass:fire",on:"hass:power",off:"hass:power",forward:"mdi:arrow-right",reverse:"mdi:arrow-left",true:"mdi:fan",false:"mdi:fan-off",low:"mdi:fan-speed-1",mid:"mdi:fan-speed-2",medium:"mdi:fan-speed-2",high:"mdi:fan-speed-3",max:"st:fan-speed-4",turbo:"st:fan-speed-5",1:"mdi:fan-speed-1",2:"mdi:fan-speed-2",3:"mdi:fan-speed-3",4:"st:fan-speed-4",5:"st:fan-speed-5",automatic:"mdi:fan-auto",powerful:"mdi:fan-plus",quiet:"mdi:fan-minus",silent:"mdi:fan-minus",normal:"mdi:water-percent",vertical:"mdi:arrow-up-down",top:"mdi:arrow-up","top-middle":"mdi:arrow-top-right",middle:"mdi:arrow-collapse-vertical","middle-bottom":"mdi:arrow-bottom-right",bottom:"mdi:arrow-down",upper:"mdi:arrow-up",lower:"mdi:arrow-down",horizontal:"mdi:arrow-left-right",left:"mdi:arrow-left","center-left":"mdi:arrow-top-left",center:"mdi:arrow-collapse-horizontal","center-right":"mdi:arrow-top-right",right:"mdi:arrow-right",both:"mdi:arrow-all",swing:"mdi:arrow-oscillating",wide:"mdi:arrow-expand-horizontal",narrow:"mdi:arrow-collapse-horizontal",split:"mdi:arrow-split-vertical",none:"mdi:circle-off-outline",away:"mdi:home-export-outline",eco:"mdi:leaf",boost:"mdi:weather-windy",comfort:"mdi:sofa",auto_comfort:"mdi:sofa","auto-comfort":"mdi:sofa","auto comfort":"mdi:sofa",home:"mdi:home",sleep:"mdi:sleep",activity:"mdi:run"};function _e(t){const e=String(t),i=e.toLowerCase().replace(/\s+/g,"_");return ye[e]??ye[i]}function be(t){const e=String(t);return{low:"Low",mid:"Mid",medium:"Medium",high:"High",max:"Max",turbo:"Turbo",auto:"Auto"}[e.toLowerCase().replace(/\s+/g,"_")]??e}function we(t,e,i,o=!0){if(!1===t)return!1;let a;a="string"==typeof t?.name?t.name:!1!==t?.name&&("function"==typeof i.formatEntityName?i.formatEntityName(e):e.attributes.friendly_name);let r=o?function(t){const[e]=t.entity_id.split(".");return t.attributes.icon??function(t){const[e]=t.entity_id.split(".");if("climate"!==e)return;const i=Array.isArray(t.attributes?.hvac_modes)?t.attributes.hvac_modes:[],o=ue(t),a=String(o||t.state);return i.includes("cool")||i.includes("dry")||i.includes("fan_only")||["cool","cooling","dry","fan_only","fan"].includes(a)?me:fe}(t)??ve[e]?.[t.state]??(ue(t)?ge:ye)}(e):function(t){return ue(t)?ge:ye}(e);return void 0!==t?.icon&&(r=t.icon),{name:a,icon:r,slashOffIcon:o&&Se(e,r),toggle:t?.toggle?xe(t.toggle,i):null,toggles:$e(t,i),faults:Ae(t?.faults,i)}}function xe(t,e){const i=e.states[t.entity];if(!i)return null;let o="";return o=!0===t?.name?i.attributes.friendly_name:t?.name??"",{entity:i,label:o,icon:t?.icon??!1,hide_when_off:t?.hide_when_off}}function $e(t,e){return[...t?.toggle?[t.toggle]:[],...Array.isArray(t?.toggles)?t.toggles:[]].map(t=>xe(t,e)).filter(t=>!!t)}function Se(t,e){if("off"!==t.state)return!1;const i="object"==typeof e?e[ue(t)||t.state]??!1:e;if("string"!=typeof i)return!1;const[o]=t.entity_id.split("."),a="climate"===o?ge.off:ve[o]?.off;return Boolean(a)&&i!==a&&!i.endsWith("-off")}function Ae(t,e){return Array.isArray(t)?t.filter(({entity:t})=>Boolean(e.states?.[t])).map(({entity:t,...i})=>({...i,state:e.states[t],entity:t})):[]}const ke={icons:!0,names:!0,sta
Line truncated
|
||||
`}}function he(t){if("string"!=typeof t.entity_id)return;const[e]=t.entity_id.split(".");return"climate"===e?"hvac_action":"humidifier"===e?"action":void 0}function ue(t){const e=he(t),i=e?t.attributes?.[e]:void 0;return"string"==typeof i&&i?i:void 0}function pe(t,e,i){if("string"!=typeof t.entity_id)return void 0===t.state?"":String(t.state);const[o]=t.entity_id.split("."),a=ue(t),r=he(t);if(a)return"function"==typeof e.formatEntityAttributeValue&&r?e.formatEntityAttributeValue(t,r):i(a,function(t){if("string"!=typeof t.entity_id)return"";const[e]=t.entity_id.split("."),i=he(t);return e&&i?`state_attributes.${e}.${i}.`:""}(t));if("fan"===o&&"on"===t.state){if(t.attributes?.preset_mode)return"function"==typeof e.formatEntityAttributeValue?e.formatEntityAttributeValue(t,"preset_mode"):i(t.attributes.preset_mode,"state_attributes.fan.preset_mode.");if("number"==typeof t.attributes?.percentage)return`${t.attributes.percentage}%`;if(t.attributes?.speed)return String(t.attributes.speed)}return"function"==typeof e.formatEntityState?e.formatEntityState(t):i(String(t.state),`component.${o}.state._.`)}i([pt({attribute:!1})],de.prototype,"hass",void 0),i([gt()],de.prototype,"config",void 0),i([gt()],de.prototype,"expandedTargetIndex",void 0);const ge={auto:"mdi:radiator",cooling:"mdi:snowflake",fan:"mdi:fan",heating:"mdi:radiator",idle:"mdi:radiator-disabled",on:"mdi:power",off:"mdi:radiator-off"},me={auto:"mdi:air-conditioner",cooling:"mdi:snowflake",fan:"mdi:fan",heating:"mdi:radiator",idle:"mdi:air-conditioner",on:"mdi:air-conditioner",off:"mdi:air-conditioner"},fe={...ge,auto:"mdi:radiator",idle:ge.idle,off:"mdi:radiator"},ve={fan:{on:"mdi:fan",off:"mdi:fan-off"},humidifier:{on:"mdi:air-humidifier",off:"mdi:air-humidifier-off"}},ye={auto:"hass:autorenew",cool:"hass:snowflake",dry:"hass:water-percent",fan_only:"hass:fan",heat_cool:"hass:autorenew",heat:"hass:fire",on:"hass:power",off:"hass:power",forward:"mdi:arrow-right",reverse:"mdi:arrow-left",true:"mdi:fan",false:"mdi:fan-off",low:"mdi:fan-speed-1",mid:"mdi:fan-speed-2",medium:"mdi:fan-speed-2",high:"mdi:fan-speed-3",max:"st:fan-speed-4",turbo:"st:fan-speed-5",1:"mdi:fan-speed-1",2:"mdi:fan-speed-2",3:"mdi:fan-speed-3",4:"st:fan-speed-4",5:"st:fan-speed-5",automatic:"mdi:fan-auto",powerful:"mdi:fan-plus",quiet:"mdi:fan-minus",silent:"mdi:fan-minus",normal:"mdi:water-percent",vertical:"mdi:arrow-up-down",top:"mdi:arrow-up","top-middle":"mdi:arrow-top-right",middle:"mdi:arrow-collapse-vertical","middle-bottom":"mdi:arrow-bottom-right",bottom:"mdi:arrow-down",upper:"mdi:arrow-up",lower:"mdi:arrow-down",horizontal:"mdi:arrow-left-right",left:"mdi:arrow-left","center-left":"mdi:arrow-top-left",center:"mdi:arrow-collapse-horizontal","center-right":"mdi:arrow-top-right",right:"mdi:arrow-right",both:"mdi:arrow-all",swing:"mdi:arrow-oscillating",wide:"mdi:arrow-expand-horizontal",narrow:"mdi:arrow-collapse-horizontal",split:"mdi:arrow-split-vertical",none:"mdi:circle-off-outline",away:"mdi:home-export-outline",eco:"mdi:leaf",boost:"mdi:weather-windy",comfort:"mdi:sofa",auto_comfort:"mdi:sofa","auto-comfort":"mdi:sofa","auto comfort":"mdi:sofa",home:"mdi:home",sleep:"mdi:sleep",activity:"mdi:run"};function _e(t){const e=String(t),i=e.toLowerCase().replace(/\s+/g,"_");return ye[e]??ye[i]}function be(t){const e=String(t);return{low:"Low",mid:"Mid",medium:"Medium",high:"High",max:"Max",turbo:"Turbo",auto:"Auto"}[e.toLowerCase().replace(/\s+/g,"_")]??e}function we(t,e,i,o=!0){if(!1===t)return!1;let a;a="string"==typeof t?.name?t.name:!1!==t?.name&&("function"==typeof i.formatEntityName?i.formatEntityName(e):e.attributes.friendly_name);let r=o?function(t){const[e]=t.entity_id.split("."),i=ue(t),o=i?Se(t):void 0;return o??t.attributes.icon??Se(t)??ve[e]?.[t.state]??(i?ge:ye)}(e):function(t){return ue(t)?ge:ye}(e);return void 0!==t?.icon&&(r=t.icon),{name:a,icon:r,slashOffIcon:o&&Ae(e,r),toggle:t?.toggle?xe(t.toggle,i):null,toggles:$e(t,i),faults:ke(t?.faults,i)}}function xe(t,e){const i=e.states[t.entity];if(!i)return null;let o="";return o=!0===t?.name?i.attributes.friendly_name:t?.name??"",{entity:i,label:o,icon:t?.icon??!1,hide_when_off:t?.hide_when_off}}function $e(t,e){return[...t?.toggle?[t.toggle]:[],...Array.isArray(t?.toggles)?t.toggles:[]].map(t=>xe(t,e)).filter(t=>!!t)}function Se(t){const[e]=t.entity_id.split(".");if("climate"!==e)return;const i=Array.isArray(t.attributes?.hvac_modes)?t.attributes.hvac_modes:[],o=ue(t),a=String(o||t.state);return i.includes("cool")||i.includes("dry")||i.includes("fan_only")||["cool","cooling","dry","fan_only","fan"].includes(a)?me:fe}function Ae(t,e){if("off"!==t.state)return!1;const i="object"==typeof e?e[ue(t)||t.state]??!1:e;if("string"!=typeof i)return!1;const[o]=t.entity_id.split("."),a="climate"===o?ge.off:ve[o]?.off;return Boolean(a)&&i!==a&&!i.endsWith("-off")}function ke(t,e){return Array.isArray(t)?t.filter(({entity:t})=>Boolean(e.states?.[t])).map(({entity:t,...i})=>({...i,state:e.states[t],entity:t})):[]}const Ce=
Line truncated
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
@@ -1970,7 +2030,7 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
);
|
||||
min-width: 0;
|
||||
box-sizing: border-box;
|
||||
transform: translateY(var(--st-group-header-top-buffer, 6px));
|
||||
transform: translateY(var(--st-group-header-top-buffer, 2px));
|
||||
}
|
||||
|
||||
.group-title {
|
||||
@@ -1979,6 +2039,7 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
overflow: hidden;
|
||||
text-overflow: clip;
|
||||
white-space: nowrap;
|
||||
transition: color 180ms var(--st-motion-ease, ease);
|
||||
font-size: var(
|
||||
--st-group-title-fit-size,
|
||||
var(
|
||||
@@ -2031,7 +2092,7 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
appearance: none;
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
background: var(--secondary-background-color);
|
||||
background: transparent;
|
||||
color: var(--primary-text-color);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -2042,6 +2103,17 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.group-nav:hover:not(:disabled),
|
||||
.group-nav:focus-visible,
|
||||
.group-menu:hover,
|
||||
.group-menu:focus-visible {
|
||||
background: color-mix(
|
||||
in srgb,
|
||||
var(--primary-text-color) 10%,
|
||||
transparent
|
||||
);
|
||||
}
|
||||
|
||||
.group-nav ha-icon,
|
||||
.group-menu ha-icon {
|
||||
--mdc-icon-size: 24px;
|
||||
@@ -2058,7 +2130,6 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
grid-area: menu;
|
||||
width: 20px;
|
||||
height: 34px;
|
||||
background: transparent;
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
|
||||
@@ -2217,6 +2288,26 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.header__main.clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.header__main.clickable:focus-visible {
|
||||
outline: 2px solid var(--primary-color);
|
||||
outline-offset: 2px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.header__main.clickable:focus-visible .header__title {
|
||||
color: var(--st-interactive-tint, var(--primary-color));
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
.header__main.clickable:hover .header__title {
|
||||
color: var(--st-interactive-tint, var(--primary-color));
|
||||
}
|
||||
}
|
||||
|
||||
.header__icon-wrap {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
@@ -2378,7 +2469,7 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
animation: st-group-fan-spin var(--st-fan-spin-duration, 2.4s) linear
|
||||
infinite;
|
||||
}
|
||||
`}static getConfigElement(){return window.document.createElement(`${t}-group-editor`)}static getStubConfig(t){return{entities:Object.keys(t?.states??{}).filter(t=>Ce.includes(Ee(t))).slice(0,2),card:{}}}setConfig(t){this.clearAutoSelectResumeTimer();const e=(t.cards??t.entities??[]).map(Te).filter(Boolean);if(!e.length)throw new Error("Simple Thermostat Group requires at least one card");this.config={...t,selector:{...ke,...t.selector??{}}},this.targets=e,this.selectedEntity=this.getInitialSelection(t,e),this.activitySignatures.clear(),this.activitySignaturesInitialized=!1,this.persistedActivityApplied=!1}updated(){this.syncAutoSelectRecentActivity(),this.syncEmbeddedCard(),this.syncOutsideClickListener(),this.syncTitleFit()}disconnectedCallback(){this.clearOutsideClickListener(),this.clearAutoSelectResumeTimer(),super.disconnectedCallback()}getInitialSelection(t,e){const i=new Set(e.map(t=>t.entity)),o=!1===t.remember_selection?"":this.readStoredSelection(t);return o&&i.has(o)?o:t.selected&&i.has(t.selected)?t.selected:e[0].entity}readStoredSelection(t){return this.readStoredSelectionRecord(t)?.entity??""}readStoredSelectionRecord(t){try{const e=window.localStorage?.getItem(this.getStorageKey(t));if(!e)return;if(!e.trim().startsWith("{"))return{entity:e,timestamp:0};const i=JSON.parse(e);if("string"==typeof i.entity)return{entity:i.entity,timestamp:Number.isFinite(i.timestamp)?Number(i.timestamp):0}}catch(t){return}}writeStoredSelection(t){if(this.config&&!1!==this.config.remember_selection)try{window.localStorage?.setItem(this.getStorageKey(this.config),JSON.stringify({entity:t,timestamp:Date.now()}))}catch(t){}}readStoredActivity(t){try{const e=window.localStorage?.getItem(this.getActivityStorageKey(t));if(!e)return;const i=JSON.parse(e);if("string"==typeof i.entity&&"string"==typeof i.signature&&Number.isFinite(i.timestamp))return{entity:i.entity,signature:i.signature,timestamp:Number(i.timestamp)}}catch(t){return}}writeStoredActivity(t){if(this.config)try{window.localStorage?.setItem(this.getActivityStorageKey(this.config),JSON.stringify(t))}catch(t){}}getStorageKey(t){if(t.storage_key)return`simple-thermostat-group:${t.storage_key}`;return`simple-thermostat-group:${this.targets.map(t=>t.entity).join("|")}`}getActivityStorageKey(t){return`${this.getStorageKey(t)}:recent-activity`}clearAutoSelectResumeTimer(){void 0!==this.autoSelectResumeTimer&&(window.clearTimeout(this.autoSelectResumeTimer),this.autoSelectResumeTimer=void 0)}getSelectedTarget(){return this.targets.find(t=>t.entity===this.selectedEntity)??this.targets[0]}getSelectedState(){const t=this.getSelectedTarget();return this.hass?.states?.[t.entity]}getGroupCardClasses(){const t=this.getSelectedState();if(!t)return"group-card group-shell";const e=Ee(t.entity_id),i=ue(t),o=["unavailable","unknown"].includes(String(t.state));return["group-card","group-shell",`domain-${ze(e)}`,`state-${ze(t.state)}`,ze(i),o&&ze(t.state)].filter(Boolean).join(" ")}getGroupCardStyle(){const t=this.getSelectedState();return t?function(t,e={}){if("fan"!==t)return"";const i=Number(e?.percentage);if(Number.isNaN(i))return"";const o=Math.min(Math.max(i,0),100);return`--st-fan-spin-duration: ${Math.max(.9,3.2-o/100*2.1).toFixed(2)}s;`}(Ee(t.entity_id),t.attributes):""}getSelectedIndex(){const t=this.targets.findIndex(t=>t.entity===this.selectedEntity);return-1===t?0:t}isRecentActivityAutoSelectEnabled(){const t=this.config?.auto_select;return!!t&&(!0===t||"recent_activity"===t||"object"==typeof t&&"recent_activity"===t.mode)}getAutoSelectManualPauseMs(){const t=this.config?.auto_select;if(t&&"object"==typeof t){const e=Number(t.manual_pause_ms??t.cooldown_ms);if(Number.isFinite(e)&&e>=0)return e}return 3e4}pauseAutoSelectAfterManualSelection(){this.lastManualSelectionAt=Date.now(),this.clearAutoSelectResumeTimer(),this.isRecentActivityAutoSelectEnabled()&&(this.autoSelectResumeTimer=window.setTimeout(()=>{this.autoSelectResumeTimer=void 0,this.lastManualSelectionAt=0,this.isRecentActivityAutoSelectEnabled()&&!this.menuOpen&&this.selectMostRecentStateActivity()},this.getAutoSelectManualPauseMs()))}getActivitySignature(t){const e=this.hass?.states?.[t.entity];if(!e)return"";const i=Ee(t.entity),o=e.attributes??{},a=ue(e)??"",r="climate"===i?["hvac_action","temperature","target_temp_low","target_temp_high","preset_mode","fan_mode","swing_mode","swing_horizontal_mode","swing_vertical_mode"]:"fan"===i?["percentage","preset_mode","direction","oscillating"]:"humidifier"===i?["action","humidity","mode"]:[],n=[`state:${e.state}`,`action:${a}`];return r.forEach(t=>{n.push(`${t}:${JSON.stringify(o[t]??null)}`)}),n.join("|")}getActivityTimestamp(t){const e=this.hass?.states?.[t.entity],i=this.getActivityActiveRank(t)>1?e?.last_updated??e?.last_changed:e?.last_changed??e?.last_updated,o="string"==typeof i?Date.parse(i):NaN;return Number.isFinite(o)?o:0}getActivityCandidate(t,e=this.getActivityTimestamp(t)){return{target:t,timestamp:e,activeRank:this.getActivityActiveRank(t)}}is
Line truncated
|
||||
`}static getConfigElement(){return window.document.createElement(`${t}-group-editor`)}static getStubConfig(t){return{entities:Object.keys(t?.states??{}).filter(t=>Ee.includes(ze(t))).slice(0,2),card:{}}}setConfig(t){this.clearAutoSelectResumeTimer();const e=(t.cards??t.entities??[]).map(Oe).filter(Boolean);if(!e.length)throw new Error("Simple Thermostat Group requires at least one card");this.config={...t,selector:{...Ce,...t.selector??{}}},this.targets=e,this.selectedEntity=this.getInitialSelection(t,e),this.activitySignatures.clear(),this.activitySignaturesInitialized=!1,this.persistedActivityApplied=!1}updated(){this.syncAutoSelectRecentActivity(),this.syncEmbeddedCard(),this.syncOutsideClickListener(),this.syncTitleFit()}getCardSize(){if(!this.config||!this.targets.length)return 1;const t=this.getSelectedTarget(),e=this.getTargetCardConfig(t),i=Array.isArray(e.entities)?e.entities.length:0,o=i?Math.max(1,Math.ceil(i/2)):0,a=this.getConfiguredModeRowCount(e),r=!0===e.hide_setpoint?0:1;return Math.max(2,1+o+r+a)}disconnectedCallback(){this.clearOutsideClickListener(),this.clearAutoSelectResumeTimer(),super.disconnectedCallback()}getInitialSelection(t,e){const i=new Set(e.map(t=>t.entity)),o=!1===t.remember_selection?"":this.readStoredSelection(t);return o&&i.has(o)?o:t.selected&&i.has(t.selected)?t.selected:e[0].entity}readStoredSelection(t){return this.readStoredSelectionRecord(t)?.entity??""}readStoredSelectionRecord(t){try{const e=window.localStorage?.getItem(this.getStorageKey(t));if(!e)return;if(!e.trim().startsWith("{"))return{entity:e,timestamp:0};const i=JSON.parse(e);if("string"==typeof i.entity)return{entity:i.entity,timestamp:Number.isFinite(i.timestamp)?Number(i.timestamp):0}}catch(t){return}}writeStoredSelection(t){if(this.config&&!1!==this.config.remember_selection)try{window.localStorage?.setItem(this.getStorageKey(this.config),JSON.stringify({entity:t,timestamp:Date.now()}))}catch(t){}}readStoredActivity(t){try{const e=window.localStorage?.getItem(this.getActivityStorageKey(t));if(!e)return;const i=JSON.parse(e);if("string"==typeof i.entity&&"string"==typeof i.signature&&Number.isFinite(i.timestamp))return{entity:i.entity,signature:i.signature,timestamp:Number(i.timestamp)}}catch(t){return}}writeStoredActivity(t){if(this.config)try{window.localStorage?.setItem(this.getActivityStorageKey(this.config),JSON.stringify(t))}catch(t){}}getStorageKey(t){if(t.storage_key)return`simple-thermostat-group:${t.storage_key}`;return`simple-thermostat-group:${this.targets.map(t=>t.entity).join("|")}`}getActivityStorageKey(t){return`${this.getStorageKey(t)}:recent-activity`}getConfiguredModeRowCount(t){const e=t.control;return!1===e?0:Array.isArray(e)?e.filter(Boolean).length:e&&"object"==typeof e?Object.entries(e).filter(([t,e])=>!t.startsWith("_")&&!1!==e).length:1}clearAutoSelectResumeTimer(){void 0!==this.autoSelectResumeTimer&&(window.clearTimeout(this.autoSelectResumeTimer),this.autoSelectResumeTimer=void 0)}getSelectedTarget(){return this.targets.find(t=>t.entity===this.selectedEntity)??this.targets[0]}getSelectedState(){const t=this.getSelectedTarget();return this.hass?.states?.[t.entity]}openSelectedPopover(){const t=this.getSelectedTarget();t?.entity&&vt(this,"hass-more-info",{entityId:t.entity})}onSelectorHeaderKeyDown(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.openSelectedPopover())}getGroupCardClasses(){const t=this.getSelectedState();if(!t)return"group-card group-shell";const e=ze(t.entity_id),i=ue(t),o=["unavailable","unknown"].includes(String(t.state));return["group-card","group-shell",`domain-${Te(e)}`,`state-${Te(t.state)}`,Te(i),o&&Te(t.state)].filter(Boolean).join(" ")}getGroupCardStyle(){const t=this.getSelectedState();return t?function(t,e={}){if("fan"!==t)return"";const i=Number(e?.percentage);if(Number.isNaN(i))return"";const o=Math.min(Math.max(i,0),100);return`--st-fan-spin-duration: ${Math.max(.9,3.2-o/100*2.1).toFixed(2)}s;`}(ze(t.entity_id),t.attributes):""}getSelectedIndex(){const t=this.targets.findIndex(t=>t.entity===this.selectedEntity);return-1===t?0:t}isRecentActivityAutoSelectEnabled(){const t=this.config?.auto_select;return!!t&&(!0===t||"recent_activity"===t||"object"==typeof t&&"recent_activity"===t.mode)}getAutoSelectManualPauseMs(){const t=this.config?.auto_select;if(t&&"object"==typeof t){const e=Number(t.manual_pause_ms??t.cooldown_ms);if(Number.isFinite(e)&&e>=0)return e}return 3e4}pauseAutoSelectAfterManualSelection(){this.lastManualSelectionAt=Date.now(),this.clearAutoSelectResumeTimer(),this.isRecentActivityAutoSelectEnabled()&&(this.autoSelectResumeTimer=window.setTimeout(()=>{this.autoSelectResumeTimer=void 0,this.lastManualSelectionAt=0,this.isRecentActivityAutoSelectEnabled()&&!this.menuOpen&&this.selectMostRecentStateActivity()},this.getAutoSelectManualPauseMs()))}getActivitySignature(t){const e=this.hass?.states?.[t.entity];if(!e)return"";const i=ze(t.entity),o=e.attributes??{},a=ue(e)??"",r="climate"===i?["hvac_action","temperature","t
Line truncated
|
||||
<div class="group-toggles">
|
||||
${e.map(t=>{const e=this.hass?.states?.[t.entity],i=!0===t.name?e?.attributes?.friendly_name:"string"==typeof t.name?t.name:e?.attributes?.friendly_name,o=t.icon||e?.attributes?.icon;return B`
|
||||
<div class="group-toggle">
|
||||
@@ -2411,7 +2502,7 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
</button>
|
||||
`})}
|
||||
</div>
|
||||
`:q}renderHeaderIcon(t){const e=this.hass?.states?.[t.entity],i=this.getTargetHeaderData(t);if(!e||!i||!i.icon)return q;const o=ue(e)||String(e.state),a="object"==typeof i.icon?i.icon?.[o]??!1:i.icon;if(!a)return q;const r=o&&o!==e.state?` ${ze(o)}`:"",n=ze(e.state);return B`
|
||||
`:q}renderHeaderIcon(t){const e=this.hass?.states?.[t.entity],i=this.getTargetHeaderData(t);if(!e||!i||!i.icon)return q;const o=ue(e)||String(e.state),a="object"==typeof i.icon?i.icon?.[o]??!1:i.icon;if(!a)return q;const r=o&&o!==e.state?` ${Te(o)}`:"",n=Te(e.state);return B`
|
||||
<span
|
||||
class="header__icon-wrap ${n}${r} ${i.slashOffIcon?"slash-off":""}"
|
||||
>
|
||||
@@ -2423,7 +2514,13 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
`}renderSelector(){const t=this.getSelectedTarget(),e=this.getTargetLabel(t);return B`
|
||||
<div class="group-selector">
|
||||
<div class="group-header-content">
|
||||
<div class="header__main">
|
||||
<div
|
||||
class="header__main clickable"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
@click=${()=>this.openSelectedPopover()}
|
||||
@keydown=${t=>this.onSelectorHeaderKeyDown(t)}
|
||||
>
|
||||
${this.renderHeaderIcon(t)}
|
||||
<div class="group-title header__title" title=${e}>${e}</div>
|
||||
</div>
|
||||
@@ -2472,7 +2569,7 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
class=${"embedded-card-host"+(this.cardFading?" fading":"")}
|
||||
></div>
|
||||
</div>
|
||||
`:B`<ha-card></ha-card>`}}var Ne;i([pt({attribute:!1})],Oe.prototype,"hass",void 0),i([gt()],Oe.prototype,"config",void 0),i([gt()],Oe.prototype,"targets",void 0),i([gt()],Oe.prototype,"selectedEntity",void 0),i([gt()],Oe.prototype,"menuOpen",void 0),i([gt()],Oe.prototype,"cardFading",void 0),function(t){t.OFF="off",t.HEAT="heat",t.COOL="cool",t.HEAT_COOL="heat_cool",t.AUTO="auto",t.DRY="dry",t.FAN_ONLY="fan_only"}(Ne||(Ne={}));const Me=["auto","silent","quiet","low","mid","medium","high","max","turbo","full"];const Re=["mdi:fan-speed-1","mdi:fan-speed-2","mdi:fan-speed-3","st:fan-speed-4","st:fan-speed-5"],je=t=>String(t).toLowerCase().replace(/\s+/g,"_"),Pe={low:1,medlow:2,medium_low:2,mid:2,medium:2,medium_high:3,medhigh:3,max:5,turbo:5,full:5};function He(t,e){const i=je(t),o=function(t){if(!/^\d+$/.test(t))return;const e=Number(t);return e>=1&&e<=Re.length?e:void 0}(i);if(o)return Re[o-1];const a=function(t,e){if("high"===t){const t=new Set(e.map(je));return t.has("medium_high")||t.has("medhigh")||t.has("max")||t.has("turbo")||t.has("full")?4:3}return Pe[t]}(i,e);return a?Re[a-1]:void 0}function Ve(t,{decimals:e=1,fallback:i="N/A",locale:o}={}){if(null===t||""===t||["boolean","undefined"].includes(typeof t))return i;const a=Number(t);return Number.isNaN(a)?i:o?"decimal_comma"===o.number_format||"space_comma"===o.number_format?a.toFixed(e).replace(".",","):"comma_decimal"===o.number_format||"none"===o.number_format?a.toFixed(e):new Intl.NumberFormat("system"===o.number_format?void 0:o.language,{minimumFractionDigits:e,maximumFractionDigits:e}).format(a):a.toFixed(e)}const Ie=[["heat",/\b(heat|heater|furnace|radiator|boiler|water[_ -]?heater)\b/],["cool",/\b(cool|cooling|ac|a\/c|air[_ -]?conditioner|snowflake)\b/],["dry",/\b(dry|drying|dehumidifier|dehumidify)\b/],["water-percent",/\b(humidifier|humidify|humidity)\b/],["fan",/\b(fan|blower)\b/],["lightbulb",/\b(light|lamp|bulb)\b/]],Le={heat:["component.climate.state._.heat","state_attributes.climate.hvac_action.heating"],cool:["component.climate.state._.cool","state_attributes.climate.hvac_action.cooling"],dry:["component.climate.state._.dry","state_attributes.humidifier.action.drying"],fan:["component.fan.entity_component._.name"],lightbulb:["component.light.entity_component._.name"],"water-percent":["component.humidifier.entity_component._.name","state_attributes.humidifier.action.humidifying"]};function Fe(t,e){const i=t.toLowerCase().replace(/[.:]/g," "),o=function(t){return"function"!=typeof t?.localize?[]:Object.entries(Le).flatMap(([e,i])=>i.map(e=>t.localize(e)).filter(t=>t&&!i.includes(t)).map(t=>{return[e,(i=String(t),i.toLowerCase().replace(/[.:]/g," "))];var i}))}(e).find(([,t])=>!!t&&(i===t||i.includes(t)));if(o)return o[0];const a=Ie.find(([,t])=>t.test(i));return a?.[0]??""}function De(t){if("string"!=typeof t||!t)return"";const e=(i=t.replace(/^[a-z]+:/,""),String(i??"").replace(/[^a-z0-9_-]/gi,""));var i;const o=Fe(e.replace(/-/g," "));return o||(["fire","radiator","heat-wave","heating-coil","water-boiler","water-boiler-auto","water-boiler-off"].includes(e)?"heat":["snowflake","air-conditioner"].includes(e)?"cool":"fan"===e?"fan":e.includes("light")?"lightbulb":["water-percent","air-humidifier"].includes(e)||["air-humidifier-off"].includes(e)?"water-percent":e)}function Ue({icon:t,label:e,entity:i,hass:o}){const a=De(t);if(a)return a;const r=function(t){const e=t?.entity_id,i="string"==typeof e?e.split(".")[0]:"",o=t?.attributes?.device_class;return"light"===i?"lightbulb":"fan"===i?"fan":"humidifier"===i?"dehumidifier"===o?"dry":"water-percent":"heat"===o||"heater"===o?"heat":"cold"===o||"cooling"===o?"cool":"moisture"===o||"humidity"===o?"water-percent":""}(i);if(r)return r;return Fe([e,i?.entity_id,i?.attributes?.friendly_name].filter(Boolean).join(" "),o)}function We(t){return t?`toggle-${t}`:""}function Be({header:t,toggleEntityChanged:e,entity:i,hass:o,openEntityPopover:a}){if(!1===t)return q;const r=ue(i)||i.state;let n=t.icon;"object"==typeof t.icon&&(n=n?.[r]??!1);const s=Boolean(t.slashOffIcon),c=t?.name??!1;return B`
|
||||
`:B`<ha-card></ha-card>`}}var Me;i([pt({attribute:!1})],Ne.prototype,"hass",void 0),i([gt()],Ne.prototype,"config",void 0),i([gt()],Ne.prototype,"targets",void 0),i([gt()],Ne.prototype,"selectedEntity",void 0),i([gt()],Ne.prototype,"menuOpen",void 0),i([gt()],Ne.prototype,"cardFading",void 0),function(t){t.OFF="off",t.HEAT="heat",t.COOL="cool",t.HEAT_COOL="heat_cool",t.AUTO="auto",t.DRY="dry",t.FAN_ONLY="fan_only"}(Me||(Me={}));const Re=["auto","silent","quiet","low","mid","medium","high","max","turbo","full"];const je=["mdi:fan-speed-1","mdi:fan-speed-2","mdi:fan-speed-3","st:fan-speed-4","st:fan-speed-5"],Pe=t=>String(t).toLowerCase().replace(/\s+/g,"_"),He={low:1,medlow:2,medium_low:2,mid:2,medium:2,medium_high:3,medhigh:3,max:5,turbo:5,full:5};function Ie(t,e){const i=Pe(t),o=function(t){if(!/^\d+$/.test(t))return;const e=Number(t);return e>=1&&e<=je.length?e:void 0}(i);if(o)return je[o-1];const a=function(t,e){if("high"===t){const t=new Set(e.map(Pe));return t.has("medium_high")||t.has("medhigh")||t.has("max")||t.has("turbo")||t.has("full")?4:3}return He[t]}(i,e);return a?je[a-1]:void 0}function Ve(t,{decimals:e=1,fallback:i="N/A",locale:o}={}){if(null===t||""===t||["boolean","undefined"].includes(typeof t))return i;const a=Number(t);return Number.isNaN(a)?i:o?"decimal_comma"===o.number_format||"space_comma"===o.number_format?a.toFixed(e).replace(".",","):"comma_decimal"===o.number_format||"none"===o.number_format?a.toFixed(e):new Intl.NumberFormat("system"===o.number_format?void 0:o.language,{minimumFractionDigits:e,maximumFractionDigits:e}).format(a):a.toFixed(e)}const Fe=[["heat",/\b(heat|heater|furnace|radiator|boiler|water[_ -]?heater)\b/],["cool",/\b(cool|cooling|ac|a\/c|air[_ -]?conditioner|snowflake)\b/],["dry",/\b(dry|drying|dehumidifier|dehumidify)\b/],["water-percent",/\b(humidifier|humidify|humidity)\b/],["fan",/\b(fan|blower)\b/],["lightbulb",/\b(light|lamp|bulb)\b/]],Le={heat:["component.climate.state._.heat","state_attributes.climate.hvac_action.heating"],cool:["component.climate.state._.cool","state_attributes.climate.hvac_action.cooling"],dry:["component.climate.state._.dry","state_attributes.humidifier.action.drying"],fan:["component.fan.entity_component._.name"],lightbulb:["component.light.entity_component._.name"],"water-percent":["component.humidifier.entity_component._.name","state_attributes.humidifier.action.humidifying"]};function De(t,e){const i=t.toLowerCase().replace(/[.:]/g," "),o=function(t){return"function"!=typeof t?.localize?[]:Object.entries(Le).flatMap(([e,i])=>i.map(e=>t.localize(e)).filter(t=>t&&!i.includes(t)).map(t=>{return[e,(i=String(t),i.toLowerCase().replace(/[.:]/g," "))];var i}))}(e).find(([,t])=>!!t&&(i===t||i.includes(t)));if(o)return o[0];const a=Fe.find(([,t])=>t.test(i));return a?.[0]??""}function Ue(t){if("string"!=typeof t||!t)return"";const e=(i=t.replace(/^[a-z]+:/,""),String(i??"").replace(/[^a-z0-9_-]/gi,""));var i;const o=De(e.replace(/-/g," "));return o||(["fire","radiator","heat-wave","heating-coil","water-boiler","water-boiler-auto","water-boiler-off"].includes(e)?"heat":["snowflake","air-conditioner"].includes(e)?"cool":"fan"===e?"fan":e.includes("light")?"lightbulb":["water-percent","air-humidifier"].includes(e)||["air-humidifier-off"].includes(e)?"water-percent":e)}function We({icon:t,label:e,entity:i,hass:o}){const a=Ue(t);if(a)return a;const r=function(t){const e=t?.entity_id,i="string"==typeof e?e.split(".")[0]:"",o=t?.attributes?.device_class;return"light"===i?"lightbulb":"fan"===i?"fan":"humidifier"===i?"dehumidifier"===o?"dry":"water-percent":"heat"===o||"heater"===o?"heat":"cold"===o||"cooling"===o?"cool":"moisture"===o||"humidity"===o?"water-percent":""}(i);if(r)return r;return De([e,i?.entity_id,i?.attributes?.friendly_name].filter(Boolean).join(" "),o)}function Be(t){return t?`toggle-${t}`:""}function Ge({header:t,toggleEntityChanged:e,entity:i,hass:o,openEntityPopover:a}){if(!1===t)return q;const r=ue(i)||i.state;let n=t.icon;"object"==typeof t.icon&&(n=n?.[r]??!1);const s=Boolean(t.slashOffIcon),c=t?.name??!1;return B`
|
||||
<header>
|
||||
<div class="header__main clickable" @click=${()=>a()}>
|
||||
${function(t,e,i,o=!1){const a=i&&i!==e?` ${i}`:"";return t?B`
|
||||
@@ -2494,7 +2591,7 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
></ha-icon>`:q);return B` <div class="faults">${i}</div>`}(t.faults,a)}
|
||||
${function(t,e,i,o,a){return t?.length?B`
|
||||
<div class="header__toggles">
|
||||
${t.map(t=>{if(!0===t.hide_when_off&&"off"===a?.state)return q;const r=t.entity?.entity_id,n=t.entity?.state,s="string"==typeof r?r.split(".")[0]:"",c=We(Ue({icon:"string"==typeof t.icon?t.icon:t.entity?.attributes?.icon,label:t.label,entity:t.entity,hass:o}));return B`
|
||||
${t.map(t=>{if(!0===t.hide_when_off&&"off"===a?.state)return q;const r=t.entity?.entity_id,n=t.entity?.state,s="string"==typeof r?r.split(".")[0]:"",c=Be(We({icon:"string"==typeof t.icon?t.icon:t.entity?.attributes?.icon,label:t.label,entity:t.entity,hass:o}));return B`
|
||||
<div
|
||||
class="header__toggle ${n||""} ${s?`domain-${s}`:""} ${c}"
|
||||
>
|
||||
@@ -2513,17 +2610,17 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
</div>
|
||||
`:q}(t.toggles,a,e,o,i)}
|
||||
</header>
|
||||
`}class Ge extends Yt{constructor(t){if(super(t),this.it=q,t.type!==Zt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===q||null==t)return this._t=void 0,this.it=t;if(t===G)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}Ge.directiveName="unsafeHTML",Ge.resultType=1;const qe=Jt(Ge);function Ke(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ze(t,e,i){if(!e||"string"!=typeof e)return String(t);const o=String(t);return new RegExp(`${Ke(e)}$`).test(o)?o:`${o}${function(t,e){if(e){const i=e.match(new RegExp(`(\\s*)${Ke(t)}$`));if(i)return i[1]??""}return"%"===t?"":" "}(e,i)}${e}`}var Je,Ye={exports:{}};function Xe(){return Je||(Je=1,function(t){function e(t){var i,o,a=new Error(t);return i=a,o=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(i,o):i.__proto__=o,a}function i(t,i,o){var a=i.slice(0,o).split(/\n/),r=a.length,n=a[r-1].length+1;throw e(t+=" at line "+r+" col "+n+":\n\n "+i.split(/\n/)[r-1]+"\n "+Array(n).join(" ")+"^")}e.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var o=new Function("return this")().Promise,a=!1;try{a=new Function("return (async function(){}).constructor")()}catch(t){if(!(t instanceof SyntaxError))throw t}function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function n(t,e,i){for(var o in e)r(e,o)&&(null==e[o]||"object"!=typeof e[o]||"storage"!==o&&"prefixes"!==o||i?t[o]=e[o]:t[o]=n({},e[o]));return t}var s=/^async +/,c=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,l=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,d=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,h=/[.*+\-?^${}()|[\]\\]/g;function u(t){return h.test(t)?t.replace(h,"\\$&"):t}function p(t,o){o.rmWhitespace&&(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,l.lastIndex=0,d.lastIndex=0;var a=o.prefixes,r=[a.h,a.b,a.i,a.r,a.c,a.e].reduce(function(t,e){return t&&e?t+"|"+u(e):e?u(e):t},""),n=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+u(o.tags[1])+")","g"),h=new RegExp("([^]*?)"+u(o.tags[0])+"(-|_)?\\s*("+r+")?\\s*","g"),p=0,g=!1;function m(e,a){var r,u={f:[]},m=0,f="c";function v(e){var a=t.slice(p,e),r=a.trim();if("f"===f)"safe"===r?u.raw=!0:o.async&&s.test(r)?(r=r.replace(s,""),u.f.push([r,"",!0])):u.f.push([r,""]);else if("fp"===f)u.f[u.f.length-1][1]+=r;else if("err"===f){if(r){var n=a.search(/\S/);i("invalid syntax",t,p+n)}}else u[f]=r;p=e+1}for("h"===a||"b"===a||"c"===a?f="n":"r"===a&&(u.raw=!0,a="i"),n.lastIndex=p;null!==(r=n.exec(t));){var y=r[1],_=r[2],b=r[3],w=r[4],x=r[5],$=r.index;if(y)"("===y?(0===m&&("n"===f?(v($),f="p"):"f"===f&&(v($),f="fp")),m++):")"===y?0===--m&&"c"!==f&&(v($),f="err"):0===m&&"|"===y?(v($),f="f"):"=>"===y&&(v($),p+=1,f="res");else if(_)if("/*"===_){var S=t.indexOf("*/",n.lastIndex);-1===S&&i("unclosed comment",t,r.index),n.lastIndex=S+2}else"'"===_?(l.lastIndex=r.index,l.exec(t)?n.lastIndex=l.lastIndex:i("unclosed string",t,r.index)):'"'===_?(d.lastIndex=r.index,d.exec(t)?n.lastIndex=d.lastIndex:i("unclosed string",t,r.index)):"`"===_&&(c.lastIndex=r.index,c.exec(t)?n.lastIndex=c.lastIndex:i("unclosed string",t,r.index));else if(b)return v($),p=$+r[0].length,h.lastIndex=p,g=x,w&&"h"===a&&(a="s"),u.t=a,u}return i("unclosed tag",t,e),u}var f=function r(n,c){n.b=[],n.d=[];var l,d=!1,u=[];function f(t,e){t&&(t=function(t,e,i,o){var a,r;return"string"==typeof e.autoTrim?a=r=e.autoTrim:Array.isArray(e.autoTrim)&&(a=e.autoTrim[1],r=e.autoTrim[0]),(i||!1===i)&&(a=i),(o||!1===o)&&(r=o),"slurp"===a&&"slurp"===r?t.trim():("_"===a||"slurp"===a?t=String.prototype.trimLeft?t.trimLeft():t.replace(/^[\s\uFEFF\xA0]+/,""):"-"!==a&&"nl"!==a||(t=t.replace(/^(?:\n|\r|\r\n)/,"")),"_"===r||"slurp"===r?t=String.prototype.trimRight?t.trimRight():t.replace(/[\s\uFEFF\xA0]+$/,""):"-"!==r&&"nl"!==r||(t=t.replace(/(?:\n|\r|\r\n)$/,"")),t)}(t,o,g,e),t&&(t=t.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),u.push(t)))}for(;null!==(l=h.exec(t));){var v,y=l[1],_=l[2],b=l[3]||"";for(var w in a)if(a[w]===b){v=w;break}f(y,_),p=l.index+l[0].length,v||i("unrecognized tag type: "+b,t,p);var x=m(l.index,v),$=x.t;if("h"===$){var S=x.n||"";o.async&&s.test(S)&&(x.a=!0,x.n=S.replace(s,"")),x=r(x),u.push(x)}else if("c"===$){if(n.n===x.n)return d?(d.d=u,n.b.push(d)):n.d=u,n;i("Helper start and end don't match",t,l.index+l[0].length)}else if("b"===$){d?(d.d=u,n.b.push(d)):n.d=u;var A=x.n||"";o.async&&s.test(A)&&(x.a=!0,x.n=A.replace(s,"")),d=x,u=[]}else if("s"===$){var k=x.n||"";o.async&&s.test(k)&&(x.a=!0,x.n=k.replace(s,"")),u.push(x)}else u.push(x)}if(!c)throw e('unclosed helper "'+n.n+'"');return f(t.slice(p,t.length),!1),n.d=u,n}({f:[]},!0);if(o.plugins)for(var v=0;v<o.plugins.length;v++){var y=o.plugins[v];y.processAST&&(f.d=y.processAST(f.d,o))}return f.d}function g(tLine truncated
|
||||
`}class qe extends Yt{constructor(t){if(super(t),this.it=q,t.type!==Zt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===q||null==t)return this._t=void 0,this.it=t;if(t===G)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}qe.directiveName="unsafeHTML",qe.resultType=1;const Ke=Jt(qe);function Ze(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Je(t,e,i){if(!e||"string"!=typeof e)return String(t);const o=String(t);return new RegExp(`${Ze(e)}$`).test(o)?o:`${o}${function(t,e){if(e){const i=e.match(new RegExp(`(\\s*)${Ze(t)}$`));if(i)return i[1]??""}return"%"===t?"":" "}(e,i)}${e}`}var Ye,Xe={exports:{}};function Qe(){return Ye||(Ye=1,function(t){function e(t){var i,o,a=new Error(t);return i=a,o=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(i,o):i.__proto__=o,a}function i(t,i,o){var a=i.slice(0,o).split(/\n/),r=a.length,n=a[r-1].length+1;throw e(t+=" at line "+r+" col "+n+":\n\n "+i.split(/\n/)[r-1]+"\n "+Array(n).join(" ")+"^")}e.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var o=new Function("return this")().Promise,a=!1;try{a=new Function("return (async function(){}).constructor")()}catch(t){if(!(t instanceof SyntaxError))throw t}function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function n(t,e,i){for(var o in e)r(e,o)&&(null==e[o]||"object"!=typeof e[o]||"storage"!==o&&"prefixes"!==o||i?t[o]=e[o]:t[o]=n({},e[o]));return t}var s=/^async +/,c=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,l=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,d=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,h=/[.*+\-?^${}()|[\]\\]/g;function u(t){return h.test(t)?t.replace(h,"\\$&"):t}function p(t,o){o.rmWhitespace&&(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,l.lastIndex=0,d.lastIndex=0;var a=o.prefixes,r=[a.h,a.b,a.i,a.r,a.c,a.e].reduce(function(t,e){return t&&e?t+"|"+u(e):e?u(e):t},""),n=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+u(o.tags[1])+")","g"),h=new RegExp("([^]*?)"+u(o.tags[0])+"(-|_)?\\s*("+r+")?\\s*","g"),p=0,g=!1;function m(e,a){var r,u={f:[]},m=0,f="c";function v(e){var a=t.slice(p,e),r=a.trim();if("f"===f)"safe"===r?u.raw=!0:o.async&&s.test(r)?(r=r.replace(s,""),u.f.push([r,"",!0])):u.f.push([r,""]);else if("fp"===f)u.f[u.f.length-1][1]+=r;else if("err"===f){if(r){var n=a.search(/\S/);i("invalid syntax",t,p+n)}}else u[f]=r;p=e+1}for("h"===a||"b"===a||"c"===a?f="n":"r"===a&&(u.raw=!0,a="i"),n.lastIndex=p;null!==(r=n.exec(t));){var y=r[1],_=r[2],b=r[3],w=r[4],x=r[5],$=r.index;if(y)"("===y?(0===m&&("n"===f?(v($),f="p"):"f"===f&&(v($),f="fp")),m++):")"===y?0===--m&&"c"!==f&&(v($),f="err"):0===m&&"|"===y?(v($),f="f"):"=>"===y&&(v($),p+=1,f="res");else if(_)if("/*"===_){var S=t.indexOf("*/",n.lastIndex);-1===S&&i("unclosed comment",t,r.index),n.lastIndex=S+2}else"'"===_?(l.lastIndex=r.index,l.exec(t)?n.lastIndex=l.lastIndex:i("unclosed string",t,r.index)):'"'===_?(d.lastIndex=r.index,d.exec(t)?n.lastIndex=d.lastIndex:i("unclosed string",t,r.index)):"`"===_&&(c.lastIndex=r.index,c.exec(t)?n.lastIndex=c.lastIndex:i("unclosed string",t,r.index));else if(b)return v($),p=$+r[0].length,h.lastIndex=p,g=x,w&&"h"===a&&(a="s"),u.t=a,u}return i("unclosed tag",t,e),u}var f=function r(n,c){n.b=[],n.d=[];var l,d=!1,u=[];function f(t,e){t&&(t=function(t,e,i,o){var a,r;return"string"==typeof e.autoTrim?a=r=e.autoTrim:Array.isArray(e.autoTrim)&&(a=e.autoTrim[1],r=e.autoTrim[0]),(i||!1===i)&&(a=i),(o||!1===o)&&(r=o),"slurp"===a&&"slurp"===r?t.trim():("_"===a||"slurp"===a?t=String.prototype.trimLeft?t.trimLeft():t.replace(/^[\s\uFEFF\xA0]+/,""):"-"!==a&&"nl"!==a||(t=t.replace(/^(?:\n|\r|\r\n)/,"")),"_"===r||"slurp"===r?t=String.prototype.trimRight?t.trimRight():t.replace(/[\s\uFEFF\xA0]+$/,""):"-"!==r&&"nl"!==r||(t=t.replace(/(?:\n|\r|\r\n)$/,"")),t)}(t,o,g,e),t&&(t=t.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),u.push(t)))}for(;null!==(l=h.exec(t));){var v,y=l[1],_=l[2],b=l[3]||"";for(var w in a)if(a[w]===b){v=w;break}f(y,_),p=l.index+l[0].length,v||i("unrecognized tag type: "+b,t,p);var x=m(l.index,v),$=x.t;if("h"===$){var S=x.n||"";o.async&&s.test(S)&&(x.a=!0,x.n=S.replace(s,"")),x=r(x),u.push(x)}else if("c"===$){if(n.n===x.n)return d?(d.d=u,n.b.push(d)):n.d=u,n;i("Helper start and end don't match",t,l.index+l[0].length)}else if("b"===$){d?(d.d=u,n.b.push(d)):n.d=u;var A=x.n||"";o.async&&s.test(A)&&(x.a=!0,x.n=A.replace(s,"")),d=x,u=[]}else if("s"===$){var k=x.n||"";o.async&&s.test(k)&&(x.a=!0,x.n=k.replace(s,"")),u.push(x)}else u.push(x)}if(!c)throw e('unclosed helper "'+n.n+'"');return f(t.slice(p,t.length),!1),n.d=u,n}({f:[]},!0);if(o.plugins)for(var v=0;v<o.plugins.length;v++){var y=o.plugins[v];y.processAST&&(f.d=y.processAST(f.d,o))}return f.d}function g(tLine truncated
|
||||
class="entity-value ${x?"clickable":""}"
|
||||
title=${$}
|
||||
@click="${x?()=>r(w):null}"
|
||||
>
|
||||
${qe(Ze(t,!!b&&l))}
|
||||
${Ke(Je(t,!!b&&l))}
|
||||
</div>`}else if("relativetime"===n)S=B`
|
||||
<div class="entity-value">
|
||||
<ha-relative-time .datetime=${i} .hass=${e}></ha-relative-time>
|
||||
</div>
|
||||
`;else if("object"==typeof i){const[t]=i.entity_id.split(".");A=t,k=i.state,C=si.includes(t);const o=[C&&"toggle-entity",A&&`domain-${ci(A)}`,k&&`state-${ci(k)}`,C&&We(Ue({icon:y||i.attributes?.icon,label:s||i.attributes?.friendly_name,entity:i,hass:e}))].filter(Boolean).join(" ");if("timer"===t)S=B`
|
||||
`;else if("object"==typeof i){const[t]=i.entity_id.split(".");A=t,k=i.state,C=ci.includes(t);const o=[C&&"toggle-entity",A&&`domain-${li(A)}`,k&&`state-${li(k)}`,C&&Be(We({icon:y||i.attributes?.icon,label:s||i.attributes?.friendly_name,entity:i,hass:e}))].filter(Boolean).join(" ");if("timer"===t)S=B`
|
||||
<div
|
||||
class="entity-value ${x?"clickable":""}"
|
||||
title=${$}
|
||||
@@ -2547,34 +2644,34 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
title=${$}
|
||||
@click="${x?()=>r(i.entity_id):null}"
|
||||
>
|
||||
${Ze(n,b?l:s||h,n)}
|
||||
${Je(n,b?l:s||h,n)}
|
||||
</div>
|
||||
`}}else{let t="number"==typeof d?Ve(i,{decimals:d,locale:e.locale}):i;S=B`<div
|
||||
class="entity-value ${x?"clickable":""}"
|
||||
title=${$||q}
|
||||
@click=${x?()=>r(w):null}
|
||||
>
|
||||
${Ze(t,!!b&&l)}
|
||||
</div>`}if(!1===s)return S;const E=s||$,z=["entity-heading",x&&"clickable",C&&"toggle-entity",A&&`domain-${ci(A)}`,k&&`state-${ci(k)}`,C&&We(Ue({icon:y||i?.attributes?.icon,label:"string"==typeof s?s:i?.attributes?.friendly_name,entity:i,hass:e}))].filter(Boolean).join(" "),T=y?B`
|
||||
${Je(t,!!b&&l)}
|
||||
</div>`}if(!1===s)return S;const E=s||$,z=["entity-heading",x&&"clickable",C&&"toggle-entity",A&&`domain-${li(A)}`,k&&`state-${li(k)}`,C&&Be(We({icon:y||i?.attributes?.icon,label:"string"==typeof s?s:i?.attributes?.friendly_name,entity:i,hass:e}))].filter(Boolean).join(" "),T=y?B`
|
||||
<ha-icon
|
||||
icon="${y}"
|
||||
title=${E}
|
||||
@click=${x?()=>r(w):null}
|
||||
></ha-icon>
|
||||
`:"string"==typeof _?B`${qe(_)}`:` ${s}${!1===v?"":":"} `;return[B`<div
|
||||
`:"string"==typeof _?B`${Ke(_)}`:` ${s}${!1===v?"":":"} `;return[B`<div
|
||||
class=${z}
|
||||
title=${y?E:q}
|
||||
@click=${x?()=>r(w):null}
|
||||
>
|
||||
${T}
|
||||
</div>`,S]}function di({_hide:t,entity:e,unit:i,hass:o,entities:a,config:r,localize:n,openEntityPopover:s,adapter:c}){const l=r.current_value_entity,d=l?o.states[l]:e,h=l?d?.state:c.getCurrentValue(e.attributes),u=l?d?.attributes?.unit_of_measurement??i:c.getCurrentValueUnit?.(e.attributes,o.config)??i,p=r?.layout?.entities?.labels??!0,g=!1!==r?.layout?.entities?.separator,m=pe(e,o,n),f=(!0===r?.hide_current_value_when_off||!0===r?.hide?.current_value_when_off||!0===r?.hide?.temperature_when_off)&&e.state===Ne.OFF,v=[li({hide:t.temperature||f||null==h,state:Ze(Ve(h,{...r,locale:o.locale}),u),hass:o,openEntityPopover:s,details:{heading:!!p&&(r?.label?.temperature??n("ui.card.climate.currently")),tooltip:d?.attributes?.friendly_name??l,entity:l??r.entity,separator:g}}),li({hide:t.state,state:m,hass:o,openEntityPopover:s,details:{heading:!!p&&(r?.label?.state??n("ui.panel.lovelace.editor.card.generic.state")),entity:r.entity,separator:g}}),...(a??[]).map(({name:t,state:i,show:a,_hide_when_off:c,hide_when_off:l,...d})=>li({hide:!1===a||(!0===c||!0===l)&&e.state===Ne.OFF,state:i,hass:o,localize:n,openEntityPopover:s,details:{...d,heading:p&&t,tooltip:t,config:r,variables:r.variables,separator:g}}))||null].filter(t=>null!==t);return function(t,e){const{type:i="table",labels:o=!0,alignment:a}=t?.layout?.entities??{},r=[o?"with-labels":"without-labels","list"===i?"as-list":"as-table","left"===a?"align-left":"",1===e.filter(t=>null!=t).length?"single-row":""];return B` <div class="entities ${r.join(" ")}">${e}</div> `}(r,v)}const hi={"st:fan-speed-4":{path:"M16 15V21H19V23H21V15H19V19H18V15H16Z"},"st:fan-speed-5":{path:"M16 15H21V17H18V18H19C20.11 18 21 18.89 21 20V21C21 22.11 20.11 23 19 23H16V21H19V20H16V15Z"}};function ui({state:t,entity:e,hass:i,mode:o,adapter:a,modeOptions:r,localize:n,setMode:s}){const{type:c,hide_when_off:l,mode:d="none",list:h,name:u,heading:p,icons:g}=o;if(0===h.length||l&&t===Ne.OFF)return null;const m="hvac"===c?null:a.getModePayloadKey(c);let f=m?`state_attributes.${a.getLocalizationDomain()}.${m}.`:"";"hvac"===c?f="component.climate.state._.":"vane_horizontal"===c||"vane_vertical"===c?f="":"direction"!==c&&"oscillating"!==c&&"mode"!==c||(f="");const v=(t,e=!1)=>t?!1===r?.icons||!1===g||["swing","swing_horizontal","swing_vertical","vane_horizontal","vane_vertical"].includes(c)&&!0!==g&&!e?null:function(t){return t?B` <ha-icon class="mode-icon" .icon=${t}></ha-icon> `:null}(t):null,y=(t,e)=>{const i=n(t);return i&&i!==t?i:e},_="hvac"==c?"operation":`${c}_mode`;let b;b="vane_horizontal"===c?"Vane Horizontal":"vane_vertical"===c?"Vane Vertical":"swing_horizontal"===c?y("ui.card.climate.swing_horizontal_mode","Swing Horizontal"):"swing_vertical"===c?y("ui.card.climate.swing_vertical_mode","Swing Vertical"):"direction"===c?"Direction":"oscillating"===c?"Oscillating":"mode"===c?"Mode":"preset"===c?!0===p&&y(`ui.card.${a.getLocalizationDomain()}.${_}`,"Preset"):"state"===c?!0===p&&"State":y(`ui.card.${a.getLocalizationDomain()}.${_}`,"hvac"===c?"Operation":"Mode");const w=!1!==u&&(u||b),x="fan"===c||"preset"===c&&"fan"===a.getLocalizationDomain()?"Fan speed":"swing"===c?"Swing mode":"swing_horizontal"===c?y("ui.card.climate.swing_horizontal_mode","Horizontal swing"):"swing_vertical"===c?y("ui.card.climate.swing_vertical_mode","Vertical swing"):"vane_horizontal"===c?"Horizontal vane":"vane_vertical"===c?"Vertical vane":"",$=(!0===r?.headings||!0===p)&&!1!==w,S="preset"===c&&"fan"===a.getLocalizationDomain(),A=("hvac"===c||"state"===c)&&h.length<=3,k="preset"===c&&h.length<=4||["swing","swing_horizontal","swing_vertical","vane_horizontal","vane_vertical"].includes(c),C=h.length>4||"hvac"===c&&h.length>3||"fan"===c&&h.length>3;return B`
|
||||
</div>`,S]}function hi({_hide:t,entity:e,unit:i,hass:o,entities:a,config:r,localize:n,openEntityPopover:s,adapter:c}){const l=r.current_value_entity,d=l?o.states[l]:e,h=l?d?.state:c.getCurrentValue(e.attributes),u=l?d?.attributes?.unit_of_measurement??i:c.getCurrentValueUnit?.(e.attributes,o.config)??i,p=r?.layout?.entities?.labels??!0,g=!1!==r?.layout?.entities?.separator,m=r?.state_labels?.[e.state]??pe(e,o,n),f=(!0===r?.hide_current_value_when_off||!0===r?.hide?.current_value_when_off||!0===r?.hide?.temperature_when_off)&&e.state===Me.OFF,v=[di({hide:t.temperature||f||null==h,state:Je(Ve(h,{...r,locale:o.locale}),u),hass:o,openEntityPopover:s,details:{heading:!!p&&(r?.label?.temperature??n("ui.card.climate.currently")),tooltip:d?.attributes?.friendly_name??l,entity:l??r.entity,separator:g}}),di({hide:t.state,state:m,hass:o,openEntityPopover:s,details:{heading:!!p&&(r?.label?.state??n("ui.panel.lovelace.editor.card.generic.state")),entity:r.entity,separator:g}}),...(a??[]).map(({name:t,state:i,show:a,_hide_when_off:c,hide_when_off:l,...d})=>di({hide:!1===a||(!0===c||!0===l)&&e.state===Me.OFF,state:i,hass:o,localize:n,openEntityPopover:s,details:{...d,heading:p&&t,tooltip:t,config:r,variables:r.variables,separator:g}}))||null].filter(t=>null!==t);return function(t,e){const{type:i="table",labels:o=!0,alignment:a}=t?.layout?.entities??{},r=[o?"with-labels":"without-labels","list"===i?"as-list":"as-table","left"===a?"align-left":"",1===e.filter(t=>null!=t).length?"single-row":""];return B` <div class="entities ${r.join(" ")}">${e}</div> `}(r,v)}const ui={"st:fan-speed-4":{path:"M16 15V21H19V23H21V15H19V19H18V15H16Z"},"st:fan-speed-5":{path:"M16 15H21V17H18V18H19C20.11 18 21 18.89 21 20V21C21 22.11 20.11 23 19 23H16V21H19V20H16V15Z"}};function pi({state:t,entity:e,hass:i,mode:o,adapter:a,modeOptions:r,localize:n,setMode:s}){const{type:c,hide_when_off:l,mode:d="none",list:h,name:u,heading:p,icons:g}=o;if(0===h.length||l&&t===Me.OFF)return null;const m="hvac"===c?null:a.getModePayloadKey(c);let f=m?`state_attributes.${a.getLocalizationDomain()}.${m}.`:"";"hvac"===c?f="component.climate.state._.":"vane_horizontal"===c||"vane_vertical"===c?f="":"direction"!==c&&"oscillating"!==c&&"mode"!==c||(f="");const v=(t,e=!1)=>t?!1===r?.icons||!1===g||["swing","swing_horizontal","swing_vertical","vane_horizontal","vane_vertical"].includes(c)&&!0!==g&&!e?null:function(t){return t?B` <ha-icon class="mode-icon" .icon=${t}></ha-icon> `:null}(t):null,y=(t,e)=>{const i=n(t);return i&&i!==t?i:e},_="hvac"==c?"operation":`${c}_mode`;let b;b="vane_horizontal"===c?"Vane Horizontal":"vane_vertical"===c?"Vane Vertical":"swing_horizontal"===c?y("ui.card.climate.swing_horizontal_mode","Swing Horizontal"):"swing_vertical"===c?y("ui.card.climate.swing_vertical_mode","Swing Vertical"):"direction"===c?"Direction":"oscillating"===c?"Oscillating":"mode"===c?"Mode":"preset"===c?!0===p&&y(`ui.card.${a.getLocalizationDomain()}.${_}`,"Preset"):"state"===c?!0===p&&"State":y(`ui.card.${a.getLocalizationDomain()}.${_}`,"hvac"===c?"Operation":"Mode");const w=!1!==u&&(u||b),x="fan"===c||"preset"===c&&"fan"===a.getLocalizationDomain()?"Fan speed":"swing"===c?"Swing mode":"swing_horizontal"===c?y("ui.card.climate.swing_horizontal_mode","Horizontal swing"):"swing_vertical"===c?y("ui.card.climate.swing_vertical_mode","Vertical swing"):"vane_horizontal"===c?"Horizontal vane":"vane_vertical"===c?"Vertical vane":"",$=(!0===r?.headings||!0===p)&&!1!==w,S="preset"===c&&"fan"===a.getLocalizationDomain(),A=("hvac"===c||"state"===c||"fan"===c)&&h.length<=4,k="preset"===c&&h.length<=4||["swing","swing_horizontal","swing_vertical","vane_horizontal","vane_vertical"].includes(c),C=h.length>4||"hvac"===c&&h.length>4||"fan"===c&&h.length>4;return B`
|
||||
<div
|
||||
class="modes ${c} ${S?"fan-preset":""} ${$?"heading":""} ${k?"compact":""} ${C?"dense":""} ${A?"sparse":""}"
|
||||
role="group"
|
||||
aria-label=${w||c}
|
||||
>
|
||||
${$?B` <div class="mode-title">${w}</div> `:""}
|
||||
${h.map(({value:o,icon:a,iconConfigured:l,name:h,hide_when_off:u})=>{if(!0===u&&t===Ne.OFF)return q;const p=(t=>String(t).replace(/[^a-z0-9_-]/gi,""))(o),g=((t,o)=>!1===t||!1===r?.names?null:t!==o?f?n(t,f):t:"hvac"!==c&&"state"!==c||"function"!=typeof i?.formatEntityState?m&&e&&"function"==typeof i?.formatEntityAttributeValue?i.formatEntityAttributeValue(e,m,o):f?n(t,f):t:i.formatEntityState({...e,state:o}))(h,o);return B`
|
||||
${h.map(({value:o,icon:a,iconConfigured:l,name:h,hide_when_off:u})=>{if(!0===u&&t===Me.OFF)return q;const p=(t=>String(t).replace(/[^a-z0-9_-]/gi,""))(o),g=((t,o)=>!1===t||!1===r?.names?null:t!==o?f?n(t,f):t:"hvac"!==c&&"state"!==c||"function"!=typeof i?.formatEntityState?m&&e&&"function"==typeof i?.formatEntityAttributeValue?i.formatEntityAttributeValue(e,m,o):f?n(t,f):t:i.formatEntityState({...e,state:o}))(h,o);return B`
|
||||
<div
|
||||
class="mode-item ${p} ${o===d?"active":""}"
|
||||
role="button"
|
||||
@@ -2590,7 +2687,7 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
</div>
|
||||
`})}
|
||||
</div>
|
||||
`}window.customIconsets=window.customIconsets||{},window.customIconsets.st||(window.customIconsets.st=async t=>{const e=hi[`st:${t}`];return e?{path:`M13 19C13 17.59 13.5 16.3 14.3 15.28C14.17 14.97 14.03 14.65 13.86 14.34C14.26 14 14.57 13.59 14.77 13.11C15.26 13.21 15.78 13.39 16.25 13.67C17.07 13.25 18 13 19 13C20.05 13 21.03 13.27 21.89 13.74C21.95 13.37 22 12.96 22 12.5C22 8.92 18.03 8.13 14.33 10.13C14 9.73 13.59 9.42 13.11 9.22C13.3 8.29 13.74 7.24 14.73 6.75C17.09 5.57 17 2 12.5 2C8.93 2 8.14 5.96 10.13 9.65C9.72 9.97 9.4 10.39 9.21 10.87C8.28 10.68 7.23 10.25 6.73 9.26C5.56 6.89 2 7 2 11.5C2 15.07 5.95 15.85 9.64 13.87C9.96 14.27 10.39 14.59 10.88 14.79C10.68 15.71 10.24 16.75 9.26 17.24C6.9 18.42 7 22 11.5 22C12.31 22 13 21.78 13.5 21.41C13.19 20.67 13 19.86 13 19M12 13C11.43 13 11 12.55 11 12S11.43 11 12 11C12.54 11 13 11.45 13 12S12.54 13 12 13${e.path}`}:{path:""}});const pi=Object.values(mt),gi="hass:chevron-up",mi="hass:chevron-down",fi="mdi:plus",vi="mdi:minus",yi={temperature:!1,state:!1},_i=[mt.PRESET,mt.FAN,mt.HVAC,mt.SWING,mt.SWING_HORIZONTAL,mt.SWING_VERTICAL,mt.VANE_HORIZONTAL,mt.VANE_VERTICAL,mt.DIRECTION,mt.OSCILLATING,mt.STATE],bi=["entity","hide_when_off","hide_off_when_off"];function wi(t,e,i){const o=$i(String(e),i);if(Si(o))return!1!==o.include;const a=Object.keys(i).some(t=>!t.startsWith("_")),r=t===mt.PRESET;return o??!(r&&a)}function xi(t){return t.toLowerCase().replace(/\s+/g,"_")}function $i(t,e){const i=xi(t),o=e[t];if(void 0!==o)return o;if(void 0!==e[i])return e[i];const a=Object.entries(e).find(([t])=>!t.startsWith("_")&&!bi.includes(t)&&xi(t)===i);return a?.[1]}function Si(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Ai(t,e){const i=Array.isArray(e._order)?e._order.map(String):Object.keys(e).filter(t=>!t.startsWith("_")&&!bi.includes(t));if(0===i.length)return t;const o=new Map;t.forEach(t=>{o.set(xi(String(t)),t)});const a=new Set,r=[];return i.forEach(t=>{const e=xi(t);o.has(e)&&!a.has(e)&&(r.push(o.get(e)),a.add(e))}),t.forEach(t=>{const e=xi(String(t));a.has(e)||(r.push(t),a.add(e))}),r}function ki(t,e,i,o={}){let a=e[i.getModeAttribute(t)];return t===mt.STATE?a=["off","on"]:t===mt.DIRECTION&&e.direction?a=["forward","reverse"]:t===mt.OSCILLATING&&"boolean"==typeof e.oscillating&&(a=[!1,!0]),Array.isArray(a)?Ai(a,o).filter(e=>wi(t,e,o)).map(e=>{const i=String(e),r=$i(i,o),n=Si(r)?r:{},{name:s,...c}=n,l=!0===n.hide_when_off||!0===o.hide_off_when_off&&"off"===xi(i),d=!1!==s&&("string"==typeof s?s:be(i));return{...c,hide_when_off:l||void 0,icon:n.icon??(t===mt.FAN?He(i,a):void 0)??_e(i),iconConfigured:void 0!==n.icon,value:i,name:d}}):[]}function Ci(t){return"string"==typeof t?.entity_id&&t.entity_id.startsWith("select.")&&Array.isArray(t.attributes?.options)}function Ei(t,e={}){return Ai(t.attributes.options,e).filter(t=>wi("select",t,e)).map(t=>{const i=String(t),o=$i(i,e),a=Si(o)?o:{},{name:r,...n}=a,s=!0===a.hide_when_off||!0===e.hide_off_when_off&&"off"===xi(i),c=!1!==r&&("string"==typeof r?r:be(i));return{...n,hide_when_off:s||void 0,icon:a.icon??_e(i),iconConfigured:void 0!==a.icon,value:i,name:c}})}function zi(t,e){if("fan"!==t)return"";const i=Number(e?.percentage);if(Number.isNaN(i))return"";const o=Math.min(Math.max(i,0),100);return`--st-fan-spin-duration: ${Math.max(.9,3.2-o/100*2.1).toFixed(2)}s;`}function Ti(t){const e=t?.style;if("object"==typeof e&&e){const t=e["ha-card"];if("string"==typeof t)return t.trim();const i=e["."];if("string"==typeof i){const t=i.match(/ha-card\s*\{([\s\S]*?)\}/);return(t?.[1]??"").trim()}}if("string"!=typeof e)return"";const i=e.match(/ha-card\s*\{([\s\S]*?)\}/);return(i?.[1]??"").trim()}function Oi(t,e,i,o){return pi.includes(t)&&(t===mt.STATE?"fan"===e||"humidifier"===e:void 0!==i[o.getModeAttribute(t)])}function Ni(t,e,i,o){return t.filter(t=>Oi(t,e,i,o)).map(t=>({type:t,hide_when_off:!1,list:ki(t,i,o)}))}class Mi extends lt{constructor(){super(...arguments),this.modes=[],this._hass={},this.entities=[],this.showEntities=!0,this.name="",this.stepSize=.5,this._values={},this._updatingValues=!1,this._hide=yi,this._updatingValuesTimeout=null,this._holdTimer=null,this._holdFired=!1,this._clickCount=0,this._clickTimer=null,this._setpointUpdateTimer=null,this._pendingSetpointValues=null,this._setpointDebounce=500,this.localize=(t,e="")=>{const i=`${e}${t}`;return this._hass.localize?.(i)||t},this.toggleEntityChanged=(t,e)=>{if(!this.header||!e)return;const i=t.target;this._callAction("homeassistant.turn_"+(i.checked?"on":"off"),{entity_id:e})},this.setMode=(t,e)=>{if(t&&e){const i=$t(this.config.entity);if(t===mt.STATE)return this._callAction(`${i.getLocalizationDomain()}.turn_${e}`,{entity_id:this.config.entity}),void vt(this,"haptic","light");const o=this.modes.find(e=>e.type===t);if(o?.entity)return this._callAction("select.select_option",{entity_id:o.entity,option:e}),void vt(this,"haptic","light");const a=i.transformModePayloadValue?.(t,e)??e;this._callAction(`${i.getLocalizationDomain()}.${i.getModeLine truncated
|
||||
`}window.customIconsets=window.customIconsets||{},window.customIconsets.st||(window.customIconsets.st=async t=>{const e=ui[`st:${t}`];return e?{path:`M13 19C13 17.59 13.5 16.3 14.3 15.28C14.17 14.97 14.03 14.65 13.86 14.34C14.26 14 14.57 13.59 14.77 13.11C15.26 13.21 15.78 13.39 16.25 13.67C17.07 13.25 18 13 19 13C20.05 13 21.03 13.27 21.89 13.74C21.95 13.37 22 12.96 22 12.5C22 8.92 18.03 8.13 14.33 10.13C14 9.73 13.59 9.42 13.11 9.22C13.3 8.29 13.74 7.24 14.73 6.75C17.09 5.57 17 2 12.5 2C8.93 2 8.14 5.96 10.13 9.65C9.72 9.97 9.4 10.39 9.21 10.87C8.28 10.68 7.23 10.25 6.73 9.26C5.56 6.89 2 7 2 11.5C2 15.07 5.95 15.85 9.64 13.87C9.96 14.27 10.39 14.59 10.88 14.79C10.68 15.71 10.24 16.75 9.26 17.24C6.9 18.42 7 22 11.5 22C12.31 22 13 21.78 13.5 21.41C13.19 20.67 13 19.86 13 19M12 13C11.43 13 11 12.55 11 12S11.43 11 12 11C12.54 11 13 11.45 13 12S12.54 13 12 13${e.path}`}:{path:""}});const gi=Object.values(mt),mi="hass:chevron-up",fi="hass:chevron-down",vi="mdi:plus",yi="mdi:minus",_i={temperature:!1,state:!1},bi=[mt.PRESET,mt.FAN,mt.HVAC,mt.SWING,mt.SWING_HORIZONTAL,mt.SWING_VERTICAL,mt.VANE_HORIZONTAL,mt.VANE_VERTICAL,mt.DIRECTION,mt.OSCILLATING,mt.STATE],wi=["entity","hide_when_off","hide_off_when_off"];function xi(t,e,i){const o=Si(String(e),i);if(Ai(o))return!1!==o.include;const a=Object.keys(i).some(t=>!t.startsWith("_")),r=t===mt.PRESET;return o??!(r&&a)}function $i(t){return t.toLowerCase().replace(/\s+/g,"_")}function Si(t,e){const i=$i(t),o=e[t];if(void 0!==o)return o;if(void 0!==e[i])return e[i];const a=Object.entries(e).find(([t])=>!t.startsWith("_")&&!wi.includes(t)&&$i(t)===i);return a?.[1]}function Ai(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function ki(t,e){const i=Array.isArray(e._order)?e._order.map(String):Object.keys(e).filter(t=>!t.startsWith("_")&&!wi.includes(t));if(0===i.length)return t;const o=new Map;t.forEach(t=>{o.set($i(String(t)),t)});const a=new Set,r=[];return i.forEach(t=>{const e=$i(t);o.has(e)&&!a.has(e)&&(r.push(o.get(e)),a.add(e))}),t.forEach(t=>{const e=$i(String(t));a.has(e)||(r.push(t),a.add(e))}),r}function Ci(t,e,i,o={}){let a=e[i.getModeAttribute(t)];return t===mt.STATE?a=["off","on"]:t===mt.DIRECTION&&e.direction?a=["forward","reverse"]:t===mt.OSCILLATING&&"boolean"==typeof e.oscillating&&(a=[!1,!0]),Array.isArray(a)?ki(a,o).filter(e=>xi(t,e,o)).map(e=>{const i=String(e),r=Si(i,o),n=Ai(r)?r:{},{name:s,...c}=n,l=!0===n.hide_when_off||!0===o.hide_off_when_off&&"off"===$i(i),d=!1!==s&&("string"==typeof s?s:be(i));return{...c,hide_when_off:l||void 0,icon:n.icon??(t===mt.FAN?Ie(i,a):void 0)??_e(i),iconConfigured:void 0!==n.icon,value:i,name:d}}):[]}function Ei(t){return"string"==typeof t?.entity_id&&t.entity_id.startsWith("select.")&&Array.isArray(t.attributes?.options)}function zi(t,e={}){return ki(t.attributes.options,e).filter(t=>xi("select",t,e)).map(t=>{const i=String(t),o=Si(i,e),a=Ai(o)?o:{},{name:r,...n}=a,s=!0===a.hide_when_off||!0===e.hide_off_when_off&&"off"===$i(i),c=!1!==r&&("string"==typeof r?r:be(i));return{...n,hide_when_off:s||void 0,icon:a.icon??_e(i),iconConfigured:void 0!==a.icon,value:i,name:c}})}function Ti(t,e){if("fan"!==t)return"";const i=Number(e?.percentage);if(Number.isNaN(i))return"";const o=Math.min(Math.max(i,0),100);return`--st-fan-spin-duration: ${Math.max(.9,3.2-o/100*2.1).toFixed(2)}s;`}function Oi(t){const e=t?.style;if("object"==typeof e&&e){const t=e["ha-card"];if("string"==typeof t)return t.trim();const i=e["."];if("string"==typeof i){const t=i.match(/ha-card\s*\{([\s\S]*?)\}/);return(t?.[1]??"").trim()}}if("string"!=typeof e)return"";const i=e.match(/ha-card\s*\{([\s\S]*?)\}/);return(i?.[1]??"").trim()}function Ni(t,e,i,o){return gi.includes(t)&&(t===mt.STATE?"fan"===e||"humidifier"===e:void 0!==i[o.getModeAttribute(t)])}function Mi(t,e,i,o){return t.filter(t=>Ni(t,e,i,o)).map(t=>({type:t,hide_when_off:!1,list:Ci(t,i,o)}))}class Ri extends lt{constructor(){super(...arguments),this.modes=[],this._hass={},this.entities=[],this.showEntities=!0,this.name="",this.stepSize=.5,this._values={},this._updatingValues=!1,this._hide=_i,this._updatingValuesTimeout=null,this._holdTimer=null,this._holdFired=!1,this._clickCount=0,this._clickTimer=null,this._setpointUpdateTimer=null,this._pendingSetpointValues=null,this._setpointDebounce=500,this.localize=(t,e="")=>{const i=`${e}${t}`;return this._hass.localize?.(i)||t},this.toggleEntityChanged=(t,e)=>{if(!this.header||!e)return;const i=t.target;this._callAction("homeassistant.turn_"+(i.checked?"on":"off"),{entity_id:e})},this.setMode=(t,e)=>{if(t&&e){const i=$t(this.config.entity);if(t===mt.STATE)return this._callAction(`${i.getLocalizationDomain()}.turn_${e}`,{entity_id:this.config.entity}),void vt(this,"haptic","light");const o=this.modes.find(e=>e.type===t);if(o?.entity)return this._callAction("select.select_option",{entity_id:o.entity,option:e}),void vt(this,"haptic","light");const a=i.transformModePayloadValue?.(t,e)??e;this._callAction(`${i.getLocalizationDomain()}.${i.getModeLine truncated
|
||||
<ha-alert alert-type="warning">
|
||||
Decimals is set to 0 and step_size is lower than 1. Decrementing a
|
||||
setpoint will likely not work. Change one of the settings to clear
|
||||
@@ -2606,21 +2703,21 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
Entity not available: ${o.entity}
|
||||
</ha-alert>
|
||||
</ha-card>
|
||||
`;const n=$t(o.entity),s=ue(a),{min:c,max:l}=n.getRange(a.attributes),d=this.getUnit(),h=o.entity.split(".")[0],u=Object.keys(e).length,p=this.config?.layout?.step,g=p??"column",m="row"===g,f=["unavailable","unknown"].includes(a.state),v=t=>"string"==typeof t?t.replace(/[^a-z0-9_-]/gi,""):"",y=[!this.header&&"no-header",`domain-${v(h)}`,`state-${v(a.state)}`,!1===this.config.enhanced_visuals&&"standard-visuals",!0===this.config.embedded&&"embedded",v(s),f&&v(a.state)].filter(t=>!!t),_=["body",this.showEntities&&"has-entities",`step-${g}`,`setpoint-count-${u}`].filter(t=>!!t),b=!0===o.embedded,w=b?function(t,e,i){return[Ti(t.card_mod),zi(e,i)].filter(t=>!!t).join("; ")}(o,h,a.attributes):zi(h,a.attributes),x=this.showEntities?di({_hide:t,unit:d,hass:this._hass,entity:this.entity,entities:this.entities,config:this.config,adapter:n,localize:this.localize,openEntityPopover:this.openEntityPopover}):"",$=b?B`<div class="embedded-header-reserve" aria-hidden="true"></div>`:Be({header:this.header,hass:this._hass,toggleEntityChanged:this.toggleEntityChanged,entity:this.entity,openEntityPopover:this.openEntityPopover});return B`
|
||||
<ha-card class="${y.join(" ")}" style=${w}>
|
||||
`;const n=$t(o.entity),s=ue(a),{min:c,max:l}=n.getRange(a.attributes),d=this.getUnit(),h=o.entity.split(".")[0],u=Object.keys(e).length,p=!1===this.config.enhanced_visuals?this.config?.layout?.step??"column":this.config?.layout?.step??"row",g="row"===p,m=["unavailable","unknown"].includes(a.state),f=t=>"string"==typeof t?t.replace(/[^a-z0-9_-]/gi,""):"",v=[!this.header&&"no-header",`domain-${f(h)}`,`state-${f(a.state)}`,!1===this.config.enhanced_visuals&&"standard-visuals",!0===this.config.embedded&&"embedded",f(s),m&&f(a.state)].filter(t=>!!t),y=["body",this.showEntities&&"has-entities",`step-${p}`,`setpoint-count-${u}`].filter(t=>!!t),_=!0===o.embedded,b=_?function(t,e,i){return[Oi(t.card_mod),Ti(e,i)].filter(t=>!!t).join("; ")}(o,h,a.attributes):Ti(h,a.attributes),w=this.showEntities?hi({_hide:t,unit:d,hass:this._hass,entity:this.entity,entities:this.entities,config:this.config,adapter:n,localize:this.localize,openEntityPopover:this.openEntityPopover}):"",x=_?B`<div class="embedded-header-reserve" aria-hidden="true"></div>`:Ge({header:this.header,hass:this._hass,toggleEntityChanged:this.toggleEntityChanged,entity:this.entity,openEntityPopover:this.openEntityPopover});return B`
|
||||
<ha-card class="${v.join(" ")}" style=${b}>
|
||||
${o.styles?B`<style>
|
||||
${o.styles}
|
||||
</style>`:q}
|
||||
${r}
|
||||
${$}
|
||||
<section class="${_.join(" ")}">
|
||||
${x}
|
||||
${this.renderSetpoints({values:e,minValue:c,maxValue:l,unit:d,row:m,stepLayout:g,isOff:a.state===Ne.OFF,disableSteppers:"climate"===h&&a.state===Ne.OFF&&!0===this.config.disable_setpoint_change_when_off})}
|
||||
${x}
|
||||
<section class="${y.join(" ")}">
|
||||
${w}
|
||||
${this.renderSetpoints({values:e,minValue:c,maxValue:l,unit:d,row:g,stepLayout:p,isOff:a.state===Me.OFF,disableSteppers:"climate"===h&&a.state===Me.OFF&&!0===this.config.disable_setpoint_change_when_off})}
|
||||
</section>
|
||||
|
||||
${this.modes.length?B`
|
||||
<section class="controls">
|
||||
${this.modes.map(t=>ui({state:a.state,entity:a,hass:this._hass,mode:t,adapter:n,localize:this.localize,modeOptions:this.config?.layout?.mode??{},setMode:this.setMode}))}
|
||||
${this.modes.map(t=>pi({state:a.state,entity:a,hass:this._hass,mode:t,adapter:n,localize:this.localize,modeOptions:this.config?.layout?.mode??{},setMode:this.setMode}))}
|
||||
</section>
|
||||
`:q}
|
||||
</ha-card>
|
||||
@@ -2637,9 +2734,9 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
aria-label=${`${l?"Decrease":"Increase"} ${t}`}
|
||||
@click="${()=>l?this.setTemperature(-this.stepSize,t):null===e&&null!==i?this.setTemperature(0,t,i):this.setTemperature(this.stepSize,t)}"
|
||||
>
|
||||
<ha-icon .icon=${l?a?vi:mi:a?fi:gi}></ha-icon>
|
||||
<ha-icon .icon=${l?a?yi:fi:a?vi:mi}></ha-icon>
|
||||
</button>
|
||||
`}renderSetpointValue({field:t,value:e,unit:i,isOff:o}){const a=["string","number"].includes(typeof e)&&""!==e&&null!==e,r=!1!==i&&a,n=o&&!a,s=n?"OFF":Ve(e,{...this.config,locale:this._hass.locale});return B`
|
||||
`}renderSetpointValue({field:t,value:e,unit:i,isOff:o}){const a=["string","number"].includes(typeof e)&&""!==e&&null!==e,r=!1!==i&&a,n=o&&!a,s=n?"OFF":Ve(e,{...this.config,locale:this._hass.locale}),c=r&&"string"==typeof i?i:"",l="%"===c?"":" ",d=c&&s.endsWith(c)?s.slice(0,-c.length).trimEnd():s,h=c?`${d}${l}${c}`:s;return B`
|
||||
<h3
|
||||
@pointerdown=${this._onActionPointerDown}
|
||||
@pointerup=${this._onActionPointerUp}
|
||||
@@ -2648,9 +2745,9 @@ ha-card.standard-visuals .thermostat-trigger:active {
|
||||
@keydown=${this._onSetpointKeyDown}
|
||||
role="button"
|
||||
tabindex="0"
|
||||
aria-label=${`${t}: ${s}${r?` ${i}`:""}`}
|
||||
aria-label=${`${t}: ${h}`}
|
||||
class=${["current--value",n&&"current--off",this._updatingValues&&"updating"].filter(Boolean).join(" ")}
|
||||
>
|
||||
${Ze(s,!!r&&i)}
|
||||
${d}${c?B`${l}<span class="current--unit">${c}</span>`:q}
|
||||
</h3>
|
||||
`}setTemperature(t,e,i){this._updatingValues=!0,this._updatingValuesTimeout&&clearTimeout(this._updatingValuesTimeout),this._updatingValuesTimeout=setTimeout(()=>{this._updatingValues=!1,this._updatingValuesTimeout=null},1e4);const o=i??this._values[e],a=Number(o)+t,{decimals:r}=this.config;this._values={...this._values,[e]:+Ve(a,{decimals:r})},this._scheduleSetpointValues(this._values)}_dispatchSetpointTap(){this.config?.tap_action?this._dispatchAction("tap"):this.openEntityPopover(this.config.entity)}_dispatchAction(t){const e="tap"===t?"tap_action":"hold"===t?"hold_action":"double_tap_action",i=this.config?.[e]??("tap"===t?{action:"more-info"}:{action:"none"});vt(this,"hass-action",{config:this.config,action:i})}getCardSize(){if(!this.config)return 1;const t=!0===this.config.embedded||this.header?1:0,e=this.showEntities&&this.entities?.length?Math.max(1,Math.ceil(this.entities.length/2)):0,i=!0===this.config.hide_setpoint||!0===this.config.hide_setpoint_when_off&&this.entity?.state===Ne.OFF||!0===this.config.hide?.setpoint_when_off&&this.entity?.state===Ne.OFF?0:1,o=this.modes?.length??0,a=this.stepSize<1&&0===this.config.decimals?1:0;return Math.max(1,t+e+i+o+a)}getUnit(){if(["boolean","string"].includes(typeof this.config.unit))return this.config?.unit;const t=this.config.entity.split(".")[0];return"fan"===t||"humidifier"===t?"%":this._hass.config?.unit_system?.temperature??!1}}Mi.HOLD_MS=500,Mi.DOUBLE_TAP_MS=250,i([pt()],Mi.prototype,"config",void 0),i([pt()],Mi.prototype,"header",void 0),i([pt()],Mi.prototype,"service",void 0),i([pt()],Mi.prototype,"modes",void 0),i([pt()],Mi.prototype,"entity",void 0),i([pt()],Mi.prototype,"entities",void 0),i([pt()],Mi.prototype,"showEntities",void 0),i([pt()],Mi.prototype,"name",void 0),i([pt({type:Object})],Mi.prototype,"_values",void 0),i([pt()],Mi.prototype,"_updatingValues",void 0),i([pt()],Mi.prototype,"_hide",void 0),customElements.get(t)||customElements.define(t,Mi),customElements.get(`${t}-editor`)||customElements.define(`${t}-editor`,Kt),customElements.get(`${t}-group`)||customElements.define(`${t}-group`,Oe),customElements.get(`${t}-group-editor`)||customElements.define(`${t}-group-editor`,de),console.info(`%c SIMPLE-THERMOSTAT %c v${e} `,"color: var(--text-primary-color); background: var(--primary-color); font-weight: 700; padding: 2px 6px; border-radius: 3px 0 0 3px;","color: var(--primary-color); background: var(--card-background-color); font-weight: 700; padding: 2px 6px; border-radius: 0 3px 3px 0;");const Ri=window;Ri.customCards=Ri.customCards||[],Ri.customCards.find(e=>e.type===t)||Ri.customCards.push({type:t,name:"Simple Thermostat",preview:!0,description:"A different take on the thermostat card",documentationURL:"https://github.com/Wheemer/simple-thermostat"}),Ri.customCards.find(e=>e.type===`${t}-group`)||Ri.customCards.push({type:`${t}-group`,name:"Simple Thermostat Group",preview:!0,description:"Switch between multiple thermostat cards in one footprint",documentationURL:"https://github.com/Wheemer/simple-thermostat"});
|
||||
`}setTemperature(t,e,i){this._updatingValues=!0,this._updatingValuesTimeout&&clearTimeout(this._updatingValuesTimeout),this._updatingValuesTimeout=setTimeout(()=>{this._updatingValues=!1,this._updatingValuesTimeout=null},1e4);const o=i??this._values[e],a=Number(o)+t,{decimals:r}=this.config;this._values={...this._values,[e]:+Ve(a,{decimals:r})},this._scheduleSetpointValues(this._values)}_dispatchSetpointTap(){this.config?.tap_action?this._dispatchAction("tap"):this.openEntityPopover(this.config.entity)}_dispatchAction(t){const e="tap"===t?"tap_action":"hold"===t?"hold_action":"double_tap_action",i=this.config?.[e]??("tap"===t?{action:"more-info"}:{action:"none"});vt(this,"hass-action",{config:this.config,action:i})}getCardSize(){if(!this.config)return 1;const t=!0===this.config.embedded||this.header?1:0,e=this.showEntities&&this.entities?.length?Math.max(1,Math.ceil(this.entities.length/2)):0,i=!0===this.config.hide_setpoint||!0===this.config.hide_setpoint_when_off&&this.entity?.state===Me.OFF||!0===this.config.hide?.setpoint_when_off&&this.entity?.state===Me.OFF?0:1,o=this.modes?.filter(t=>(!0!==t.hide_when_off||this.entity?.state!==Me.OFF)&&(t.list??[]).some(({hide_when_off:t})=>!(!0===t&&this.entity?.state===Me.OFF))).length??0,a=this.stepSize<1&&0===this.config.decimals?1:0;return Math.max(1,t+e+i+o+a)}getUnit(){if(["boolean","string"].includes(typeof this.config.unit))return this.config?.unit;const t=this.config.entity.split(".")[0];return"fan"===t||"humidifier"===t?"%":this._hass.config?.unit_system?.temperature??!1}}Ri.HOLD_MS=500,Ri.DOUBLE_TAP_MS=250,i([pt()],Ri.prototype,"config",void 0),i([pt()],Ri.prototype,"header",void 0),i([pt()],Ri.prototype,"service",void 0),i([pt()],Ri.prototype,"modes",void 0),i([pt()],Ri.prototype,"entity",void 0),i([pt()],Ri.prototype,"entities",void 0),i([pt()],Ri.prototype,"showEntities",void 0),i([pt()],Ri.prototype,"name",void 0),i([pt({type:Object})],Ri.prototype,"_values",void 0),i([pt()],Ri.prototype,"_updatingValues",void 0),i([pt()],Ri.prototype,"_hide",void 0),customElements.get(t)||customElements.define(t,Ri),customElements.get(`${t}-editor`)||customElements.define(`${t}-editor`,Kt),customElements.get(`${t}-group`)||customElements.define(`${t}-group`,Ne),customElements.get(`${t}-group-editor`)||customElements.define(`${t}-group-editor`,de),console.info(`%c SIMPLE-THERMOSTAT %c v${e} `,"color: var(--text-primary-color); background: var(--primary-color); font-weight: 700; padding: 2px 6px; border-radius: 3px 0 0 3px;","color: var(--primary-color); background: var(--card-background-color); font-weight: 700; padding: 2px 6px; border-radius: 0 3px 3px 0;");const ji=window;ji.customCards=ji.customCards||[],ji.customCards.find(e=>e.type===t)||ji.customCards.push({type:t,name:"Simple Thermostat",preview:!0,description:"A different take on the thermostat card",documentationURL:"https://github.com/Wheemer/simple-thermostat"}),ji.customCards.find(e=>e.type===`${t}-group`)||ji.customCards.push({type:`${t}-group`,name:"Simple Thermostat Group",preview:!0,description:"Switch between multiple thermostat cards in one footprint",documentationURL:"https://github.com/Wheemer/simple-thermostat"});
|
||||
Binary file not shown.
Reference in new issue
Block a user