@riddix/hamh 2.1.0-alpha.789 → 2.1.0-alpha.791
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
|
@@ -151151,6 +151151,7 @@ var FanControlServerBase = class extends FeaturedBase5 {
|
|
|
151151
151151
|
homeAssistant.callAction(
|
|
151152
151152
|
this.state.config.turnOn(clampedPercentage, this.agent)
|
|
151153
151153
|
);
|
|
151154
|
+
this.rememberSpeed(clampedPercentage);
|
|
151154
151155
|
}
|
|
151155
151156
|
}
|
|
151156
151157
|
targetSpeedSettingChanged(speed, _oldValue, context) {
|
|
@@ -151244,6 +151245,7 @@ var FanControlServerBase = class extends FeaturedBase5 {
|
|
|
151244
151245
|
Math.min(100, roundedPercentage)
|
|
151245
151246
|
);
|
|
151246
151247
|
homeAssistant.callAction(config11.turnOn(clampedPercentage, this.agent));
|
|
151248
|
+
this.rememberSpeed(clampedPercentage);
|
|
151247
151249
|
} else {
|
|
151248
151250
|
const presetModes = config11.getPresetModes(homeAssistant.entity.state, this.agent) ?? [];
|
|
151249
151251
|
const speedPresets = toAscendingSpeedPresets(
|
|
@@ -151258,9 +151260,26 @@ var FanControlServerBase = class extends FeaturedBase5 {
|
|
|
151258
151260
|
homeAssistant.callAction(
|
|
151259
151261
|
config11.setPresetMode(targetPreset, this.agent)
|
|
151260
151262
|
);
|
|
151263
|
+
this.rememberSpeed(percentage);
|
|
151261
151264
|
}
|
|
151262
151265
|
}
|
|
151263
151266
|
}
|
|
151267
|
+
// Controller writes count as the last speed too. Some integrations
|
|
151268
|
+
// (ha_xiaomi_home) accept fan.set_percentage but never report a percentage
|
|
151269
|
+
// attribute, so capturing only HA updates misses them (#387).
|
|
151270
|
+
rememberSpeed(percentage) {
|
|
151271
|
+
if (percentage <= 0) {
|
|
151272
|
+
return;
|
|
151273
|
+
}
|
|
151274
|
+
this.lastNonZeroPercent = percentage;
|
|
151275
|
+
const speedMax = this.state.speedMax ?? 0;
|
|
151276
|
+
if (this.features.multiSpeed && speedMax > 0) {
|
|
151277
|
+
this.lastNonZeroSpeed = Math.max(
|
|
151278
|
+
1,
|
|
151279
|
+
Math.ceil(speedMax * (percentage / 100))
|
|
151280
|
+
);
|
|
151281
|
+
}
|
|
151282
|
+
}
|
|
151264
151283
|
targetAirflowDirectionChanged(airflowDirection, _oldValue, context) {
|
|
151265
151284
|
if (transactionIsOffline(context)) {
|
|
151266
151285
|
return;
|