@riddix/hamh 2.1.0-alpha.367 → 2.1.0-alpha.368
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
|
@@ -151141,9 +151141,12 @@ var EntityMappingStorage = class extends Service {
|
|
|
151141
151141
|
energyEntity: request.energyEntity?.trim() || void 0,
|
|
151142
151142
|
pressureEntity: request.pressureEntity?.trim() || void 0,
|
|
151143
151143
|
suctionLevelEntity: request.suctionLevelEntity?.trim() || void 0,
|
|
151144
|
-
mopIntensityEntity: request.mopIntensityEntity?.trim() || void 0
|
|
151144
|
+
mopIntensityEntity: request.mopIntensityEntity?.trim() || void 0,
|
|
151145
|
+
customServiceAreas: request.customServiceAreas?.filter(
|
|
151146
|
+
(a) => a.name?.trim() && a.service?.trim()
|
|
151147
|
+
) ?? void 0
|
|
151145
151148
|
};
|
|
151146
|
-
if (!config10.matterDeviceType && !config10.customName && config10.disabled !== true && !config10.filterLifeEntity && !config10.cleaningModeEntity && !config10.humidityEntity && !config10.batteryEntity && !config10.roomEntities && !config10.disableLockPin && !config10.powerEntity && !config10.energyEntity && !config10.pressureEntity && !config10.suctionLevelEntity && !config10.mopIntensityEntity) {
|
|
151149
|
+
if (!config10.matterDeviceType && !config10.customName && config10.disabled !== true && !config10.filterLifeEntity && !config10.cleaningModeEntity && !config10.humidityEntity && !config10.batteryEntity && !config10.roomEntities && !config10.disableLockPin && !config10.powerEntity && !config10.energyEntity && !config10.pressureEntity && !config10.suctionLevelEntity && !config10.mopIntensityEntity && (!config10.customServiceAreas || config10.customServiceAreas.length === 0)) {
|
|
151147
151150
|
bridgeMap.delete(request.entityId);
|
|
151148
151151
|
} else {
|
|
151149
151152
|
bridgeMap.set(request.entityId, config10);
|
|
@@ -171966,6 +171969,28 @@ function createDefaultServiceAreaServer() {
|
|
|
171966
171969
|
currentArea: null
|
|
171967
171970
|
});
|
|
171968
171971
|
}
|
|
171972
|
+
function createCustomServiceAreaServer(customAreas) {
|
|
171973
|
+
const supportedAreas = customAreas.map((area, index) => ({
|
|
171974
|
+
areaId: index + 1,
|
|
171975
|
+
mapId: null,
|
|
171976
|
+
areaInfo: {
|
|
171977
|
+
locationInfo: {
|
|
171978
|
+
locationName: area.name,
|
|
171979
|
+
floorNumber: null,
|
|
171980
|
+
areaType: null
|
|
171981
|
+
},
|
|
171982
|
+
landmarkInfo: null
|
|
171983
|
+
}
|
|
171984
|
+
}));
|
|
171985
|
+
logger179.info(
|
|
171986
|
+
`Using ${customAreas.length} custom service areas: ${customAreas.map((a) => a.name).join(", ")}`
|
|
171987
|
+
);
|
|
171988
|
+
return ServiceAreaServer2({
|
|
171989
|
+
supportedAreas,
|
|
171990
|
+
selectedAreas: [],
|
|
171991
|
+
currentArea: null
|
|
171992
|
+
});
|
|
171993
|
+
}
|
|
171969
171994
|
|
|
171970
171995
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
|
|
171971
171996
|
var logger180 = Logger.get("VacuumRvcRunModeServer");
|
|
@@ -171995,6 +172020,33 @@ function buildSupportedModes2(attributes7, includeUnnamedRooms = false) {
|
|
|
171995
172020
|
}
|
|
171996
172021
|
return modes;
|
|
171997
172022
|
}
|
|
172023
|
+
function handleCustomServiceAreas(selectedAreas, customAreas, homeAssistant, serviceArea) {
|
|
172024
|
+
serviceArea.state.selectedAreas = [];
|
|
172025
|
+
const matched = selectedAreas.map((areaId) => customAreas[areaId - 1]).filter(Boolean);
|
|
172026
|
+
if (matched.length === 0) {
|
|
172027
|
+
logger180.warn(
|
|
172028
|
+
`Custom service areas: no match for selected IDs ${selectedAreas.join(", ")}`
|
|
172029
|
+
);
|
|
172030
|
+
return { action: "vacuum.start" };
|
|
172031
|
+
}
|
|
172032
|
+
logger180.info(
|
|
172033
|
+
`Custom service areas: calling ${matched.length} service(s): ${matched.map((a) => `${a.service} (${a.name})`).join(", ")}`
|
|
172034
|
+
);
|
|
172035
|
+
for (let i = 1; i < matched.length; i++) {
|
|
172036
|
+
const area = matched[i];
|
|
172037
|
+
homeAssistant.callAction({
|
|
172038
|
+
action: area.service,
|
|
172039
|
+
target: area.target,
|
|
172040
|
+
data: area.data
|
|
172041
|
+
});
|
|
172042
|
+
}
|
|
172043
|
+
const first = matched[0];
|
|
172044
|
+
return {
|
|
172045
|
+
action: first.service,
|
|
172046
|
+
target: first.target,
|
|
172047
|
+
data: first.data
|
|
172048
|
+
};
|
|
172049
|
+
}
|
|
171998
172050
|
var vacuumRvcRunModeConfig = {
|
|
171999
172051
|
getCurrentMode: (entity) => {
|
|
172000
172052
|
const state = entity.state;
|
|
@@ -172024,6 +172076,15 @@ var vacuumRvcRunModeConfig = {
|
|
|
172024
172076
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
172025
172077
|
const entity = homeAssistant.entity;
|
|
172026
172078
|
const attributes7 = entity.state.attributes;
|
|
172079
|
+
const customAreas = homeAssistant.state.mapping?.customServiceAreas;
|
|
172080
|
+
if (customAreas && customAreas.length > 0) {
|
|
172081
|
+
return handleCustomServiceAreas(
|
|
172082
|
+
selectedAreas,
|
|
172083
|
+
customAreas,
|
|
172084
|
+
homeAssistant,
|
|
172085
|
+
serviceArea
|
|
172086
|
+
);
|
|
172087
|
+
}
|
|
172027
172088
|
const roomEntities = homeAssistant.state.mapping?.roomEntities;
|
|
172028
172089
|
if (roomEntities && roomEntities.length > 0) {
|
|
172029
172090
|
const buttonEntityIds = [];
|
|
@@ -173210,12 +173271,18 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false) {
|
|
|
173210
173271
|
device = device.with(VacuumOnOffServer);
|
|
173211
173272
|
}
|
|
173212
173273
|
device = device.with(VacuumPowerSourceServer);
|
|
173274
|
+
const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
|
|
173213
173275
|
const roomEntities = homeAssistantEntity.mapping?.roomEntities;
|
|
173214
173276
|
const rooms = parseVacuumRooms(attributes7);
|
|
173215
173277
|
logger185.info(
|
|
173216
|
-
`${entityId}: roomEntities=${JSON.stringify(roomEntities ?? [])}, parsedRooms=${rooms.length}`
|
|
173278
|
+
`${entityId}: customAreas=${customAreas?.length ?? 0}, roomEntities=${JSON.stringify(roomEntities ?? [])}, parsedRooms=${rooms.length}`
|
|
173217
173279
|
);
|
|
173218
|
-
if (
|
|
173280
|
+
if (customAreas && customAreas.length > 0) {
|
|
173281
|
+
logger185.info(
|
|
173282
|
+
`${entityId}: Adding ServiceArea (${customAreas.length} custom areas)`
|
|
173283
|
+
);
|
|
173284
|
+
device = device.with(createCustomServiceAreaServer(customAreas));
|
|
173285
|
+
} else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
|
|
173219
173286
|
logger185.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
|
|
173220
173287
|
device = device.with(
|
|
173221
173288
|
createVacuumServiceAreaServer(attributes7, roomEntities)
|
|
@@ -175126,9 +175193,12 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false) {
|
|
|
175126
175193
|
device = device.with(VacuumOnOffServer);
|
|
175127
175194
|
}
|
|
175128
175195
|
device = device.with(VacuumPowerSourceServer);
|
|
175196
|
+
const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
|
|
175129
175197
|
const roomEntities = homeAssistantEntity.mapping?.roomEntities;
|
|
175130
175198
|
const rooms = parseVacuumRooms(attributes7);
|
|
175131
|
-
if (
|
|
175199
|
+
if (customAreas && customAreas.length > 0) {
|
|
175200
|
+
device = device.with(createCustomServiceAreaServer(customAreas));
|
|
175201
|
+
} else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
|
|
175132
175202
|
device = device.with(
|
|
175133
175203
|
createVacuumServiceAreaServer(attributes7, roomEntities)
|
|
175134
175204
|
);
|