@riddix/hamh 2.1.0-alpha.583 → 2.1.0-alpha.584
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
|
@@ -172227,8 +172227,27 @@ var EventEndpointType = GenericSwitchDevice.with(
|
|
|
172227
172227
|
HomeAssistantEntityBehavior,
|
|
172228
172228
|
HaGenericSwitchServer
|
|
172229
172229
|
);
|
|
172230
|
+
var multiPressPatterns = [
|
|
172231
|
+
[/triple|3_press|three/, 3],
|
|
172232
|
+
[/double|2_press|two|multi/, 2]
|
|
172233
|
+
];
|
|
172234
|
+
function detectMultiPressMax(eventTypes) {
|
|
172235
|
+
let max = 1;
|
|
172236
|
+
for (const et of eventTypes) {
|
|
172237
|
+
const lower = et.toLowerCase();
|
|
172238
|
+
for (const [pattern2, count] of multiPressPatterns) {
|
|
172239
|
+
if (pattern2.test(lower) && count > max) max = count;
|
|
172240
|
+
}
|
|
172241
|
+
}
|
|
172242
|
+
return max;
|
|
172243
|
+
}
|
|
172230
172244
|
function EventDevice(homeAssistantEntity) {
|
|
172231
|
-
|
|
172245
|
+
const attrs = homeAssistantEntity.entity.state.attributes;
|
|
172246
|
+
const multiPressMax = detectMultiPressMax(attrs.event_types ?? []);
|
|
172247
|
+
return EventEndpointType.set({
|
|
172248
|
+
homeAssistantEntity,
|
|
172249
|
+
switch: { multiPressMax }
|
|
172250
|
+
});
|
|
172232
172251
|
}
|
|
172233
172252
|
|
|
172234
172253
|
// src/matter/endpoints/legacy/fan/index.ts
|