@riddix/hamh 2.1.0-alpha.753 → 2.1.0-alpha.754
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
|
@@ -127033,6 +127033,7 @@ function entityMappingApi(mappingStorage) {
|
|
|
127033
127033
|
humidityEntity: body.humidityEntity,
|
|
127034
127034
|
pressureEntity: body.pressureEntity,
|
|
127035
127035
|
batteryEntity: body.batteryEntity,
|
|
127036
|
+
chargingStateEntity: body.chargingStateEntity,
|
|
127036
127037
|
roomEntities: body.roomEntities,
|
|
127037
127038
|
disableLockPin: body.disableLockPin,
|
|
127038
127039
|
powerEntity: body.powerEntity,
|
|
@@ -131671,6 +131672,7 @@ var EntityMappingStorage = class extends Service {
|
|
|
131671
131672
|
temperatureEntity: request.temperatureEntity?.trim() || void 0,
|
|
131672
131673
|
humidityEntity: request.humidityEntity?.trim() || void 0,
|
|
131673
131674
|
batteryEntity: request.batteryEntity?.trim() || void 0,
|
|
131675
|
+
chargingStateEntity: request.chargingStateEntity?.trim() || void 0,
|
|
131674
131676
|
roomEntities: roomEntities.length > 0 ? roomEntities : void 0,
|
|
131675
131677
|
disableLockPin: request.disableLockPin || void 0,
|
|
131676
131678
|
powerEntity: request.powerEntity?.trim() || void 0,
|
|
@@ -131697,7 +131699,7 @@ var EntityMappingStorage = class extends Service {
|
|
|
131697
131699
|
climateAutoMode: request.climateAutoMode || void 0,
|
|
131698
131700
|
composedEntities: request.composedEntities?.filter((e) => e.entityId?.trim()) ?? void 0
|
|
131699
131701
|
};
|
|
131700
|
-
if (!config11.matterDeviceType && !config11.customName && !config11.customProductName && !config11.customVendorName && !config11.customSerialNumber && config11.customVendorId === void 0 && config11.disabled !== true && !config11.filterLifeEntity && !config11.cleaningModeEntity && !config11.temperatureEntity && !config11.humidityEntity && !config11.batteryEntity && !config11.roomEntities && !config11.disableLockPin && !config11.powerEntity && !config11.energyEntity && !config11.pressureEntity && !config11.suctionLevelEntity && !config11.mopIntensityEntity && (!config11.customServiceAreas || config11.customServiceAreas.length === 0) && (!config11.customFanSpeedTags || Object.keys(config11.customFanSpeedTags).length === 0) && !config11.currentRoomEntity && !config11.cleanedAreaEntity && !config11.disableCustomAreaRoomModes && !config11.valetudoIdentifier && !config11.coverSwapOpenClose && !config11.coverExposeAsDimmableLight && !config11.coverSliderDebounceMs && !config11.updateThrottleMs && !config11.disableClimateOnOff && !config11.disableClimateFanControl && !config11.climateKeepModeOnIdle && !config11.climateExposeFan && !config11.climateAutoMode && (!config11.composedEntities || config11.composedEntities.length === 0)) {
|
|
131702
|
+
if (!config11.matterDeviceType && !config11.customName && !config11.customProductName && !config11.customVendorName && !config11.customSerialNumber && config11.customVendorId === void 0 && config11.disabled !== true && !config11.filterLifeEntity && !config11.cleaningModeEntity && !config11.temperatureEntity && !config11.humidityEntity && !config11.batteryEntity && !config11.chargingStateEntity && !config11.roomEntities && !config11.disableLockPin && !config11.powerEntity && !config11.energyEntity && !config11.pressureEntity && !config11.suctionLevelEntity && !config11.mopIntensityEntity && (!config11.customServiceAreas || config11.customServiceAreas.length === 0) && (!config11.customFanSpeedTags || Object.keys(config11.customFanSpeedTags).length === 0) && !config11.currentRoomEntity && !config11.cleanedAreaEntity && !config11.disableCustomAreaRoomModes && !config11.valetudoIdentifier && !config11.coverSwapOpenClose && !config11.coverExposeAsDimmableLight && !config11.coverSliderDebounceMs && !config11.updateThrottleMs && !config11.disableClimateOnOff && !config11.disableClimateFanControl && !config11.climateKeepModeOnIdle && !config11.climateExposeFan && !config11.climateAutoMode && (!config11.composedEntities || config11.composedEntities.length === 0)) {
|
|
131701
131703
|
bridgeMap.delete(request.entityId);
|
|
131702
131704
|
} else {
|
|
131703
131705
|
bridgeMap.set(request.entityId, config11);
|
|
@@ -149217,6 +149219,7 @@ function getMappedEntityIds(mapping) {
|
|
|
149217
149219
|
if (!mapping) return [];
|
|
149218
149220
|
const ids = [];
|
|
149219
149221
|
if (mapping.batteryEntity) ids.push(mapping.batteryEntity);
|
|
149222
|
+
if (mapping.chargingStateEntity) ids.push(mapping.chargingStateEntity);
|
|
149220
149223
|
if (mapping.temperatureEntity) ids.push(mapping.temperatureEntity);
|
|
149221
149224
|
if (mapping.humidityEntity) ids.push(mapping.humidityEntity);
|
|
149222
149225
|
if (mapping.pressureEntity) ids.push(mapping.pressureEntity);
|
|
@@ -149749,6 +149752,13 @@ var PowerSourceServerBase = class extends FeaturedBase2 {
|
|
|
149749
149752
|
} else if (isCharging2 === false) {
|
|
149750
149753
|
batChargeState = PowerSource3.BatChargeState.IsNotCharging;
|
|
149751
149754
|
}
|
|
149755
|
+
const explicitChargeState = config11.getChargeState?.(
|
|
149756
|
+
entity.state,
|
|
149757
|
+
this.agent
|
|
149758
|
+
);
|
|
149759
|
+
if (explicitChargeState != null) {
|
|
149760
|
+
batChargeState = explicitChargeState;
|
|
149761
|
+
}
|
|
149752
149762
|
applyPatchState(this.state, {
|
|
149753
149763
|
status: PowerSource3.PowerSourceStatus.Active,
|
|
149754
149764
|
batPercentRemaining,
|
|
@@ -160330,6 +160340,28 @@ function getVacuumBatteryPercent(entity, agent) {
|
|
|
160330
160340
|
const parsed = Number.parseFloat(String(raw));
|
|
160331
160341
|
return Number.isNaN(parsed) ? null : parsed;
|
|
160332
160342
|
}
|
|
160343
|
+
var CHARGING_STRINGS = {
|
|
160344
|
+
charging: "charging",
|
|
160345
|
+
go_charging: "charging",
|
|
160346
|
+
on: "charging",
|
|
160347
|
+
true: "charging",
|
|
160348
|
+
full: "full",
|
|
160349
|
+
not_charging: "not_charging",
|
|
160350
|
+
not_chargeable: "not_charging",
|
|
160351
|
+
discharging: "not_charging",
|
|
160352
|
+
off: "not_charging",
|
|
160353
|
+
false: "not_charging"
|
|
160354
|
+
};
|
|
160355
|
+
function mapChargingString(raw) {
|
|
160356
|
+
return CHARGING_STRINGS[raw.trim().toLowerCase()] ?? null;
|
|
160357
|
+
}
|
|
160358
|
+
function getVacuumChargingState(agent) {
|
|
160359
|
+
const id = agent.get(HomeAssistantEntityBehavior).state.mapping?.chargingStateEntity;
|
|
160360
|
+
if (!id) return null;
|
|
160361
|
+
const state = agent.env.get(EntityStateProvider).getState(id);
|
|
160362
|
+
if (!state) return null;
|
|
160363
|
+
return mapChargingString(state.state);
|
|
160364
|
+
}
|
|
160333
160365
|
|
|
160334
160366
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-power-source-server.ts
|
|
160335
160367
|
var VacuumPowerSourceServer = PowerSourceServer2({
|
|
@@ -160337,6 +160369,14 @@ var VacuumPowerSourceServer = PowerSourceServer2({
|
|
|
160337
160369
|
isCharging(entity) {
|
|
160338
160370
|
const state = entity.state;
|
|
160339
160371
|
return state === VacuumState.docked;
|
|
160372
|
+
},
|
|
160373
|
+
getChargeState(_, agent) {
|
|
160374
|
+
const signal = getVacuumChargingState(agent);
|
|
160375
|
+
if (signal === "charging") return PowerSource3.BatChargeState.IsCharging;
|
|
160376
|
+
if (signal === "full") return PowerSource3.BatChargeState.IsAtFullCharge;
|
|
160377
|
+
if (signal === "not_charging")
|
|
160378
|
+
return PowerSource3.BatChargeState.IsNotCharging;
|
|
160379
|
+
return null;
|
|
160340
160380
|
}
|
|
160341
160381
|
});
|
|
160342
160382
|
|
|
@@ -161086,7 +161126,7 @@ function isDockedCharging(entity, batteryPercent) {
|
|
|
161086
161126
|
if (batteryPercent != null) return batteryPercent < 100;
|
|
161087
161127
|
return isCharging(entity);
|
|
161088
161128
|
}
|
|
161089
|
-
function mapVacuumOperationalState(entity, batteryPercent = batteryFromAttributes(entity.attributes)) {
|
|
161129
|
+
function mapVacuumOperationalState(entity, batteryPercent = batteryFromAttributes(entity.attributes), chargingState = null) {
|
|
161090
161130
|
const state = entity.state;
|
|
161091
161131
|
const cleaningStates = [
|
|
161092
161132
|
VacuumState.cleaning,
|
|
@@ -161097,11 +161137,8 @@ function mapVacuumOperationalState(entity, batteryPercent = batteryFromAttribute
|
|
|
161097
161137
|
];
|
|
161098
161138
|
let operationalState;
|
|
161099
161139
|
if (state === VacuumState.docked) {
|
|
161100
|
-
|
|
161101
|
-
|
|
161102
|
-
} else {
|
|
161103
|
-
operationalState = RvcOperationalState4.OperationalState.Docked;
|
|
161104
|
-
}
|
|
161140
|
+
const charging = chargingState != null ? chargingState === "charging" : isDockedCharging(entity, batteryPercent);
|
|
161141
|
+
operationalState = charging ? RvcOperationalState4.OperationalState.Charging : RvcOperationalState4.OperationalState.Docked;
|
|
161105
161142
|
} else if (state === VacuumState.returning) {
|
|
161106
161143
|
operationalState = RvcOperationalState4.OperationalState.SeekingCharger;
|
|
161107
161144
|
} else if (cleaningStates.includes(state)) {
|
|
@@ -161109,11 +161146,8 @@ function mapVacuumOperationalState(entity, batteryPercent = batteryFromAttribute
|
|
|
161109
161146
|
} else if (state === VacuumState.paused) {
|
|
161110
161147
|
operationalState = RvcOperationalState4.OperationalState.Paused;
|
|
161111
161148
|
} else if (state === VacuumState.idle) {
|
|
161112
|
-
|
|
161113
|
-
|
|
161114
|
-
} else {
|
|
161115
|
-
operationalState = RvcOperationalState4.OperationalState.Stopped;
|
|
161116
|
-
}
|
|
161149
|
+
const charging = chargingState != null ? chargingState === "charging" : isCharging(entity);
|
|
161150
|
+
operationalState = charging ? RvcOperationalState4.OperationalState.Charging : RvcOperationalState4.OperationalState.Stopped;
|
|
161117
161151
|
} else if (state === VacuumState.error || state === "unavailable") {
|
|
161118
161152
|
operationalState = RvcOperationalState4.OperationalState.Error;
|
|
161119
161153
|
} else {
|
|
@@ -161136,7 +161170,8 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
161136
161170
|
getOperationalState(entity, agent) {
|
|
161137
161171
|
return mapVacuumOperationalState(
|
|
161138
161172
|
entity,
|
|
161139
|
-
getVacuumBatteryPercent(entity, agent)
|
|
161173
|
+
getVacuumBatteryPercent(entity, agent),
|
|
161174
|
+
getVacuumChargingState(agent)
|
|
161140
161175
|
);
|
|
161141
161176
|
},
|
|
161142
161177
|
pause: (_, agent) => {
|