@riddix/hamh 2.1.0-alpha.554 → 2.1.0-alpha.555
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
|
@@ -146521,6 +146521,7 @@ var init_home_assistant_domain = __esm({
|
|
|
146521
146521
|
HomeAssistantDomain2["select"] = "select";
|
|
146522
146522
|
HomeAssistantDomain2["script"] = "script";
|
|
146523
146523
|
HomeAssistantDomain2["sensor"] = "sensor";
|
|
146524
|
+
HomeAssistantDomain2["siren"] = "siren";
|
|
146524
146525
|
HomeAssistantDomain2["switch"] = "switch";
|
|
146525
146526
|
HomeAssistantDomain2["vacuum"] = "vacuum";
|
|
146526
146527
|
HomeAssistantDomain2["valve"] = "valve";
|
|
@@ -152309,39 +152310,44 @@ var HomeAssistantClient = class extends Service {
|
|
|
152309
152310
|
this.connection?.close();
|
|
152310
152311
|
}
|
|
152311
152312
|
async createConnection(props) {
|
|
152312
|
-
|
|
152313
|
-
|
|
152314
|
-
|
|
152315
|
-
|
|
152316
|
-
|
|
152317
|
-
|
|
152318
|
-
|
|
152319
|
-
|
|
152320
|
-
|
|
152321
|
-
|
|
152322
|
-
|
|
152323
|
-
|
|
152324
|
-
|
|
152325
|
-
|
|
152326
|
-
|
|
152327
|
-
|
|
152328
|
-
|
|
152329
|
-
|
|
152330
|
-
|
|
152331
|
-
|
|
152332
|
-
|
|
152333
|
-
|
|
152334
|
-
|
|
152335
|
-
|
|
152336
|
-
|
|
152337
|
-
|
|
152338
|
-
|
|
152339
|
-
|
|
152340
|
-
|
|
152341
|
-
|
|
152342
|
-
|
|
152313
|
+
const maxConnectAttempts = 60;
|
|
152314
|
+
for (let attempt = 1; attempt <= maxConnectAttempts; attempt++) {
|
|
152315
|
+
try {
|
|
152316
|
+
const connection = await createConnection({
|
|
152317
|
+
auth: createLongLivedTokenAuth(
|
|
152318
|
+
props.url.replace(/\/$/, ""),
|
|
152319
|
+
props.accessToken
|
|
152320
|
+
)
|
|
152321
|
+
});
|
|
152322
|
+
await this.waitForHomeAssistantToBeUpAndRunning(connection);
|
|
152323
|
+
return connection;
|
|
152324
|
+
} catch (reason) {
|
|
152325
|
+
if (reason === ERR_CANNOT_CONNECT) {
|
|
152326
|
+
this.log.warnCtx("Unable to connect to Home Assistant, retrying...", {
|
|
152327
|
+
url: props.url,
|
|
152328
|
+
attempt,
|
|
152329
|
+
maxAttempts: maxConnectAttempts,
|
|
152330
|
+
retryDelayMs: 5e3
|
|
152331
|
+
});
|
|
152332
|
+
await new Promise((resolve6) => setTimeout(resolve6, 5e3));
|
|
152333
|
+
continue;
|
|
152334
|
+
}
|
|
152335
|
+
if (reason === ERR_INVALID_AUTH) {
|
|
152336
|
+
this.log.errorCtx(
|
|
152337
|
+
"Authentication failed",
|
|
152338
|
+
new Error("Invalid authentication credentials"),
|
|
152339
|
+
{ url: props.url }
|
|
152340
|
+
);
|
|
152341
|
+
throw new Error(
|
|
152342
|
+
"Authentication failed while connecting to home assistant"
|
|
152343
|
+
);
|
|
152344
|
+
}
|
|
152345
|
+
throw new Error(`Unable to connect to home assistant: ${reason}`);
|
|
152346
|
+
}
|
|
152343
152347
|
}
|
|
152344
|
-
throw new Error(
|
|
152348
|
+
throw new Error(
|
|
152349
|
+
`Failed to connect to Home Assistant at ${props.url} after ${maxConnectAttempts} attempts (5 minutes)`
|
|
152350
|
+
);
|
|
152345
152351
|
}
|
|
152346
152352
|
async waitForHomeAssistantToBeUpAndRunning(connection) {
|
|
152347
152353
|
this.log.infoCtx("Waiting for Home Assistant to be up and running", {
|
|
@@ -152364,8 +152370,15 @@ var HomeAssistantClient = class extends Service {
|
|
|
152364
152370
|
this.log.debugCtx("Home Assistant state update", { state: state2 });
|
|
152365
152371
|
return state2;
|
|
152366
152372
|
};
|
|
152373
|
+
const maxWaitAttempts = 120;
|
|
152367
152374
|
let state;
|
|
152375
|
+
let waitAttempt = 0;
|
|
152368
152376
|
while (state !== "RUNNING") {
|
|
152377
|
+
if (++waitAttempt > maxWaitAttempts) {
|
|
152378
|
+
throw new Error(
|
|
152379
|
+
`Home Assistant did not reach RUNNING state within 10 minutes (last state: ${state ?? "unknown"})`
|
|
152380
|
+
);
|
|
152381
|
+
}
|
|
152369
152382
|
await new Promise((resolve6) => setTimeout(resolve6, 5e3));
|
|
152370
152383
|
state = await getState();
|
|
152371
152384
|
}
|
|
@@ -159875,6 +159888,7 @@ var DishwasherDeviceDefinition = MutableEndpoint({
|
|
|
159875
159888
|
behaviors: SupportedBehaviors(DishwasherRequirements.server.mandatory.OperationalState)
|
|
159876
159889
|
});
|
|
159877
159890
|
Object.freeze(DishwasherDeviceDefinition);
|
|
159891
|
+
var DishwasherDevice = DishwasherDeviceDefinition;
|
|
159878
159892
|
|
|
159879
159893
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/devices/door-lock-controller.js
|
|
159880
159894
|
init_TimeSynchronizationServer();
|
|
@@ -171376,6 +171390,19 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
171376
171390
|
static DEBOUNCE_INITIAL_MS = 400;
|
|
171377
171391
|
static DEBOUNCE_SUBSEQUENT_MS = 150;
|
|
171378
171392
|
static COMMAND_SEQUENCE_THRESHOLD_MS = 600;
|
|
171393
|
+
async [Symbol.asyncDispose]() {
|
|
171394
|
+
if (this.liftDebounceTimer) {
|
|
171395
|
+
clearTimeout(this.liftDebounceTimer);
|
|
171396
|
+
this.liftDebounceTimer = null;
|
|
171397
|
+
}
|
|
171398
|
+
if (this.tiltDebounceTimer) {
|
|
171399
|
+
clearTimeout(this.tiltDebounceTimer);
|
|
171400
|
+
this.tiltDebounceTimer = null;
|
|
171401
|
+
}
|
|
171402
|
+
this.pendingLiftAction = null;
|
|
171403
|
+
this.pendingTiltAction = null;
|
|
171404
|
+
await super[Symbol.asyncDispose]();
|
|
171405
|
+
}
|
|
171379
171406
|
async initialize() {
|
|
171380
171407
|
if (this.features.lift) {
|
|
171381
171408
|
if (this.state.installedOpenLimitLift == null) {
|
|
@@ -171888,6 +171915,106 @@ function CoverDevice(homeAssistantEntity) {
|
|
|
171888
171915
|
});
|
|
171889
171916
|
}
|
|
171890
171917
|
|
|
171918
|
+
// ../../node_modules/.pnpm/@matter+main@0.16.10/node_modules/@matter/main/dist/esm/forwards/behaviors/operational-state.js
|
|
171919
|
+
init_nodejs();
|
|
171920
|
+
|
|
171921
|
+
// ../../node_modules/.pnpm/@matter+main@0.16.10/node_modules/@matter/main/dist/esm/forwards/clusters/operational-state.js
|
|
171922
|
+
init_nodejs();
|
|
171923
|
+
init_operational_state();
|
|
171924
|
+
|
|
171925
|
+
// src/matter/endpoints/legacy/dishwasher/index.ts
|
|
171926
|
+
init_home_assistant_entity_behavior();
|
|
171927
|
+
var haStateToDishwasherState = {
|
|
171928
|
+
off: OperationalState3.OperationalStateEnum.Stopped,
|
|
171929
|
+
idle: OperationalState3.OperationalStateEnum.Stopped,
|
|
171930
|
+
standby: OperationalState3.OperationalStateEnum.Stopped,
|
|
171931
|
+
on: OperationalState3.OperationalStateEnum.Running,
|
|
171932
|
+
running: OperationalState3.OperationalStateEnum.Running,
|
|
171933
|
+
active: OperationalState3.OperationalStateEnum.Running,
|
|
171934
|
+
drying: OperationalState3.OperationalStateEnum.Running,
|
|
171935
|
+
washing: OperationalState3.OperationalStateEnum.Running,
|
|
171936
|
+
paused: OperationalState3.OperationalStateEnum.Paused,
|
|
171937
|
+
complete: OperationalState3.OperationalStateEnum.Stopped,
|
|
171938
|
+
finished: OperationalState3.OperationalStateEnum.Stopped
|
|
171939
|
+
};
|
|
171940
|
+
var DishwasherOperationalStateServer = class extends OperationalStateServer {
|
|
171941
|
+
async initialize() {
|
|
171942
|
+
this.state.operationalStateList = [
|
|
171943
|
+
{ operationalStateId: OperationalState3.OperationalStateEnum.Stopped },
|
|
171944
|
+
{ operationalStateId: OperationalState3.OperationalStateEnum.Running },
|
|
171945
|
+
{ operationalStateId: OperationalState3.OperationalStateEnum.Paused },
|
|
171946
|
+
{ operationalStateId: OperationalState3.OperationalStateEnum.Error }
|
|
171947
|
+
];
|
|
171948
|
+
this.state.operationalState = OperationalState3.OperationalStateEnum.Stopped;
|
|
171949
|
+
this.state.operationalError = {
|
|
171950
|
+
errorStateId: OperationalState3.ErrorState.NoError
|
|
171951
|
+
};
|
|
171952
|
+
await super.initialize();
|
|
171953
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171954
|
+
this.update(homeAssistant.entity);
|
|
171955
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171956
|
+
}
|
|
171957
|
+
update(entity) {
|
|
171958
|
+
if (!entity.state) {
|
|
171959
|
+
return;
|
|
171960
|
+
}
|
|
171961
|
+
const haState = entity.state.state?.toLowerCase() ?? "off";
|
|
171962
|
+
const newState = haStateToDishwasherState[haState] ?? OperationalState3.OperationalStateEnum.Stopped;
|
|
171963
|
+
applyPatchState(this.state, {
|
|
171964
|
+
operationalState: newState,
|
|
171965
|
+
operationalError: {
|
|
171966
|
+
errorStateId: OperationalState3.ErrorState.NoError
|
|
171967
|
+
}
|
|
171968
|
+
});
|
|
171969
|
+
}
|
|
171970
|
+
pause() {
|
|
171971
|
+
return {
|
|
171972
|
+
commandResponseState: {
|
|
171973
|
+
errorStateId: OperationalState3.ErrorState.CommandInvalidInState
|
|
171974
|
+
}
|
|
171975
|
+
};
|
|
171976
|
+
}
|
|
171977
|
+
stop() {
|
|
171978
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
171979
|
+
homeAssistant.callAction({ action: "homeassistant.turn_off" });
|
|
171980
|
+
return {
|
|
171981
|
+
commandResponseState: {
|
|
171982
|
+
errorStateId: OperationalState3.ErrorState.NoError
|
|
171983
|
+
}
|
|
171984
|
+
};
|
|
171985
|
+
}
|
|
171986
|
+
start() {
|
|
171987
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
171988
|
+
homeAssistant.callAction({ action: "homeassistant.turn_on" });
|
|
171989
|
+
return {
|
|
171990
|
+
commandResponseState: {
|
|
171991
|
+
errorStateId: OperationalState3.ErrorState.NoError
|
|
171992
|
+
}
|
|
171993
|
+
};
|
|
171994
|
+
}
|
|
171995
|
+
resume() {
|
|
171996
|
+
return this.start();
|
|
171997
|
+
}
|
|
171998
|
+
};
|
|
171999
|
+
var DishwasherOnOffServer = OnOffServer2({
|
|
172000
|
+
turnOn: () => ({
|
|
172001
|
+
action: "homeassistant.turn_on"
|
|
172002
|
+
}),
|
|
172003
|
+
turnOff: () => ({
|
|
172004
|
+
action: "homeassistant.turn_off"
|
|
172005
|
+
})
|
|
172006
|
+
});
|
|
172007
|
+
var DishwasherDeviceType = DishwasherDevice.with(
|
|
172008
|
+
BasicInformationServer2,
|
|
172009
|
+
IdentifyServer2,
|
|
172010
|
+
HomeAssistantEntityBehavior,
|
|
172011
|
+
DishwasherOperationalStateServer,
|
|
172012
|
+
DishwasherOnOffServer
|
|
172013
|
+
);
|
|
172014
|
+
function DishwasherEndpoint(homeAssistantEntity) {
|
|
172015
|
+
return DishwasherDeviceType.set({ homeAssistantEntity });
|
|
172016
|
+
}
|
|
172017
|
+
|
|
171891
172018
|
// src/matter/behaviors/generic-switch-server.ts
|
|
171892
172019
|
init_esm();
|
|
171893
172020
|
init_home_assistant_entity_behavior();
|
|
@@ -172221,6 +172348,12 @@ function consumePendingColorStaging(entityId) {
|
|
|
172221
172348
|
var FeaturedBase8 = ColorControlServer.with("ColorTemperature", "HueSaturation");
|
|
172222
172349
|
var ColorControlServerBase = class extends FeaturedBase8 {
|
|
172223
172350
|
pendingTransitionTime;
|
|
172351
|
+
async [Symbol.asyncDispose]() {
|
|
172352
|
+
const entityId = this.agent.get(HomeAssistantEntityBehavior).entityId;
|
|
172353
|
+
optimisticColorState.delete(entityId);
|
|
172354
|
+
pendingColorStaging.delete(entityId);
|
|
172355
|
+
await super[Symbol.asyncDispose]();
|
|
172356
|
+
}
|
|
172224
172357
|
async initialize() {
|
|
172225
172358
|
if (this.features.colorTemperature) {
|
|
172226
172359
|
const defaultMinMireds = 147;
|
|
@@ -175595,6 +175728,26 @@ function SensorDevice(homeAssistantEntity) {
|
|
|
175595
175728
|
return void 0;
|
|
175596
175729
|
}
|
|
175597
175730
|
|
|
175731
|
+
// src/matter/endpoints/legacy/siren/index.ts
|
|
175732
|
+
init_home_assistant_entity_behavior();
|
|
175733
|
+
var SirenOnOffServer = OnOffServer2({
|
|
175734
|
+
turnOn: () => ({
|
|
175735
|
+
action: "siren.turn_on"
|
|
175736
|
+
}),
|
|
175737
|
+
turnOff: () => ({
|
|
175738
|
+
action: "siren.turn_off"
|
|
175739
|
+
})
|
|
175740
|
+
});
|
|
175741
|
+
var SirenDeviceType = OnOffPlugInUnitDevice.with(
|
|
175742
|
+
BasicInformationServer2,
|
|
175743
|
+
IdentifyServer2,
|
|
175744
|
+
HomeAssistantEntityBehavior,
|
|
175745
|
+
SirenOnOffServer
|
|
175746
|
+
);
|
|
175747
|
+
function SirenDevice(homeAssistantEntity) {
|
|
175748
|
+
return SirenDeviceType.set({ homeAssistantEntity });
|
|
175749
|
+
}
|
|
175750
|
+
|
|
175598
175751
|
// src/matter/endpoints/legacy/switch/dimmable-plugin-unit.ts
|
|
175599
175752
|
init_home_assistant_entity_behavior();
|
|
175600
175753
|
var DimmablePlugInUnitType = DimmablePlugInUnitDevice.with(
|
|
@@ -178190,6 +178343,7 @@ var deviceCtrs = {
|
|
|
178190
178343
|
select: SelectDevice,
|
|
178191
178344
|
input_select: InputSelectDevice,
|
|
178192
178345
|
scene: SceneDevice,
|
|
178346
|
+
siren: SirenDevice,
|
|
178193
178347
|
media_player: MediaPlayerDevice,
|
|
178194
178348
|
humidifier: HumidifierDevice,
|
|
178195
178349
|
vacuum: VacuumDevice,
|
|
@@ -178211,6 +178365,7 @@ var matterDeviceTypeFactories = {
|
|
|
178211
178365
|
}
|
|
178212
178366
|
return SwitchDevice(ha);
|
|
178213
178367
|
},
|
|
178368
|
+
dishwasher: DishwasherEndpoint,
|
|
178214
178369
|
dimmable_plugin_unit: (ha) => DimmablePlugInUnitType.set({ homeAssistantEntity: ha }),
|
|
178215
178370
|
on_off_switch: SwitchDevice,
|
|
178216
178371
|
door_lock: LockDevice,
|
|
@@ -183562,6 +183717,8 @@ export {
|
|
|
183562
183717
|
@matter/main/dist/esm/clusters.js:
|
|
183563
183718
|
@matter/main/dist/esm/forwards/behaviors/boolean-state.js:
|
|
183564
183719
|
@matter/main/dist/esm/forwards/behaviors/smoke-co-alarm.js:
|
|
183720
|
+
@matter/main/dist/esm/forwards/behaviors/operational-state.js:
|
|
183721
|
+
@matter/main/dist/esm/forwards/clusters/operational-state.js:
|
|
183565
183722
|
@matter/main/dist/esm/forwards/behaviors/color-control.js:
|
|
183566
183723
|
@matter/main/dist/esm/forwards/behaviors/pump-configuration-and-control.js:
|
|
183567
183724
|
@matter/main/dist/esm/forwards/clusters/mode-base.js:
|