@riddix/hamh 2.1.0-alpha.580 → 2.1.0-alpha.581
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
|
@@ -172132,7 +172132,12 @@ var GenericSwitchServerBase = class extends FeaturedBase7 {
|
|
|
172132
172132
|
await super.initialize();
|
|
172133
172133
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
172134
172134
|
const entityId = homeAssistant.entityId;
|
|
172135
|
-
|
|
172135
|
+
const attrs = homeAssistant.entity.state.attributes;
|
|
172136
|
+
const maxPress = this.detectMultiPressMax(attrs.event_types ?? []);
|
|
172137
|
+
this.state.multiPressMax = maxPress;
|
|
172138
|
+
logger180.debug(
|
|
172139
|
+
`[${entityId}] GenericSwitch initialized (multiPressMax: ${maxPress})`
|
|
172140
|
+
);
|
|
172136
172141
|
this.reactTo(homeAssistant.onChange, this.handleEventChange);
|
|
172137
172142
|
}
|
|
172138
172143
|
handleEventChange() {
|
|
@@ -172200,6 +172205,14 @@ var GenericSwitchServerBase = class extends FeaturedBase7 {
|
|
|
172200
172205
|
isLongRelease(lower) {
|
|
172201
172206
|
return lower.includes("long") && lower.includes("release");
|
|
172202
172207
|
}
|
|
172208
|
+
detectMultiPressMax(eventTypes) {
|
|
172209
|
+
let max = 1;
|
|
172210
|
+
for (const et of eventTypes) {
|
|
172211
|
+
const count = this.getPressCount(et.toLowerCase());
|
|
172212
|
+
if (count > max) max = count;
|
|
172213
|
+
}
|
|
172214
|
+
return max;
|
|
172215
|
+
}
|
|
172203
172216
|
getPressCount(lower) {
|
|
172204
172217
|
if (lower.includes("triple") || lower.includes("3_press") || lower.includes("three")) {
|
|
172205
172218
|
return 3;
|