This commit is contained in:
Home Assistant Version Control
2026-10-08 13:33:42 +00:00
parent f70a3c8f69
commit a4d25dc364
5 changed files with 81 additions and 94 deletions
@@ -1,5 +1,5 @@
(function() {
const env = {"DEBUG":true,"BUILD_TIME":"2026-10-02T16:09:58-02:30"};
const env = {"DEBUG":true,"BUILD_TIME":"2026-10-07T18:06:36-02:30"};
try {
if (process) {
process.env = Object.assign({}, process.env);
@@ -11,7 +11,7 @@
})();
var name = "simple-thermostat";
var version = "4.5.1";
var version = "4.5.2";
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -4073,6 +4073,37 @@ function isEntityAvailable(entity) {
['button', 'input_button', 'scene'].includes(entity.entity_id?.split('.')[0] ?? ''));
}
const TOGGLE_DOMAINS = [
'automation',
'fan',
'humidifier',
'input_boolean',
'light',
'switch',
];
const BUTTON_DOMAINS = ['button', 'input_button', 'script', 'scene'];
function callEntityAction(hass, entityId, checked) {
const state = hass.states?.[entityId];
if (!isEntityAvailable(state))
return;
const [domain] = entityId.split('.');
const isToggle = TOGGLE_DOMAINS.includes(domain);
const service = isToggle
? `turn_${checked ?? (state.state !== 'on') ? 'on' : 'off'}`
: domain === 'button' || domain === 'input_button'
? 'press'
: 'turn_on';
const actionDomain = isToggle ? 'homeassistant' : domain;
if (typeof hass.performAction === 'function') {
hass.performAction({
action: `${actionDomain}.${service}`,
data: { entity_id: entityId },
});
}
else {
hass.callService?.(actionDomain, service, { entity_id: entityId });
}
}
function getEntityActionAttribute(entity) {
if (typeof entity.entity_id !== 'string')
return undefined;
@@ -6923,52 +6954,10 @@ function renderTemplateContent(markup, hass) {
: o(markup);
}
const TOGGLE_DOMAINS = [
'automation',
'fan',
'humidifier',
'input_boolean',
'light',
'switch',
];
const BUTTON_DOMAINS = ['button', 'input_button', 'script', 'scene'];
const DISPLAY_VALUES = ['row', 'auto', 'button', 'toggle', 'chip'];
function toggleEntity(hass, entityId, checked) {
if (!isEntityAvailable(hass.states?.[entityId]))
return;
const service = `turn_${checked ? 'on' : 'off'}`;
if (typeof hass.performAction === 'function') {
hass.performAction({
action: `homeassistant.${service}`,
data: { entity_id: entityId },
});
}
else {
hass.callService('homeassistant', service, { entity_id: entityId });
}
}
function safeClass$1(value) {
return String(value ?? '').replace(/[^a-z0-9_-]/gi, '');
}
function callEntityAction(hass, entityId, domain) {
if (!isEntityAvailable(hass.states?.[entityId]))
return;
if (TOGGLE_DOMAINS.includes(domain)) {
const checked = hass.states?.[entityId]?.state !== 'on';
toggleEntity(hass, entityId, checked);
return;
}
const service = domain === 'button' || domain === 'input_button' ? 'press' : 'turn_on';
if (typeof hass.performAction === 'function') {
hass.performAction({
action: `${domain}.${service}`,
data: { entity_id: entityId },
});
}
else {
hass.callService(domain, service, { entity_id: entityId });
}
}
function renderIconTemplate({ icon, state, attribute, hass, config, variables, localize, }) {
if (typeof icon !== 'string' ||
!icon.includes('{{') ||
@@ -7181,7 +7170,7 @@ function renderInfoItem({ hide = false, hass, state, details, localize, openEnti
title=${entityTooltip}
aria-pressed=${isToggleEntity ? String(active) : A}
@click=${() => supportsAction
? callEntityAction(hass, state.entity_id, domain)
? callEntityAction(hass, state.entity_id)
: canOpenEntity
? openEntityPopover(state.entity_id)
: undefined}
@@ -7215,7 +7204,7 @@ function renderInfoItem({ hide = false, hass, state, details, localize, openEnti
<ha-switch
.checked=${state.state === 'on'}
.disabled=${!isEntityAvailable(state)}
@change=${(ev) => toggleEntity(hass, state.entity_id, ev.target.checked)}
@change=${(ev) => callEntityAction(hass, state.entity_id, ev.target.checked)}
></ha-switch>
</div>
`;
@@ -8114,11 +8103,9 @@ class SimpleThermostat extends i$1 {
});
};
this.toggleFooterEntity = (entityId, checked) => {
if (!isEntityAvailable(this._hass?.states?.[entityId]))
if (!this._hass)
return;
this._callAction(`homeassistant.turn_${checked ? 'on' : 'off'}`, {
entity_id: entityId,
});
callEntityAction(this._hass, entityId, checked);
fireEvent(this, 'haptic', 'light');
};
this._stopSetpointRepeat = () => {
File diff suppressed because one or more lines are too long
+21 -21
View File
@@ -4,7 +4,7 @@
"state": "ON",
"led_brightness": 100,
"countdown_to_turn_off": 0,
"voltage": 119.1,
"voltage": 119.6,
"countdown_to_turn_on": 0,
"ac_frequency": 60,
"power_factor": 0.15,
@@ -22,15 +22,15 @@
},
"0xffffb40e0607af27": {
"state": "ON",
"voltage": 118.2,
"voltage": 118.9,
"ac_frequency": 60,
"led_brightness": 100,
"countdown_to_turn_off": 0,
"countdown_to_turn_on": 0,
"power": 2.1,
"power": 1.9,
"current": 0.09,
"energy": 54.01,
"power_factor": 0.17,
"power_factor": 0.18,
"update": {
"state": "idle",
"installed_version": 268513381,
@@ -45,9 +45,9 @@
"state": "ON",
"led_brightness": 100,
"countdown_to_turn_off": 0,
"voltage": 118.5,
"voltage": 118.9,
"countdown_to_turn_on": 0,
"energy": 103.5,
"energy": 103.53,
"power_factor": 0.2,
"ac_frequency": 60,
"update": {
@@ -58,13 +58,13 @@
"latest_release_notes": null
},
"linkquality": 145,
"power": 0.6,
"current": 0.05,
"power": 0.2,
"current": 0.01,
"power_on_behavior": "on"
},
"0xb40e060fffe031e3": {
"battery": 100,
"contact": true,
"contact": false,
"tamper": false,
"battery_low": false,
"linkquality": 149,
@@ -77,9 +77,9 @@
"voltage": 117.3,
"state": "ON",
"ac_frequency": 60,
"energy": 210.08,
"power": 113.8,
"current": 1.04,
"energy": 210.14,
"power": 96.1,
"current": 0.9,
"power_factor": 0.95,
"update": {
"state": "idle",
@@ -95,13 +95,13 @@
"led_brightness": 100,
"countdown_to_turn_off": 0,
"countdown_to_turn_on": 0,
"voltage": 118.6,
"energy": 100.63,
"voltage": 119.1,
"energy": 100.64,
"state": "ON",
"power": 11.1,
"current": 0.2,
"power": 10.4,
"current": 0.18,
"ac_frequency": 60,
"power_factor": 0.51,
"power_factor": 0.49,
"update": {
"state": "idle",
"installed_version": 268513381,
@@ -114,12 +114,12 @@
},
"0xffffb40e060895b3": {
"state": "ON",
"voltage": 118.8,
"voltage": 119.3,
"ac_frequency": 60,
"energy": 14.2,
"current": 0.01,
"power": 0.2,
"power_factor": 0,
"power": 0.1,
"power_factor": 0.11,
"linkquality": 116,
"update": {
"state": "idle",
@@ -224,7 +224,7 @@
},
"0xb40e060fffe717c5": {
"battery": 100,
"occupancy": true,
"occupancy": false,
"tamper": false,
"battery_low": false,
"linkquality": 145,