@riddix/hamh 2.1.0-alpha.809 → 2.1.0-alpha.811
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
|
@@ -150842,6 +150842,11 @@ init_home_assistant_entity_behavior();
|
|
|
150842
150842
|
|
|
150843
150843
|
// src/matter/behaviors/level-control-server.ts
|
|
150844
150844
|
init_esm();
|
|
150845
|
+
|
|
150846
|
+
// ../../node_modules/.pnpm/@matter+main@0.17.3/node_modules/@matter/main/dist/esm/forwards/clusters/level-control.js
|
|
150847
|
+
init_nodejs();
|
|
150848
|
+
|
|
150849
|
+
// src/matter/behaviors/level-control-server.ts
|
|
150845
150850
|
init_home_assistant_entity_behavior();
|
|
150846
150851
|
var lastTurnOnTimestamps = /* @__PURE__ */ new Map();
|
|
150847
150852
|
var LAST_TURN_ON_TTL_MS = 6e4;
|
|
@@ -150950,6 +150955,37 @@ var LevelControlServerBase = class extends FeaturedBase4 {
|
|
|
150950
150955
|
}
|
|
150951
150956
|
return super.stepWithOnOff(request);
|
|
150952
150957
|
}
|
|
150958
|
+
stepLogic(stepMode, stepSize) {
|
|
150959
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
150960
|
+
const config11 = this.state.config;
|
|
150961
|
+
const entityId = homeAssistant.entity.entity_id;
|
|
150962
|
+
const currentPercent = config11.getValuePercent(
|
|
150963
|
+
homeAssistant.entity.state,
|
|
150964
|
+
this.agent
|
|
150965
|
+
);
|
|
150966
|
+
if (currentPercent == null) {
|
|
150967
|
+
return;
|
|
150968
|
+
}
|
|
150969
|
+
const currentLevel = Math.round(currentPercent * this.maxLevel);
|
|
150970
|
+
const direction = stepMode === LevelControl3.StepMode.Up ? 1 : -1;
|
|
150971
|
+
const targetLevel = Math.max(
|
|
150972
|
+
this.minLevel,
|
|
150973
|
+
Math.min(this.maxLevel, currentLevel + stepSize * direction)
|
|
150974
|
+
);
|
|
150975
|
+
if (currentLevel === targetLevel) {
|
|
150976
|
+
return;
|
|
150977
|
+
}
|
|
150978
|
+
const targetPercent = targetLevel / this.maxLevel;
|
|
150979
|
+
const action = config11.moveToLevelPercent(targetPercent, this.agent);
|
|
150980
|
+
this.state.currentLevel = targetLevel;
|
|
150981
|
+
const now = Date.now();
|
|
150982
|
+
sweepOptimisticLevel(now);
|
|
150983
|
+
optimisticLevelState.set(entityId, {
|
|
150984
|
+
expectedLevel: targetLevel,
|
|
150985
|
+
timestamp: now
|
|
150986
|
+
});
|
|
150987
|
+
homeAssistant.callAction(action);
|
|
150988
|
+
}
|
|
150953
150989
|
moveToLevelLogic(level) {
|
|
150954
150990
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
150955
150991
|
const config11 = this.state.config;
|
|
@@ -156736,6 +156772,56 @@ var ColorControlServerBase = class extends FeaturedBase7 {
|
|
|
156736
156772
|
this.pendingTransitionTime = request.transitionTime;
|
|
156737
156773
|
return super.moveToColorTemperature(request);
|
|
156738
156774
|
}
|
|
156775
|
+
stepColorTemperatureLogic(stepMode, stepSize) {
|
|
156776
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
156777
|
+
const current = homeAssistant.entity.state;
|
|
156778
|
+
const currentKelvin = this.state.config.getCurrentKelvin(
|
|
156779
|
+
current,
|
|
156780
|
+
this.agent
|
|
156781
|
+
);
|
|
156782
|
+
const minimumKelvin = this.state.config.getMinColorTempKelvin(
|
|
156783
|
+
current,
|
|
156784
|
+
this.agent
|
|
156785
|
+
);
|
|
156786
|
+
const maximumKelvin = this.state.config.getMaxColorTempKelvin(
|
|
156787
|
+
current,
|
|
156788
|
+
this.agent
|
|
156789
|
+
);
|
|
156790
|
+
if (currentKelvin == null || minimumKelvin == null || maximumKelvin == null) {
|
|
156791
|
+
return;
|
|
156792
|
+
}
|
|
156793
|
+
const currentMireds = ColorConverter.temperatureKelvinToMireds(currentKelvin);
|
|
156794
|
+
const direction = stepMode === ColorControl3.StepMode.Up ? 1 : -1;
|
|
156795
|
+
const steppedMireds = currentMireds + stepSize * direction;
|
|
156796
|
+
const steppedKelvin = ColorConverter.temperatureMiredsToKelvin(steppedMireds);
|
|
156797
|
+
if (steppedKelvin == null) {
|
|
156798
|
+
return;
|
|
156799
|
+
}
|
|
156800
|
+
const targetKelvin = Math.max(
|
|
156801
|
+
minimumKelvin,
|
|
156802
|
+
Math.min(maximumKelvin, steppedKelvin)
|
|
156803
|
+
);
|
|
156804
|
+
if (currentKelvin === targetKelvin) {
|
|
156805
|
+
return;
|
|
156806
|
+
}
|
|
156807
|
+
const targetMireds = ColorConverter.temperatureKelvinToMireds(targetKelvin);
|
|
156808
|
+
const action = this.state.config.setTemperature(targetKelvin, this.agent);
|
|
156809
|
+
this.applyTransition(action);
|
|
156810
|
+
applyPatchState(this.state, {
|
|
156811
|
+
colorTemperatureMireds: targetMireds,
|
|
156812
|
+
colorMode: ColorControl3.ColorMode.ColorTemperatureMireds,
|
|
156813
|
+
enhancedColorMode: ColorControl3.EnhancedColorMode.ColorTemperatureMireds
|
|
156814
|
+
});
|
|
156815
|
+
optimisticColorState.set(homeAssistant.entityId, {
|
|
156816
|
+
colorTemperatureMireds: targetMireds,
|
|
156817
|
+
timestamp: Date.now()
|
|
156818
|
+
});
|
|
156819
|
+
if (this.isLightOff()) {
|
|
156820
|
+
pendingColorStaging.set(homeAssistant.entityId, action.data ?? {});
|
|
156821
|
+
return;
|
|
156822
|
+
}
|
|
156823
|
+
homeAssistant.callAction(action);
|
|
156824
|
+
}
|
|
156739
156825
|
moveToColorTemperatureLogic(targetMireds) {
|
|
156740
156826
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
156741
156827
|
const current = homeAssistant.entity.state;
|
|
@@ -167056,11 +167142,6 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
167056
167142
|
|
|
167057
167143
|
// src/matter/patches/patch-level-control-tlv.ts
|
|
167058
167144
|
init_esm();
|
|
167059
|
-
|
|
167060
|
-
// ../../node_modules/.pnpm/@matter+main@0.17.3/node_modules/@matter/main/dist/esm/forwards/clusters/level-control.js
|
|
167061
|
-
init_nodejs();
|
|
167062
|
-
|
|
167063
|
-
// src/matter/patches/patch-level-control-tlv.ts
|
|
167064
167145
|
var logger234 = Logger.get("PatchLevelControlTlv");
|
|
167065
167146
|
var optionalFieldModels = /* @__PURE__ */ new WeakSet();
|
|
167066
167147
|
var fieldModelMandatoryGetterPatched = false;
|
|
@@ -169478,6 +169559,7 @@ export {
|
|
|
169478
169559
|
@matter/types/dist/esm/clusters/index.js:
|
|
169479
169560
|
@matter/main/dist/esm/clusters.js:
|
|
169480
169561
|
@matter/main/dist/esm/model.js:
|
|
169562
|
+
@matter/main/dist/esm/forwards/clusters/level-control.js:
|
|
169481
169563
|
@matter/main/dist/esm/forwards/behaviors/boolean-state.js:
|
|
169482
169564
|
@matter/main/dist/esm/forwards/behaviors/smoke-co-alarm.js:
|
|
169483
169565
|
@matter/main/dist/esm/forwards/behaviors/operational-state.js:
|
|
@@ -169489,7 +169571,6 @@ export {
|
|
|
169489
169571
|
@matter/main/dist/esm/forwards/behaviors/color-control.js:
|
|
169490
169572
|
@matter/main/dist/esm/forwards/behaviors/pump-configuration-and-control.js:
|
|
169491
169573
|
@matter/main/dist/esm/forwards/clusters/rvc-clean-mode.js:
|
|
169492
|
-
@matter/main/dist/esm/forwards/clusters/level-control.js:
|
|
169493
169574
|
(**
|
|
169494
169575
|
* @license
|
|
169495
169576
|
* Copyright 2022-2026 Matter.js Authors
|