@riddix/hamh 2.1.0-alpha.752 → 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,
|
|
@@ -151435,6 +151445,16 @@ var heatingAndCoolingDefaults = {
|
|
|
151435
151445
|
var HeatingAndCoolingFeaturedBase = ThermostatServer.with("Heating", "Cooling").set(
|
|
151436
151446
|
heatingAndCoolingDefaults
|
|
151437
151447
|
);
|
|
151448
|
+
function repairSetpointLimits(limits) {
|
|
151449
|
+
let { min, max } = limits;
|
|
151450
|
+
if (min > max) [min, max] = [max, min];
|
|
151451
|
+
return {
|
|
151452
|
+
min,
|
|
151453
|
+
max,
|
|
151454
|
+
absMin: Math.min(limits.absMin, min),
|
|
151455
|
+
absMax: Math.max(limits.absMax, max)
|
|
151456
|
+
};
|
|
151457
|
+
}
|
|
151438
151458
|
function thermostatPreInitialize(self) {
|
|
151439
151459
|
const currentLocal = self.state.localTemperature;
|
|
151440
151460
|
logger199.debug(
|
|
@@ -151447,6 +151467,16 @@ function thermostatPreInitialize(self) {
|
|
|
151447
151467
|
self.state.absMaxHeatSetpointLimit = self.state.absMaxHeatSetpointLimit ?? 5e3;
|
|
151448
151468
|
self.state.minHeatSetpointLimit = self.state.minHeatSetpointLimit ?? 0;
|
|
151449
151469
|
self.state.maxHeatSetpointLimit = self.state.maxHeatSetpointLimit ?? 5e3;
|
|
151470
|
+
const heat = repairSetpointLimits({
|
|
151471
|
+
absMin: self.state.absMinHeatSetpointLimit,
|
|
151472
|
+
min: self.state.minHeatSetpointLimit,
|
|
151473
|
+
max: self.state.maxHeatSetpointLimit,
|
|
151474
|
+
absMax: self.state.absMaxHeatSetpointLimit
|
|
151475
|
+
});
|
|
151476
|
+
self.state.absMinHeatSetpointLimit = heat.absMin;
|
|
151477
|
+
self.state.minHeatSetpointLimit = heat.min;
|
|
151478
|
+
self.state.maxHeatSetpointLimit = heat.max;
|
|
151479
|
+
self.state.absMaxHeatSetpointLimit = heat.absMax;
|
|
151450
151480
|
const currentHeating = self.state.occupiedHeatingSetpoint;
|
|
151451
151481
|
const heatingValue = typeof currentHeating === "number" && !Number.isNaN(currentHeating) ? currentHeating : 2e3;
|
|
151452
151482
|
self.state.occupiedHeatingSetpoint = heatingValue;
|
|
@@ -151456,6 +151486,16 @@ function thermostatPreInitialize(self) {
|
|
|
151456
151486
|
self.state.absMaxCoolSetpointLimit = self.state.absMaxCoolSetpointLimit ?? 5e3;
|
|
151457
151487
|
self.state.minCoolSetpointLimit = self.state.minCoolSetpointLimit ?? 0;
|
|
151458
151488
|
self.state.maxCoolSetpointLimit = self.state.maxCoolSetpointLimit ?? 5e3;
|
|
151489
|
+
const cool = repairSetpointLimits({
|
|
151490
|
+
absMin: self.state.absMinCoolSetpointLimit,
|
|
151491
|
+
min: self.state.minCoolSetpointLimit,
|
|
151492
|
+
max: self.state.maxCoolSetpointLimit,
|
|
151493
|
+
absMax: self.state.absMaxCoolSetpointLimit
|
|
151494
|
+
});
|
|
151495
|
+
self.state.absMinCoolSetpointLimit = cool.absMin;
|
|
151496
|
+
self.state.minCoolSetpointLimit = cool.min;
|
|
151497
|
+
self.state.maxCoolSetpointLimit = cool.max;
|
|
151498
|
+
self.state.absMaxCoolSetpointLimit = cool.absMax;
|
|
151459
151499
|
const currentCooling = self.state.occupiedCoolingSetpoint;
|
|
151460
151500
|
const coolingValue = typeof currentCooling === "number" && !Number.isNaN(currentCooling) ? currentCooling : 2400;
|
|
151461
151501
|
self.state.occupiedCoolingSetpoint = coolingValue;
|
|
@@ -160300,6 +160340,28 @@ function getVacuumBatteryPercent(entity, agent) {
|
|
|
160300
160340
|
const parsed = Number.parseFloat(String(raw));
|
|
160301
160341
|
return Number.isNaN(parsed) ? null : parsed;
|
|
160302
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
|
+
}
|
|
160303
160365
|
|
|
160304
160366
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-power-source-server.ts
|
|
160305
160367
|
var VacuumPowerSourceServer = PowerSourceServer2({
|
|
@@ -160307,6 +160369,14 @@ var VacuumPowerSourceServer = PowerSourceServer2({
|
|
|
160307
160369
|
isCharging(entity) {
|
|
160308
160370
|
const state = entity.state;
|
|
160309
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;
|
|
160310
160380
|
}
|
|
160311
160381
|
});
|
|
160312
160382
|
|
|
@@ -161056,7 +161126,7 @@ function isDockedCharging(entity, batteryPercent) {
|
|
|
161056
161126
|
if (batteryPercent != null) return batteryPercent < 100;
|
|
161057
161127
|
return isCharging(entity);
|
|
161058
161128
|
}
|
|
161059
|
-
function mapVacuumOperationalState(entity, batteryPercent = batteryFromAttributes(entity.attributes)) {
|
|
161129
|
+
function mapVacuumOperationalState(entity, batteryPercent = batteryFromAttributes(entity.attributes), chargingState = null) {
|
|
161060
161130
|
const state = entity.state;
|
|
161061
161131
|
const cleaningStates = [
|
|
161062
161132
|
VacuumState.cleaning,
|
|
@@ -161067,11 +161137,8 @@ function mapVacuumOperationalState(entity, batteryPercent = batteryFromAttribute
|
|
|
161067
161137
|
];
|
|
161068
161138
|
let operationalState;
|
|
161069
161139
|
if (state === VacuumState.docked) {
|
|
161070
|
-
|
|
161071
|
-
|
|
161072
|
-
} else {
|
|
161073
|
-
operationalState = RvcOperationalState4.OperationalState.Docked;
|
|
161074
|
-
}
|
|
161140
|
+
const charging = chargingState != null ? chargingState === "charging" : isDockedCharging(entity, batteryPercent);
|
|
161141
|
+
operationalState = charging ? RvcOperationalState4.OperationalState.Charging : RvcOperationalState4.OperationalState.Docked;
|
|
161075
161142
|
} else if (state === VacuumState.returning) {
|
|
161076
161143
|
operationalState = RvcOperationalState4.OperationalState.SeekingCharger;
|
|
161077
161144
|
} else if (cleaningStates.includes(state)) {
|
|
@@ -161079,11 +161146,8 @@ function mapVacuumOperationalState(entity, batteryPercent = batteryFromAttribute
|
|
|
161079
161146
|
} else if (state === VacuumState.paused) {
|
|
161080
161147
|
operationalState = RvcOperationalState4.OperationalState.Paused;
|
|
161081
161148
|
} else if (state === VacuumState.idle) {
|
|
161082
|
-
|
|
161083
|
-
|
|
161084
|
-
} else {
|
|
161085
|
-
operationalState = RvcOperationalState4.OperationalState.Stopped;
|
|
161086
|
-
}
|
|
161149
|
+
const charging = chargingState != null ? chargingState === "charging" : isCharging(entity);
|
|
161150
|
+
operationalState = charging ? RvcOperationalState4.OperationalState.Charging : RvcOperationalState4.OperationalState.Stopped;
|
|
161087
161151
|
} else if (state === VacuumState.error || state === "unavailable") {
|
|
161088
161152
|
operationalState = RvcOperationalState4.OperationalState.Error;
|
|
161089
161153
|
} else {
|
|
@@ -161106,7 +161170,8 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
161106
161170
|
getOperationalState(entity, agent) {
|
|
161107
161171
|
return mapVacuumOperationalState(
|
|
161108
161172
|
entity,
|
|
161109
|
-
getVacuumBatteryPercent(entity, agent)
|
|
161173
|
+
getVacuumBatteryPercent(entity, agent),
|
|
161174
|
+
getVacuumChargingState(agent)
|
|
161110
161175
|
);
|
|
161111
161176
|
},
|
|
161112
161177
|
pause: (_, agent) => {
|