@riddix/hamh 2.1.0-alpha.585 → 2.1.0-alpha.587
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
|
@@ -168725,6 +168725,7 @@ var FanControlServerBase = class extends FeaturedBase5 {
|
|
|
168725
168725
|
// Track last non-zero fan speed for restore on turn-on (#225)
|
|
168726
168726
|
lastNonZeroPercent = 0;
|
|
168727
168727
|
lastNonZeroSpeed = 0;
|
|
168728
|
+
lastIsAutoMode = false;
|
|
168728
168729
|
async initialize() {
|
|
168729
168730
|
if (this.features.multiSpeed) {
|
|
168730
168731
|
if (this.state.speedMax == null || this.state.speedMax < minSpeedMax) {
|
|
@@ -168836,6 +168837,7 @@ var FanControlServerBase = class extends FeaturedBase5 {
|
|
|
168836
168837
|
if (percentage > 0) {
|
|
168837
168838
|
this.lastNonZeroPercent = percentage;
|
|
168838
168839
|
this.lastNonZeroSpeed = speed;
|
|
168840
|
+
this.lastIsAutoMode = config10.isInAutoMode(entity.state, this.agent);
|
|
168839
168841
|
}
|
|
168840
168842
|
try {
|
|
168841
168843
|
applyPatchState(this.state, {
|
|
@@ -168902,6 +168904,9 @@ var FanControlServerBase = class extends FeaturedBase5 {
|
|
|
168902
168904
|
if (speed == null) {
|
|
168903
168905
|
return;
|
|
168904
168906
|
}
|
|
168907
|
+
if (speed === 0 && (this.state.percentSetting ?? 0) > 0) {
|
|
168908
|
+
return;
|
|
168909
|
+
}
|
|
168905
168910
|
this.agent.asLocalActor(() => {
|
|
168906
168911
|
const percentage = Math.floor(speed / this.state.speedMax * 100);
|
|
168907
168912
|
this.applyPercentageAction(percentage);
|
|
@@ -169050,6 +169055,18 @@ var FanControlServerBase = class extends FeaturedBase5 {
|
|
|
169050
169055
|
} catch {
|
|
169051
169056
|
}
|
|
169052
169057
|
});
|
|
169058
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
169059
|
+
if (homeAssistant.isAvailable) {
|
|
169060
|
+
if (this.lastIsAutoMode) {
|
|
169061
|
+
homeAssistant.callAction(
|
|
169062
|
+
this.state.config.setAutoMode(void 0, this.agent)
|
|
169063
|
+
);
|
|
169064
|
+
} else {
|
|
169065
|
+
homeAssistant.callAction(
|
|
169066
|
+
this.state.config.turnOn(this.lastNonZeroPercent, this.agent)
|
|
169067
|
+
);
|
|
169068
|
+
}
|
|
169069
|
+
}
|
|
169053
169070
|
}
|
|
169054
169071
|
}
|
|
169055
169072
|
// Cross-cluster sync: keep OnOff in sync with FanControl per Matter spec
|
|
@@ -174241,6 +174258,9 @@ var AirQualitySensorServerImpl = class extends AirQualityServerWithFeatures {
|
|
|
174241
174258
|
this.reactTo(homeAssistant.onChange, this.update);
|
|
174242
174259
|
}
|
|
174243
174260
|
update(entity) {
|
|
174261
|
+
if (!entity.state || !entity.state.attributes) {
|
|
174262
|
+
return;
|
|
174263
|
+
}
|
|
174244
174264
|
const state = entity.state.state;
|
|
174245
174265
|
const attributes7 = entity.state.attributes;
|
|
174246
174266
|
const deviceClass = attributes7.device_class;
|
|
@@ -174420,6 +174440,9 @@ var StandalonePowerServer = class extends ElectricalPowerMeasurementServer {
|
|
|
174420
174440
|
this.reactTo(homeAssistant.onChange, this.update);
|
|
174421
174441
|
}
|
|
174422
174442
|
update(entity) {
|
|
174443
|
+
if (!entity.state || !entity.state.attributes) {
|
|
174444
|
+
return;
|
|
174445
|
+
}
|
|
174423
174446
|
const state = entity.state.state;
|
|
174424
174447
|
if (state == null || Number.isNaN(+state)) return;
|
|
174425
174448
|
const attrs = entity.state.attributes;
|
|
@@ -174475,6 +174498,9 @@ var StandaloneEnergyServer = class extends EnergyFeaturedBase {
|
|
|
174475
174498
|
this.reactTo(homeAssistant.onChange, this.update);
|
|
174476
174499
|
}
|
|
174477
174500
|
update(entity) {
|
|
174501
|
+
if (!entity.state || !entity.state.attributes) {
|
|
174502
|
+
return;
|
|
174503
|
+
}
|
|
174478
174504
|
const attrs = entity.state.attributes;
|
|
174479
174505
|
if (attrs.device_class !== SensorDeviceClass.energy) return;
|
|
174480
174506
|
const state = entity.state.state;
|
|
@@ -175291,6 +175317,9 @@ var TvocAirQualityServer = class extends TvocAirQualityServerBase {
|
|
|
175291
175317
|
this.reactTo(homeAssistant.onChange, this.update);
|
|
175292
175318
|
}
|
|
175293
175319
|
update(entity) {
|
|
175320
|
+
if (!entity.state || !entity.state.attributes) {
|
|
175321
|
+
return;
|
|
175322
|
+
}
|
|
175294
175323
|
const state = entity.state.state;
|
|
175295
175324
|
const attributes7 = entity.state.attributes;
|
|
175296
175325
|
const deviceClass = attributes7.device_class;
|