@riddix/hamh 2.1.0-alpha.480 → 2.1.0-alpha.482
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
|
@@ -146701,12 +146701,6 @@ var init_bridge_config_schema = __esm({
|
|
|
146701
146701
|
type: "boolean",
|
|
146702
146702
|
default: false
|
|
146703
146703
|
},
|
|
146704
|
-
alexaPreserveBrightnessOnTurnOn: {
|
|
146705
|
-
title: "Alexa: Preserve Brightness on Turn-On (Deprecated)",
|
|
146706
|
-
description: "This workaround is now always active and this setting has no effect. The bridge automatically ignores brightness commands that set lights to 100% immediately after a turn-on command.",
|
|
146707
|
-
type: "boolean",
|
|
146708
|
-
default: true
|
|
146709
|
-
},
|
|
146710
146704
|
serverMode: {
|
|
146711
146705
|
title: "Server Mode (for Robot Vacuums)",
|
|
146712
146706
|
description: "Expose the device as a standalone Matter device instead of a bridged device. This is required for Apple Home to properly support Siri voice commands for Robot Vacuums. IMPORTANT: Only ONE device should be in this bridge when server mode is enabled.",
|
|
@@ -146747,12 +146741,6 @@ var init_bridge_config_schema = __esm({
|
|
|
146747
146741
|
title: "Vacuum: Include OnOff Cluster (Alexa)",
|
|
146748
146742
|
description: "Add an OnOff cluster to robot vacuum endpoints. Alexa REQUIRES this (PowerController) to show robotic vacuums in the app. Without it, Alexa commissions the device but never displays it. In Server Mode this is enabled automatically \u2014 only check this for bridge mode. WARNING: OnOff is NOT part of the Matter RVC device type specification. Enabling this may break Apple Home (shows 'Updating') and Google Home.",
|
|
146749
146743
|
type: "boolean"
|
|
146750
|
-
},
|
|
146751
|
-
vacuumMinimalClusters: {
|
|
146752
|
-
title: "Vacuum: Minimal Clusters (Alexa troubleshooting)",
|
|
146753
|
-
description: "Strip the vacuum endpoint to only the clusters required by the Matter RVC spec. Removes PowerSource (battery) and the default ServiceArea placeholder. Enable this if Alexa commissions the vacuum but the device never appears in the app. Trade-off: battery percentage will not be reported to Matter controllers.",
|
|
146754
|
-
type: "boolean",
|
|
146755
|
-
default: false
|
|
146756
146744
|
}
|
|
146757
146745
|
},
|
|
146758
146746
|
additionalProperties: false
|
|
@@ -168903,6 +168891,74 @@ var ContactSensorWithBatteryType = ContactSensorDevice.with(
|
|
|
168903
168891
|
})
|
|
168904
168892
|
);
|
|
168905
168893
|
|
|
168894
|
+
// src/matter/endpoints/legacy/binary-sensor/motion-sensor.ts
|
|
168895
|
+
init_home_assistant_entity_behavior();
|
|
168896
|
+
|
|
168897
|
+
// src/matter/behaviors/pir-occupancy-sensing-server.ts
|
|
168898
|
+
init_home_assistant_entity_behavior();
|
|
168899
|
+
var PirOccupancySensingServerBase = OccupancySensingServer.with(
|
|
168900
|
+
OccupancySensing3.Feature.PassiveInfrared
|
|
168901
|
+
);
|
|
168902
|
+
var PirOccupancySensingServer = class extends PirOccupancySensingServerBase {
|
|
168903
|
+
async initialize() {
|
|
168904
|
+
await super.initialize();
|
|
168905
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
168906
|
+
this.update(homeAssistant.entity);
|
|
168907
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
168908
|
+
}
|
|
168909
|
+
update(entity) {
|
|
168910
|
+
if (!entity.state) {
|
|
168911
|
+
return;
|
|
168912
|
+
}
|
|
168913
|
+
const { state } = entity;
|
|
168914
|
+
applyPatchState(this.state, {
|
|
168915
|
+
occupancy: { occupied: this.isOccupied(state) },
|
|
168916
|
+
occupancySensorType: OccupancySensing3.OccupancySensorType.Pir,
|
|
168917
|
+
occupancySensorTypeBitmap: {
|
|
168918
|
+
pir: true,
|
|
168919
|
+
physicalContact: false,
|
|
168920
|
+
ultrasonic: false
|
|
168921
|
+
}
|
|
168922
|
+
});
|
|
168923
|
+
}
|
|
168924
|
+
isOccupied(state) {
|
|
168925
|
+
return this.agent.get(HomeAssistantEntityBehavior).isAvailable && state.state !== "off";
|
|
168926
|
+
}
|
|
168927
|
+
};
|
|
168928
|
+
|
|
168929
|
+
// src/matter/endpoints/legacy/binary-sensor/motion-sensor.ts
|
|
168930
|
+
var MotionSensorType = OccupancySensorDevice.with(
|
|
168931
|
+
BasicInformationServer2,
|
|
168932
|
+
IdentifyServer2,
|
|
168933
|
+
HomeAssistantEntityBehavior,
|
|
168934
|
+
PirOccupancySensingServer
|
|
168935
|
+
);
|
|
168936
|
+
var MotionSensorWithBatteryType = OccupancySensorDevice.with(
|
|
168937
|
+
BasicInformationServer2,
|
|
168938
|
+
IdentifyServer2,
|
|
168939
|
+
HomeAssistantEntityBehavior,
|
|
168940
|
+
PirOccupancySensingServer,
|
|
168941
|
+
PowerSourceServer2({
|
|
168942
|
+
getBatteryPercent: (entity, agent) => {
|
|
168943
|
+
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
168944
|
+
const batteryEntity = homeAssistant.state.mapping?.batteryEntity;
|
|
168945
|
+
if (batteryEntity) {
|
|
168946
|
+
const stateProvider = agent.env.get(EntityStateProvider);
|
|
168947
|
+
const battery = stateProvider.getNumericState(batteryEntity);
|
|
168948
|
+
if (battery != null) {
|
|
168949
|
+
return Math.max(0, Math.min(100, battery));
|
|
168950
|
+
}
|
|
168951
|
+
}
|
|
168952
|
+
const attrs = entity.attributes;
|
|
168953
|
+
const level = attrs.battery_level ?? attrs.battery;
|
|
168954
|
+
if (level == null || Number.isNaN(Number(level))) {
|
|
168955
|
+
return null;
|
|
168956
|
+
}
|
|
168957
|
+
return Number(level);
|
|
168958
|
+
}
|
|
168959
|
+
})
|
|
168960
|
+
);
|
|
168961
|
+
|
|
168906
168962
|
// src/matter/endpoints/legacy/binary-sensor/occupancy-sensor.ts
|
|
168907
168963
|
init_home_assistant_entity_behavior();
|
|
168908
168964
|
|
|
@@ -169133,8 +169189,8 @@ var deviceClasses = {
|
|
|
169133
169189
|
[BinarySensorDeviceClass.Update]: ContactSensorType,
|
|
169134
169190
|
[BinarySensorDeviceClass.Vibration]: ContactSensorType,
|
|
169135
169191
|
[BinarySensorDeviceClass.Window]: ContactSensorType,
|
|
169136
|
-
[BinarySensorDeviceClass.Motion]:
|
|
169137
|
-
[BinarySensorDeviceClass.Moving]:
|
|
169192
|
+
[BinarySensorDeviceClass.Motion]: MotionSensorType,
|
|
169193
|
+
[BinarySensorDeviceClass.Moving]: MotionSensorType,
|
|
169138
169194
|
[BinarySensorDeviceClass.Occupancy]: OccupancySensorType,
|
|
169139
169195
|
[BinarySensorDeviceClass.Presence]: OccupancySensorType,
|
|
169140
169196
|
[BinarySensorDeviceClass.Smoke]: SmokeAlarmType,
|
|
@@ -169142,6 +169198,7 @@ var deviceClasses = {
|
|
|
169142
169198
|
};
|
|
169143
169199
|
var batteryTypes = /* @__PURE__ */ new Map([
|
|
169144
169200
|
[ContactSensorType, ContactSensorWithBatteryType],
|
|
169201
|
+
[MotionSensorType, MotionSensorWithBatteryType],
|
|
169145
169202
|
[OccupancySensorType, OccupancySensorWithBatteryType],
|
|
169146
169203
|
[OnOffSensorType, OnOffSensorWithBatteryType],
|
|
169147
169204
|
[SmokeAlarmType, SmokeAlarmWithBatteryType],
|
|
@@ -176609,7 +176666,7 @@ var VacuumEndpointType = RoboticVacuumCleanerDevice.with(
|
|
|
176609
176666
|
HomeAssistantEntityBehavior,
|
|
176610
176667
|
VacuumRvcOperationalStateServer
|
|
176611
176668
|
);
|
|
176612
|
-
function VacuumDevice(homeAssistantEntity, includeOnOff = false,
|
|
176669
|
+
function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOptions) {
|
|
176613
176670
|
if (homeAssistantEntity.entity.state === void 0) {
|
|
176614
176671
|
return void 0;
|
|
176615
176672
|
}
|
|
@@ -176630,9 +176687,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
176630
176687
|
logger196.info(`${entityId}: Adding OnOff cluster (vacuumOnOff flag enabled)`);
|
|
176631
176688
|
device = device.with(VacuumOnOffServer);
|
|
176632
176689
|
}
|
|
176633
|
-
|
|
176634
|
-
device = device.with(VacuumPowerSourceServer);
|
|
176635
|
-
}
|
|
176690
|
+
device = device.with(VacuumPowerSourceServer);
|
|
176636
176691
|
const roomEntities = homeAssistantEntity.mapping?.roomEntities;
|
|
176637
176692
|
const rooms = parseVacuumRooms(attributes7);
|
|
176638
176693
|
logger196.info(
|
|
@@ -176648,11 +176703,9 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
176648
176703
|
device = device.with(
|
|
176649
176704
|
createVacuumServiceAreaServer(attributes7, roomEntities)
|
|
176650
176705
|
);
|
|
176651
|
-
} else
|
|
176706
|
+
} else {
|
|
176652
176707
|
logger196.info(`${entityId}: Adding ServiceArea (default single-area)`);
|
|
176653
176708
|
device = device.with(createDefaultServiceAreaServer());
|
|
176654
|
-
} else {
|
|
176655
|
-
logger196.info(`${entityId}: Skipping ServiceArea (minimal clusters mode)`);
|
|
176656
176709
|
}
|
|
176657
176710
|
const fanSpeedList = resolveFanSpeedList(
|
|
176658
176711
|
attributes7,
|
|
@@ -176882,7 +176935,6 @@ function createLegacyEndpointType(entity, mapping, areaName, options) {
|
|
|
176882
176935
|
type = VacuumDevice(
|
|
176883
176936
|
{ entity, customName, mapping },
|
|
176884
176937
|
options?.vacuumOnOff,
|
|
176885
|
-
options?.vacuumMinimalClusters,
|
|
176886
176938
|
options?.cleaningModeOptions
|
|
176887
176939
|
);
|
|
176888
176940
|
} else {
|
|
@@ -177017,6 +177069,9 @@ var matterDeviceTypeFactories = {
|
|
|
177017
177069
|
electrical_sensor: (ha) => ElectricalSensorType.set({
|
|
177018
177070
|
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
177019
177071
|
}),
|
|
177072
|
+
motion_sensor: (ha) => MotionSensorType.set({
|
|
177073
|
+
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
177074
|
+
}),
|
|
177020
177075
|
mode_select: SelectDevice,
|
|
177021
177076
|
water_valve: ValveDevice,
|
|
177022
177077
|
pump: PumpEndpoint,
|
|
@@ -177305,7 +177360,6 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
177305
177360
|
const areaName = registry2.getAreaName(entityId);
|
|
177306
177361
|
const type = createLegacyEndpointType(payload, effectiveMapping, areaName, {
|
|
177307
177362
|
vacuumOnOff: registry2.isVacuumOnOffEnabled(),
|
|
177308
|
-
vacuumMinimalClusters: registry2.isVacuumMinimalClustersEnabled(),
|
|
177309
177363
|
cleaningModeOptions
|
|
177310
177364
|
});
|
|
177311
177365
|
if (!type) {
|
|
@@ -178255,9 +178309,6 @@ var BridgeRegistry = class _BridgeRegistry {
|
|
|
178255
178309
|
isServerModeVacuumOnOffEnabled() {
|
|
178256
178310
|
return this.dataProvider.featureFlags?.vacuumOnOff === true;
|
|
178257
178311
|
}
|
|
178258
|
-
isVacuumMinimalClustersEnabled() {
|
|
178259
|
-
return this.dataProvider.featureFlags?.vacuumMinimalClusters === true;
|
|
178260
|
-
}
|
|
178261
178312
|
/**
|
|
178262
178313
|
* Auto-detect vacuum-related select entities on the same HA device.
|
|
178263
178314
|
* HA integrations (Dreame, Roborock, Ecovacs, Valetudo, etc.) expose vacuum
|
|
@@ -178973,7 +179024,7 @@ var ServerModeVacuumEndpointType = RoboticVacuumCleanerDevice.with(
|
|
|
178973
179024
|
HomeAssistantEntityBehavior,
|
|
178974
179025
|
VacuumRvcOperationalStateServer
|
|
178975
179026
|
);
|
|
178976
|
-
function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false,
|
|
179027
|
+
function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOptions) {
|
|
178977
179028
|
if (homeAssistantEntity.entity.state === void 0) {
|
|
178978
179029
|
return void 0;
|
|
178979
179030
|
}
|
|
@@ -178984,9 +179035,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, minim
|
|
|
178984
179035
|
if (includeOnOff) {
|
|
178985
179036
|
device = device.with(VacuumOnOffServer);
|
|
178986
179037
|
}
|
|
178987
|
-
|
|
178988
|
-
device = device.with(VacuumPowerSourceServer);
|
|
178989
|
-
}
|
|
179038
|
+
device = device.with(VacuumPowerSourceServer);
|
|
178990
179039
|
const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
|
|
178991
179040
|
const roomEntities = homeAssistantEntity.mapping?.roomEntities;
|
|
178992
179041
|
const rooms = parseVacuumRooms(attributes7);
|
|
@@ -178996,7 +179045,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, minim
|
|
|
178996
179045
|
device = device.with(
|
|
178997
179046
|
createVacuumServiceAreaServer(attributes7, roomEntities)
|
|
178998
179047
|
);
|
|
178999
|
-
} else
|
|
179048
|
+
} else {
|
|
179000
179049
|
device = device.with(createDefaultServiceAreaServer());
|
|
179001
179050
|
}
|
|
179002
179051
|
const fanSpeedList = resolveFanSpeedList(
|
|
@@ -179161,7 +179210,6 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
179161
179210
|
mapping: effectiveMapping
|
|
179162
179211
|
},
|
|
179163
179212
|
registry2.isServerModeVacuumOnOffEnabled(),
|
|
179164
|
-
registry2.isVacuumMinimalClustersEnabled(),
|
|
179165
179213
|
cleaningModeOptions
|
|
179166
179214
|
);
|
|
179167
179215
|
if (!endpointType) {
|