@riddix/hamh 2.1.0-alpha.577 → 2.1.0-alpha.579
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
|
@@ -172123,6 +172123,7 @@ var logger180 = Logger.get("GenericSwitchServer");
|
|
|
172123
172123
|
var FeaturedBase7 = SwitchServer.with(
|
|
172124
172124
|
"MomentarySwitch",
|
|
172125
172125
|
"MomentarySwitchRelease",
|
|
172126
|
+
"MomentarySwitchLongPress",
|
|
172126
172127
|
"MomentarySwitchMultiPress"
|
|
172127
172128
|
);
|
|
172128
172129
|
var GenericSwitchServerBase = class extends FeaturedBase7 {
|
|
@@ -172145,25 +172146,43 @@ var GenericSwitchServerBase = class extends FeaturedBase7 {
|
|
|
172145
172146
|
this.triggerPress(eventType);
|
|
172146
172147
|
}
|
|
172147
172148
|
triggerPress(eventType) {
|
|
172148
|
-
const
|
|
172149
|
+
const lower = eventType.toLowerCase();
|
|
172150
|
+
if (this.isLongPress(lower)) {
|
|
172151
|
+
this.state.currentPosition = 1;
|
|
172152
|
+
this.events.initialPress?.emit({ newPosition: 1 }, this.context);
|
|
172153
|
+
this.events.longPress?.emit({ newPosition: 1 }, this.context);
|
|
172154
|
+
this.fireBridgeEvent(eventType, 1);
|
|
172155
|
+
return;
|
|
172156
|
+
}
|
|
172157
|
+
if (this.isLongRelease(lower)) {
|
|
172158
|
+
this.events.longRelease?.emit({ previousPosition: 1 }, this.context);
|
|
172159
|
+
this.state.currentPosition = 0;
|
|
172160
|
+
this.fireBridgeEvent(eventType, 1);
|
|
172161
|
+
return;
|
|
172162
|
+
}
|
|
172163
|
+
if (lower.includes("cont") && lower.includes("press")) {
|
|
172164
|
+
return;
|
|
172165
|
+
}
|
|
172166
|
+
const pressCount = this.getPressCount(lower);
|
|
172149
172167
|
this.state.currentPosition = 1;
|
|
172150
172168
|
this.events.initialPress?.emit({ newPosition: 1 }, this.context);
|
|
172151
|
-
if (pressCount > 1) {
|
|
172152
|
-
this.events.multiPressComplete?.emit(
|
|
172153
|
-
{
|
|
172154
|
-
previousPosition: 0,
|
|
172155
|
-
totalNumberOfPressesCounted: pressCount
|
|
172156
|
-
},
|
|
172157
|
-
this.context
|
|
172158
|
-
);
|
|
172159
|
-
}
|
|
172160
172169
|
setTimeout(
|
|
172161
172170
|
this.callback(() => {
|
|
172162
172171
|
this.events.shortRelease?.emit({ previousPosition: 1 }, this.context);
|
|
172163
172172
|
this.state.currentPosition = 0;
|
|
172173
|
+
this.events.multiPressComplete?.emit(
|
|
172174
|
+
{
|
|
172175
|
+
previousPosition: 0,
|
|
172176
|
+
totalNumberOfPressesCounted: pressCount
|
|
172177
|
+
},
|
|
172178
|
+
this.context
|
|
172179
|
+
);
|
|
172164
172180
|
}),
|
|
172165
172181
|
100
|
|
172166
172182
|
);
|
|
172183
|
+
this.fireBridgeEvent(eventType, pressCount);
|
|
172184
|
+
}
|
|
172185
|
+
fireBridgeEvent(eventType, pressCount) {
|
|
172167
172186
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
172168
172187
|
homeAssistant.fireEvent("hamh_action", {
|
|
172169
172188
|
action: "press",
|
|
@@ -172172,8 +172191,13 @@ var GenericSwitchServerBase = class extends FeaturedBase7 {
|
|
|
172172
172191
|
source: "matter_bridge"
|
|
172173
172192
|
});
|
|
172174
172193
|
}
|
|
172175
|
-
|
|
172176
|
-
|
|
172194
|
+
isLongPress(lower) {
|
|
172195
|
+
return lower.includes("long") && !lower.includes("release") || lower === "hold";
|
|
172196
|
+
}
|
|
172197
|
+
isLongRelease(lower) {
|
|
172198
|
+
return lower.includes("long") && lower.includes("release");
|
|
172199
|
+
}
|
|
172200
|
+
getPressCount(lower) {
|
|
172177
172201
|
if (lower.includes("triple") || lower.includes("3_press") || lower.includes("three")) {
|
|
172178
172202
|
return 3;
|
|
172179
172203
|
}
|
|
@@ -181012,6 +181036,11 @@ init_service();
|
|
|
181012
181036
|
|
|
181013
181037
|
// src/matter/endpoints/server-mode-vacuum-endpoint.ts
|
|
181014
181038
|
init_esm();
|
|
181039
|
+
|
|
181040
|
+
// ../../node_modules/.pnpm/@matter+main@0.16.10/node_modules/@matter/main/dist/esm/forwards/behaviors/rvc-run-mode.js
|
|
181041
|
+
init_nodejs();
|
|
181042
|
+
|
|
181043
|
+
// src/matter/endpoints/server-mode-vacuum-endpoint.ts
|
|
181015
181044
|
init_home_assistant_entity_behavior();
|
|
181016
181045
|
import debounce6 from "debounce";
|
|
181017
181046
|
|
|
@@ -181313,13 +181342,20 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181313
181342
|
this.keepaliveCounter++;
|
|
181314
181343
|
const counter = this.keepaliveCounter;
|
|
181315
181344
|
logger203.info(`Keepalive #${counter} for ${this.entityId}`);
|
|
181316
|
-
const
|
|
181345
|
+
const opState = this.stateOf(RvcOperationalStateServer);
|
|
181317
181346
|
await this.setStateOf(RvcOperationalStateServer, {
|
|
181347
|
+
operationalState: opState.operationalState,
|
|
181318
181348
|
operationalError: {
|
|
181319
|
-
errorStateId:
|
|
181349
|
+
errorStateId: opState.operationalError.errorStateId,
|
|
181320
181350
|
errorStateDetails: `k${counter}`
|
|
181321
181351
|
}
|
|
181322
181352
|
});
|
|
181353
|
+
if (this.behaviors.has(RvcRunModeServer)) {
|
|
181354
|
+
const runMode = this.stateOf(RvcRunModeServer);
|
|
181355
|
+
await this.setStateOf(RvcRunModeServer, {
|
|
181356
|
+
currentMode: runMode.currentMode
|
|
181357
|
+
});
|
|
181358
|
+
}
|
|
181323
181359
|
logger203.info(`Keepalive #${counter} committed for ${this.entityId}`);
|
|
181324
181360
|
} catch (e) {
|
|
181325
181361
|
if (e instanceof TransactionDestroyedError || e instanceof DestroyedDependencyError) {
|
|
@@ -183984,6 +184020,7 @@ export {
|
|
|
183984
184020
|
@matter/main/dist/esm/forwards/clusters/rvc-clean-mode.js:
|
|
183985
184021
|
@matter/main/dist/esm/forwards/behaviors/rvc-operational-state.js:
|
|
183986
184022
|
@matter/main/dist/esm/forwards/clusters/rvc-operational-state.js:
|
|
184023
|
+
@matter/main/dist/esm/forwards/behaviors/rvc-run-mode.js:
|
|
183987
184024
|
@matter/main/dist/esm/forwards/clusters/level-control.js:
|
|
183988
184025
|
(**
|
|
183989
184026
|
* @license
|