@riddix/hamh 2.1.0-alpha.384 → 2.1.0-alpha.386
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/backend/cli.js
CHANGED
|
@@ -166589,6 +166589,32 @@ var AlarmPanelEndpointType = ModeSelectDevice.with(
|
|
|
166589
166589
|
HomeAssistantEntityBehavior,
|
|
166590
166590
|
AlarmModeServer
|
|
166591
166591
|
);
|
|
166592
|
+
var AlarmOnOffServer = OnOffServer2({
|
|
166593
|
+
isOn: (entityState, agent) => {
|
|
166594
|
+
return agent.get(HomeAssistantEntityBehavior).isAvailable && entityState.state !== "disarmed";
|
|
166595
|
+
},
|
|
166596
|
+
turnOn: (_, agent) => {
|
|
166597
|
+
const ha = agent.get(HomeAssistantEntityBehavior);
|
|
166598
|
+
const features2 = ha.entity.state.attributes.supported_features ?? 0;
|
|
166599
|
+
if (features2 & FEATURE_ARM_AWAY)
|
|
166600
|
+
return { action: "alarm_control_panel.alarm_arm_away" };
|
|
166601
|
+
if (features2 & FEATURE_ARM_HOME)
|
|
166602
|
+
return { action: "alarm_control_panel.alarm_arm_home" };
|
|
166603
|
+
if (features2 & FEATURE_ARM_NIGHT)
|
|
166604
|
+
return { action: "alarm_control_panel.alarm_arm_night" };
|
|
166605
|
+
return { action: "alarm_control_panel.alarm_arm_away" };
|
|
166606
|
+
},
|
|
166607
|
+
turnOff: () => ({ action: "alarm_control_panel.alarm_disarm" })
|
|
166608
|
+
});
|
|
166609
|
+
var AlarmOnOffEndpointType = OnOffPlugInUnitDevice.with(
|
|
166610
|
+
BasicInformationServer2,
|
|
166611
|
+
IdentifyServer2,
|
|
166612
|
+
HomeAssistantEntityBehavior,
|
|
166613
|
+
AlarmOnOffServer
|
|
166614
|
+
);
|
|
166615
|
+
function AlarmOnOffDevice(homeAssistantEntity) {
|
|
166616
|
+
return AlarmOnOffEndpointType.set({ homeAssistantEntity });
|
|
166617
|
+
}
|
|
166592
166618
|
function AlarmControlPanelDevice(homeAssistantEntity) {
|
|
166593
166619
|
const attrs = homeAssistantEntity.entity.state.attributes;
|
|
166594
166620
|
const modes = getAlarmModes(attrs);
|
|
@@ -167726,10 +167752,6 @@ var config4 = {
|
|
|
167726
167752
|
if (systemMode === Thermostat3.SystemMode.Auto) {
|
|
167727
167753
|
const modes = attributes4(entity).hvac_modes ?? [];
|
|
167728
167754
|
if (isHeatCoolOnly(modes)) {
|
|
167729
|
-
const action2 = attributes4(entity).hvac_action;
|
|
167730
|
-
if (action2 === ClimateHvacAction.cooling) {
|
|
167731
|
-
return Thermostat3.SystemMode.Cool;
|
|
167732
|
-
}
|
|
167733
167755
|
return Thermostat3.SystemMode.Heat;
|
|
167734
167756
|
}
|
|
167735
167757
|
const hasHeatCool = modes.includes(ClimateHvacMode.heat_cool);
|
|
@@ -167759,15 +167781,15 @@ var config4 = {
|
|
|
167759
167781
|
if (!action) {
|
|
167760
167782
|
return Thermostat3.ThermostatRunningMode.Off;
|
|
167761
167783
|
}
|
|
167762
|
-
|
|
167784
|
+
const runningMode = hvacActionToRunningMode[action] ?? Thermostat3.ThermostatRunningMode.Off;
|
|
167785
|
+
if (runningMode === Thermostat3.ThermostatRunningMode.Cool && isHeatCoolOnly(attributes4(entity).hvac_modes ?? [])) {
|
|
167786
|
+
return Thermostat3.ThermostatRunningMode.Heat;
|
|
167787
|
+
}
|
|
167788
|
+
return runningMode;
|
|
167763
167789
|
},
|
|
167764
167790
|
getControlSequence: (entity) => {
|
|
167765
167791
|
const modes = attributes4(entity).hvac_modes ?? [];
|
|
167766
167792
|
if (isHeatCoolOnly(modes)) {
|
|
167767
|
-
const action = attributes4(entity).hvac_action;
|
|
167768
|
-
if (action === ClimateHvacAction.cooling) {
|
|
167769
|
-
return Thermostat3.ControlSequenceOfOperation.CoolingOnly;
|
|
167770
|
-
}
|
|
167771
167793
|
return Thermostat3.ControlSequenceOfOperation.HeatingOnly;
|
|
167772
167794
|
}
|
|
167773
167795
|
const hasCooling = modes.some(
|
|
@@ -167895,9 +167917,8 @@ function ClimateDevice(homeAssistantEntity) {
|
|
|
167895
167917
|
const hasBatteryAttr = attributes7.battery_level != null || attributes7.battery != null;
|
|
167896
167918
|
const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
|
|
167897
167919
|
const hasBattery = hasBatteryAttr || hasBatteryEntity;
|
|
167898
|
-
const
|
|
167899
|
-
|
|
167900
|
-
);
|
|
167920
|
+
const heatCoolOnly = attributes7.hvac_modes.includes(ClimateHvacMode.heat_cool) && !attributes7.hvac_modes.includes(ClimateHvacMode.heat) && !attributes7.hvac_modes.includes(ClimateHvacMode.cool);
|
|
167921
|
+
const supportsCooling = heatCoolOnly ? false : coolingModes.some((mode) => attributes7.hvac_modes.includes(mode));
|
|
167901
167922
|
const hasExplicitHeating = heatingModes.some(
|
|
167902
167923
|
(mode) => attributes7.hvac_modes.includes(mode)
|
|
167903
167924
|
);
|
|
@@ -173769,7 +173790,13 @@ var matterDeviceTypeFactories = {
|
|
|
173769
173790
|
extended_color_light: (ha) => ExtendedColorLightType(true, true).set({
|
|
173770
173791
|
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
173771
173792
|
}),
|
|
173772
|
-
on_off_plugin_unit:
|
|
173793
|
+
on_off_plugin_unit: (ha) => {
|
|
173794
|
+
const domain = ha.entity.entity_id.split(".")[0];
|
|
173795
|
+
if (domain === "alarm_control_panel") {
|
|
173796
|
+
return AlarmOnOffDevice(ha);
|
|
173797
|
+
}
|
|
173798
|
+
return SwitchDevice(ha);
|
|
173799
|
+
},
|
|
173773
173800
|
on_off_switch: SwitchDevice,
|
|
173774
173801
|
door_lock: LockDevice,
|
|
173775
173802
|
window_covering: CoverDevice,
|