@riddix/hamh 2.1.0-alpha.513 → 2.1.0-alpha.515
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
|
@@ -168542,35 +168542,25 @@ var FanOnOffServer = OnOffServer2({
|
|
|
168542
168542
|
|
|
168543
168543
|
// src/matter/endpoints/composed/composed-air-purifier-endpoint.ts
|
|
168544
168544
|
var logger169 = Logger.get("ComposedAirPurifierEndpoint");
|
|
168545
|
-
|
|
168546
|
-
|
|
168547
|
-
|
|
168548
|
-
|
|
168549
|
-
|
|
168550
|
-
|
|
168551
|
-
|
|
168552
|
-
|
|
168553
|
-
|
|
168554
|
-
|
|
168555
|
-
|
|
168556
|
-
|
|
168557
|
-
|
|
168558
|
-
|
|
168559
|
-
|
|
168560
|
-
|
|
168561
|
-
|
|
168562
|
-
|
|
168563
|
-
|
|
168564
|
-
getValue(_entity, agent) {
|
|
168565
|
-
const stateProvider = agent.env.get(EntityStateProvider);
|
|
168566
|
-
const humState = stateProvider.getState(humidityEntityId);
|
|
168567
|
-
if (!humState) return null;
|
|
168568
|
-
const humidity = Number.parseFloat(humState.state);
|
|
168569
|
-
if (Number.isNaN(humidity)) return null;
|
|
168570
|
-
return humidity;
|
|
168571
|
-
}
|
|
168572
|
-
};
|
|
168573
|
-
}
|
|
168545
|
+
var temperatureConfig = {
|
|
168546
|
+
getValue(entity, agent) {
|
|
168547
|
+
const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
|
|
168548
|
+
const state = entity.state;
|
|
168549
|
+
const attributes7 = entity.attributes;
|
|
168550
|
+
const temperature3 = state == null || Number.isNaN(+state) ? null : +state;
|
|
168551
|
+
if (temperature3 == null) return void 0;
|
|
168552
|
+
return Temperature.withUnit(
|
|
168553
|
+
temperature3,
|
|
168554
|
+
attributes7.unit_of_measurement ?? fallbackUnit
|
|
168555
|
+
);
|
|
168556
|
+
}
|
|
168557
|
+
};
|
|
168558
|
+
var humidityConfig = {
|
|
168559
|
+
getValue({ state }) {
|
|
168560
|
+
if (state == null || Number.isNaN(+state)) return null;
|
|
168561
|
+
return +state;
|
|
168562
|
+
}
|
|
168563
|
+
};
|
|
168574
168564
|
var batteryConfig = {
|
|
168575
168565
|
getBatteryPercent: (_entity, agent) => {
|
|
168576
168566
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
@@ -168583,6 +168573,16 @@ var batteryConfig = {
|
|
|
168583
168573
|
return null;
|
|
168584
168574
|
}
|
|
168585
168575
|
};
|
|
168576
|
+
var TemperatureSubType = TemperatureSensorDevice.with(
|
|
168577
|
+
IdentifyServer2,
|
|
168578
|
+
HomeAssistantEntityBehavior,
|
|
168579
|
+
TemperatureMeasurementServer2(temperatureConfig)
|
|
168580
|
+
);
|
|
168581
|
+
var HumiditySubType = HumiditySensorDevice.with(
|
|
168582
|
+
IdentifyServer2,
|
|
168583
|
+
HomeAssistantEntityBehavior,
|
|
168584
|
+
HumidityMeasurementServer(humidityConfig)
|
|
168585
|
+
);
|
|
168586
168586
|
function createEndpointId2(entityId, customName) {
|
|
168587
168587
|
const baseName = customName || entityId;
|
|
168588
168588
|
return baseName.replace(/\./g, "_").replace(/\s+/g, "_");
|
|
@@ -168602,9 +168602,9 @@ function buildEntityPayload(registry2, entityId) {
|
|
|
168602
168602
|
var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends Endpoint {
|
|
168603
168603
|
entityId;
|
|
168604
168604
|
mappedEntityIds;
|
|
168605
|
-
|
|
168605
|
+
subEndpoints = /* @__PURE__ */ new Map();
|
|
168606
168606
|
lastStates = /* @__PURE__ */ new Map();
|
|
168607
|
-
|
|
168607
|
+
debouncedUpdates = /* @__PURE__ */ new Map();
|
|
168608
168608
|
static async create(config10) {
|
|
168609
168609
|
const { registry: registry2, primaryEntityId } = config10;
|
|
168610
168610
|
const primaryPayload = buildEntityPayload(registry2, primaryEntityId);
|
|
@@ -168632,8 +168632,7 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
|
|
|
168632
168632
|
if (hasWindModes) {
|
|
168633
168633
|
features2.add("Wind");
|
|
168634
168634
|
}
|
|
168635
|
-
let
|
|
168636
|
-
BasicInformationServer2,
|
|
168635
|
+
let airPurifierSubType = AirPurifierDevice.with(
|
|
168637
168636
|
IdentifyServer2,
|
|
168638
168637
|
HomeAssistantEntityBehavior,
|
|
168639
168638
|
FanOnOffServer,
|
|
@@ -168641,27 +168640,23 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
|
|
|
168641
168640
|
);
|
|
168642
168641
|
const hasFilterLife = airPurifierAttributes.filter_life != null || airPurifierAttributes.filter_life_remaining != null || airPurifierAttributes.filter_life_level != null || !!config10.mapping?.filterLifeEntity;
|
|
168643
168642
|
if (hasFilterLife) {
|
|
168644
|
-
|
|
168645
|
-
|
|
168646
|
-
if (config10.temperatureEntityId) {
|
|
168647
|
-
parentType = parentType.with(
|
|
168648
|
-
TemperatureMeasurementServer2(
|
|
168649
|
-
createTemperatureConfig(config10.temperatureEntityId)
|
|
168650
|
-
)
|
|
168651
|
-
);
|
|
168652
|
-
}
|
|
168653
|
-
if (config10.humidityEntityId) {
|
|
168654
|
-
parentType = parentType.with(
|
|
168655
|
-
HumidityMeasurementServer(
|
|
168656
|
-
createHumidityConfig(config10.humidityEntityId)
|
|
168657
|
-
)
|
|
168643
|
+
airPurifierSubType = airPurifierSubType.with(
|
|
168644
|
+
AirPurifierHepaFilterMonitoringServer
|
|
168658
168645
|
);
|
|
168659
168646
|
}
|
|
168660
|
-
const
|
|
168647
|
+
const airPurifierMapping = {
|
|
168661
168648
|
entityId: primaryEntityId,
|
|
168662
|
-
...config10.batteryEntityId ? { batteryEntity: config10.batteryEntityId } : {},
|
|
168663
168649
|
...config10.mapping?.filterLifeEntity ? { filterLifeEntity: config10.mapping.filterLifeEntity } : {}
|
|
168664
168650
|
};
|
|
168651
|
+
let parentType = BridgedNodeEndpoint.with(
|
|
168652
|
+
BasicInformationServer2,
|
|
168653
|
+
IdentifyServer2,
|
|
168654
|
+
HomeAssistantEntityBehavior
|
|
168655
|
+
);
|
|
168656
|
+
const parentMapping = {
|
|
168657
|
+
entityId: primaryEntityId,
|
|
168658
|
+
...config10.batteryEntityId ? { batteryEntity: config10.batteryEntityId } : {}
|
|
168659
|
+
};
|
|
168665
168660
|
if (config10.batteryEntityId) {
|
|
168666
168661
|
parentType = parentType.with(PowerSourceServer2(batteryConfig));
|
|
168667
168662
|
}
|
|
@@ -168674,75 +168669,125 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
|
|
|
168674
168669
|
);
|
|
168675
168670
|
}
|
|
168676
168671
|
const endpointId = createEndpointId2(primaryEntityId, config10.customName);
|
|
168672
|
+
const parts = [];
|
|
168673
|
+
const airPurifierSub = new Endpoint(
|
|
168674
|
+
airPurifierSubType.set({
|
|
168675
|
+
homeAssistantEntity: {
|
|
168676
|
+
entity: primaryPayload,
|
|
168677
|
+
mapping: airPurifierMapping
|
|
168678
|
+
}
|
|
168679
|
+
}),
|
|
168680
|
+
{ id: `${endpointId}_air_purifier` }
|
|
168681
|
+
);
|
|
168682
|
+
parts.push(airPurifierSub);
|
|
168683
|
+
let tempSub;
|
|
168684
|
+
if (config10.temperatureEntityId) {
|
|
168685
|
+
const tempPayload = buildEntityPayload(
|
|
168686
|
+
registry2,
|
|
168687
|
+
config10.temperatureEntityId
|
|
168688
|
+
);
|
|
168689
|
+
if (tempPayload) {
|
|
168690
|
+
tempSub = new Endpoint(
|
|
168691
|
+
TemperatureSubType.set({
|
|
168692
|
+
homeAssistantEntity: { entity: tempPayload }
|
|
168693
|
+
}),
|
|
168694
|
+
{ id: `${endpointId}_temp` }
|
|
168695
|
+
);
|
|
168696
|
+
parts.push(tempSub);
|
|
168697
|
+
}
|
|
168698
|
+
}
|
|
168699
|
+
let humSub;
|
|
168700
|
+
if (config10.humidityEntityId) {
|
|
168701
|
+
const humPayload = buildEntityPayload(registry2, config10.humidityEntityId);
|
|
168702
|
+
if (humPayload) {
|
|
168703
|
+
humSub = new Endpoint(
|
|
168704
|
+
HumiditySubType.set({
|
|
168705
|
+
homeAssistantEntity: { entity: humPayload }
|
|
168706
|
+
}),
|
|
168707
|
+
{ id: `${endpointId}_humidity` }
|
|
168708
|
+
);
|
|
168709
|
+
parts.push(humSub);
|
|
168710
|
+
}
|
|
168711
|
+
}
|
|
168677
168712
|
const parentTypeWithState = parentType.set({
|
|
168678
168713
|
homeAssistantEntity: {
|
|
168679
168714
|
entity: primaryPayload,
|
|
168680
168715
|
customName: config10.customName,
|
|
168681
|
-
mapping
|
|
168716
|
+
mapping: parentMapping
|
|
168682
168717
|
}
|
|
168683
168718
|
});
|
|
168684
|
-
const
|
|
168685
|
-
if (config10.temperatureEntityId)
|
|
168686
|
-
|
|
168687
|
-
if (config10.
|
|
168688
|
-
|
|
168719
|
+
const mappedIds = [];
|
|
168720
|
+
if (config10.temperatureEntityId) mappedIds.push(config10.temperatureEntityId);
|
|
168721
|
+
if (config10.humidityEntityId) mappedIds.push(config10.humidityEntityId);
|
|
168722
|
+
if (config10.mapping?.filterLifeEntity)
|
|
168723
|
+
mappedIds.push(config10.mapping.filterLifeEntity);
|
|
168689
168724
|
const endpoint = new _ComposedAirPurifierEndpoint(
|
|
168690
168725
|
parentTypeWithState,
|
|
168691
168726
|
primaryEntityId,
|
|
168692
168727
|
endpointId,
|
|
168693
|
-
|
|
168728
|
+
parts,
|
|
168694
168729
|
mappedIds
|
|
168695
168730
|
);
|
|
168731
|
+
endpoint.subEndpoints.set(primaryEntityId, airPurifierSub);
|
|
168732
|
+
if (config10.temperatureEntityId && tempSub) {
|
|
168733
|
+
endpoint.subEndpoints.set(config10.temperatureEntityId, tempSub);
|
|
168734
|
+
}
|
|
168735
|
+
if (config10.humidityEntityId && humSub) {
|
|
168736
|
+
endpoint.subEndpoints.set(config10.humidityEntityId, humSub);
|
|
168737
|
+
}
|
|
168696
168738
|
const clusterLabels = [
|
|
168697
168739
|
"AirPurifier",
|
|
168698
168740
|
config10.temperatureEntityId ? "+Temp" : "",
|
|
168699
168741
|
config10.humidityEntityId ? "+Hum" : "",
|
|
168700
|
-
config10.batteryEntityId ? "+Bat" : ""
|
|
168742
|
+
config10.batteryEntityId ? "+Bat" : "",
|
|
168743
|
+
hasFilterLife ? "+HEPA" : ""
|
|
168701
168744
|
].filter(Boolean).join("");
|
|
168702
|
-
logger169.info(
|
|
168745
|
+
logger169.info(
|
|
168746
|
+
`Created composed air purifier ${primaryEntityId}: ${clusterLabels}`
|
|
168747
|
+
);
|
|
168703
168748
|
return endpoint;
|
|
168704
168749
|
}
|
|
168705
|
-
constructor(type, entityId, id,
|
|
168706
|
-
super(type, { id });
|
|
168750
|
+
constructor(type, entityId, id, parts, mappedEntityIds) {
|
|
168751
|
+
super(type, { id, parts });
|
|
168707
168752
|
this.entityId = entityId;
|
|
168708
|
-
this.trackedEntityIds = trackedEntityIds;
|
|
168709
168753
|
this.mappedEntityIds = mappedEntityIds;
|
|
168710
168754
|
}
|
|
168711
168755
|
async updateStates(states) {
|
|
168712
|
-
|
|
168713
|
-
for (const entityId of this.
|
|
168714
|
-
|
|
168715
|
-
if (!state) continue;
|
|
168716
|
-
const stateJson = JSON.stringify({
|
|
168717
|
-
s: state.state,
|
|
168718
|
-
a: state.attributes
|
|
168719
|
-
});
|
|
168720
|
-
if (this.lastStates.get(entityId) !== stateJson) {
|
|
168721
|
-
this.lastStates.set(entityId, stateJson);
|
|
168722
|
-
anyChanged = true;
|
|
168723
|
-
}
|
|
168756
|
+
this.scheduleUpdate(this, this.entityId, states);
|
|
168757
|
+
for (const [entityId, sub] of this.subEndpoints) {
|
|
168758
|
+
this.scheduleUpdate(sub, entityId, states);
|
|
168724
168759
|
}
|
|
168725
|
-
|
|
168726
|
-
|
|
168727
|
-
|
|
168728
|
-
if (!
|
|
168729
|
-
|
|
168730
|
-
|
|
168760
|
+
}
|
|
168761
|
+
scheduleUpdate(endpoint, entityId, states) {
|
|
168762
|
+
const state = states[entityId];
|
|
168763
|
+
if (!state) return;
|
|
168764
|
+
const key = endpoint === this ? `_parent_:${entityId}` : entityId;
|
|
168765
|
+
const stateJson = JSON.stringify({
|
|
168766
|
+
s: state.state,
|
|
168767
|
+
a: state.attributes
|
|
168768
|
+
});
|
|
168769
|
+
if (this.lastStates.get(key) === stateJson) return;
|
|
168770
|
+
this.lastStates.set(key, stateJson);
|
|
168771
|
+
let debouncedFn = this.debouncedUpdates.get(key);
|
|
168772
|
+
if (!debouncedFn) {
|
|
168773
|
+
debouncedFn = debounce2(
|
|
168774
|
+
(ep, s) => this.flushUpdate(ep, s),
|
|
168731
168775
|
50
|
|
168732
168776
|
);
|
|
168777
|
+
this.debouncedUpdates.set(key, debouncedFn);
|
|
168733
168778
|
}
|
|
168734
|
-
|
|
168779
|
+
debouncedFn(endpoint, state);
|
|
168735
168780
|
}
|
|
168736
|
-
async flushUpdate(state) {
|
|
168781
|
+
async flushUpdate(endpoint, state) {
|
|
168737
168782
|
try {
|
|
168738
|
-
await
|
|
168783
|
+
await endpoint.construction.ready;
|
|
168739
168784
|
} catch {
|
|
168740
168785
|
return;
|
|
168741
168786
|
}
|
|
168742
168787
|
try {
|
|
168743
|
-
const current =
|
|
168744
|
-
await
|
|
168745
|
-
entity: { ...current, state
|
|
168788
|
+
const current = endpoint.stateOf(HomeAssistantEntityBehavior).entity;
|
|
168789
|
+
await endpoint.setStateOf(HomeAssistantEntityBehavior, {
|
|
168790
|
+
entity: { ...current, state }
|
|
168746
168791
|
});
|
|
168747
168792
|
} catch (error) {
|
|
168748
168793
|
if (error instanceof TransactionDestroyedError || error instanceof DestroyedDependencyError) {
|
|
@@ -168758,7 +168803,9 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
|
|
|
168758
168803
|
}
|
|
168759
168804
|
}
|
|
168760
168805
|
async delete() {
|
|
168761
|
-
this.
|
|
168806
|
+
for (const fn of this.debouncedUpdates.values()) {
|
|
168807
|
+
fn.clear();
|
|
168808
|
+
}
|
|
168762
168809
|
await super.delete();
|
|
168763
168810
|
}
|
|
168764
168811
|
};
|
|
@@ -168843,7 +168890,7 @@ function PressureMeasurementServer2(config10) {
|
|
|
168843
168890
|
|
|
168844
168891
|
// src/matter/endpoints/composed/composed-sensor-endpoint.ts
|
|
168845
168892
|
var logger171 = Logger.get("ComposedSensorEndpoint");
|
|
168846
|
-
var
|
|
168893
|
+
var temperatureConfig2 = {
|
|
168847
168894
|
getValue(entity, agent) {
|
|
168848
168895
|
const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
|
|
168849
168896
|
const state = entity.state;
|
|
@@ -168856,7 +168903,7 @@ var temperatureConfig = {
|
|
|
168856
168903
|
);
|
|
168857
168904
|
}
|
|
168858
168905
|
};
|
|
168859
|
-
var
|
|
168906
|
+
var humidityConfig2 = {
|
|
168860
168907
|
getValue({ state }) {
|
|
168861
168908
|
if (state == null || Number.isNaN(+state)) return null;
|
|
168862
168909
|
return +state;
|
|
@@ -168883,15 +168930,15 @@ var batteryConfig2 = {
|
|
|
168883
168930
|
return null;
|
|
168884
168931
|
}
|
|
168885
168932
|
};
|
|
168886
|
-
var
|
|
168933
|
+
var TemperatureSubType2 = TemperatureSensorDevice.with(
|
|
168887
168934
|
IdentifyServer2,
|
|
168888
168935
|
HomeAssistantEntityBehavior,
|
|
168889
|
-
TemperatureMeasurementServer2(
|
|
168936
|
+
TemperatureMeasurementServer2(temperatureConfig2)
|
|
168890
168937
|
);
|
|
168891
|
-
var
|
|
168938
|
+
var HumiditySubType2 = HumiditySensorDevice.with(
|
|
168892
168939
|
IdentifyServer2,
|
|
168893
168940
|
HomeAssistantEntityBehavior,
|
|
168894
|
-
HumidityMeasurementServer(
|
|
168941
|
+
HumidityMeasurementServer(humidityConfig2)
|
|
168895
168942
|
);
|
|
168896
168943
|
var PressureSubType = PressureSensorDevice.with(
|
|
168897
168944
|
IdentifyServer2,
|
|
@@ -168947,7 +168994,7 @@ var ComposedSensorEndpoint = class _ComposedSensorEndpoint extends Endpoint {
|
|
|
168947
168994
|
const endpointId = createEndpointId3(primaryEntityId, config10.customName);
|
|
168948
168995
|
const parts = [];
|
|
168949
168996
|
const tempSub = new Endpoint(
|
|
168950
|
-
|
|
168997
|
+
TemperatureSubType2.set({
|
|
168951
168998
|
homeAssistantEntity: { entity: primaryPayload }
|
|
168952
168999
|
}),
|
|
168953
169000
|
{ id: `${endpointId}_temp` }
|
|
@@ -168958,7 +169005,7 @@ var ComposedSensorEndpoint = class _ComposedSensorEndpoint extends Endpoint {
|
|
|
168958
169005
|
const humPayload = buildEntityPayload2(registry2, config10.humidityEntityId);
|
|
168959
169006
|
if (humPayload) {
|
|
168960
169007
|
humSub = new Endpoint(
|
|
168961
|
-
|
|
169008
|
+
HumiditySubType2.set({
|
|
168962
169009
|
homeAssistantEntity: { entity: humPayload }
|
|
168963
169010
|
}),
|
|
168964
169011
|
{ id: `${endpointId}_humidity` }
|
|
@@ -169867,7 +169914,7 @@ var ClimateFanControlServer = FanControlServer2(config3).with(
|
|
|
169867
169914
|
);
|
|
169868
169915
|
|
|
169869
169916
|
// src/matter/endpoints/legacy/climate/behaviors/climate-humidity-measurement-server.ts
|
|
169870
|
-
var
|
|
169917
|
+
var humidityConfig3 = {
|
|
169871
169918
|
getValue(entity) {
|
|
169872
169919
|
const attributes7 = entity.attributes;
|
|
169873
169920
|
const humidity = attributes7.current_humidity;
|
|
@@ -169877,7 +169924,7 @@ var humidityConfig2 = {
|
|
|
169877
169924
|
return +humidity;
|
|
169878
169925
|
}
|
|
169879
169926
|
};
|
|
169880
|
-
var ClimateHumidityMeasurementServer = HumidityMeasurementServer(
|
|
169927
|
+
var ClimateHumidityMeasurementServer = HumidityMeasurementServer(humidityConfig3);
|
|
169881
169928
|
|
|
169882
169929
|
// src/matter/endpoints/legacy/climate/behaviors/climate-on-off-server.ts
|
|
169883
169930
|
var ClimateOnOffServer = OnOffServer2({
|
|
@@ -174965,7 +175012,7 @@ var Pm25SensorType = AirQualitySensorDevice.with(
|
|
|
174965
175012
|
|
|
174966
175013
|
// src/matter/endpoints/legacy/sensor/devices/temperature-humidity-sensor.ts
|
|
174967
175014
|
init_home_assistant_entity_behavior();
|
|
174968
|
-
var
|
|
175015
|
+
var temperatureConfig3 = {
|
|
174969
175016
|
getValue(entity, agent) {
|
|
174970
175017
|
const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
|
|
174971
175018
|
const state = entity.state;
|
|
@@ -174980,7 +175027,7 @@ var temperatureConfig2 = {
|
|
|
174980
175027
|
);
|
|
174981
175028
|
}
|
|
174982
175029
|
};
|
|
174983
|
-
var
|
|
175030
|
+
var humidityConfig4 = {
|
|
174984
175031
|
getValue(_entity, agent) {
|
|
174985
175032
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
174986
175033
|
const humidityEntity = homeAssistant.state.mapping?.humidityEntity;
|
|
@@ -175030,38 +175077,38 @@ var TemperatureHumiditySensorType = TemperatureSensorDevice.with(
|
|
|
175030
175077
|
BasicInformationServer2,
|
|
175031
175078
|
IdentifyServer2,
|
|
175032
175079
|
HomeAssistantEntityBehavior,
|
|
175033
|
-
TemperatureMeasurementServer2(
|
|
175034
|
-
HumidityMeasurementServer(
|
|
175080
|
+
TemperatureMeasurementServer2(temperatureConfig3),
|
|
175081
|
+
HumidityMeasurementServer(humidityConfig4)
|
|
175035
175082
|
);
|
|
175036
175083
|
var TemperatureHumiditySensorWithBatteryType = TemperatureSensorDevice.with(
|
|
175037
175084
|
BasicInformationServer2,
|
|
175038
175085
|
IdentifyServer2,
|
|
175039
175086
|
HomeAssistantEntityBehavior,
|
|
175040
|
-
TemperatureMeasurementServer2(
|
|
175041
|
-
HumidityMeasurementServer(
|
|
175087
|
+
TemperatureMeasurementServer2(temperatureConfig3),
|
|
175088
|
+
HumidityMeasurementServer(humidityConfig4),
|
|
175042
175089
|
PowerSourceServer2(batteryConfig4)
|
|
175043
175090
|
);
|
|
175044
175091
|
var TemperatureHumidityPressureSensorType = TemperatureSensorDevice.with(
|
|
175045
175092
|
BasicInformationServer2,
|
|
175046
175093
|
IdentifyServer2,
|
|
175047
175094
|
HomeAssistantEntityBehavior,
|
|
175048
|
-
TemperatureMeasurementServer2(
|
|
175049
|
-
HumidityMeasurementServer(
|
|
175095
|
+
TemperatureMeasurementServer2(temperatureConfig3),
|
|
175096
|
+
HumidityMeasurementServer(humidityConfig4),
|
|
175050
175097
|
PressureMeasurementServer2(pressureConfig2)
|
|
175051
175098
|
);
|
|
175052
175099
|
var TemperatureHumidityPressureSensorWithBatteryType = TemperatureSensorDevice.with(
|
|
175053
175100
|
BasicInformationServer2,
|
|
175054
175101
|
IdentifyServer2,
|
|
175055
175102
|
HomeAssistantEntityBehavior,
|
|
175056
|
-
TemperatureMeasurementServer2(
|
|
175057
|
-
HumidityMeasurementServer(
|
|
175103
|
+
TemperatureMeasurementServer2(temperatureConfig3),
|
|
175104
|
+
HumidityMeasurementServer(humidityConfig4),
|
|
175058
175105
|
PressureMeasurementServer2(pressureConfig2),
|
|
175059
175106
|
PowerSourceServer2(batteryConfig4)
|
|
175060
175107
|
);
|
|
175061
175108
|
|
|
175062
175109
|
// src/matter/endpoints/legacy/sensor/devices/temperature-pressure-sensor.ts
|
|
175063
175110
|
init_home_assistant_entity_behavior();
|
|
175064
|
-
var
|
|
175111
|
+
var temperatureConfig4 = {
|
|
175065
175112
|
getValue(entity, agent) {
|
|
175066
175113
|
const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
|
|
175067
175114
|
const state = entity.state;
|
|
@@ -175112,14 +175159,14 @@ var TemperaturePressureSensorType = TemperatureSensorDevice.with(
|
|
|
175112
175159
|
BasicInformationServer2,
|
|
175113
175160
|
IdentifyServer2,
|
|
175114
175161
|
HomeAssistantEntityBehavior,
|
|
175115
|
-
TemperatureMeasurementServer2(
|
|
175162
|
+
TemperatureMeasurementServer2(temperatureConfig4),
|
|
175116
175163
|
PressureMeasurementServer2(pressureConfig3)
|
|
175117
175164
|
);
|
|
175118
175165
|
var TemperaturePressureSensorWithBatteryType = TemperatureSensorDevice.with(
|
|
175119
175166
|
BasicInformationServer2,
|
|
175120
175167
|
IdentifyServer2,
|
|
175121
175168
|
HomeAssistantEntityBehavior,
|
|
175122
|
-
TemperatureMeasurementServer2(
|
|
175169
|
+
TemperatureMeasurementServer2(temperatureConfig4),
|
|
175123
175170
|
PressureMeasurementServer2(pressureConfig3),
|
|
175124
175171
|
PowerSourceServer2(batteryConfig5)
|
|
175125
175172
|
);
|
|
@@ -179156,6 +179203,23 @@ var BridgeRegistry = class _BridgeRegistry {
|
|
|
179156
179203
|
);
|
|
179157
179204
|
return [];
|
|
179158
179205
|
}
|
|
179206
|
+
let validSegmentIds;
|
|
179207
|
+
try {
|
|
179208
|
+
const segmentsResponse = await this.client.connection.sendMessagePromise({
|
|
179209
|
+
type: "vacuum/get_segments",
|
|
179210
|
+
entity_id: entityId
|
|
179211
|
+
});
|
|
179212
|
+
if (Array.isArray(segmentsResponse)) {
|
|
179213
|
+
validSegmentIds = new Set(segmentsResponse.map((s) => s.id));
|
|
179214
|
+
_BridgeRegistry.cleanAreaLogger.debug(
|
|
179215
|
+
`${entityId}: Current vacuum segments: ${[...validSegmentIds].join(", ")}`
|
|
179216
|
+
);
|
|
179217
|
+
}
|
|
179218
|
+
} catch {
|
|
179219
|
+
_BridgeRegistry.cleanAreaLogger.debug(
|
|
179220
|
+
`${entityId}: vacuum/get_segments not available, skipping stale entry detection`
|
|
179221
|
+
);
|
|
179222
|
+
}
|
|
179159
179223
|
const rooms = [];
|
|
179160
179224
|
for (const haAreaId of Object.keys(areaMapping)) {
|
|
179161
179225
|
const segments = areaMapping[haAreaId];
|
|
@@ -179165,6 +179229,13 @@ var BridgeRegistry = class _BridgeRegistry {
|
|
|
179165
179229
|
);
|
|
179166
179230
|
continue;
|
|
179167
179231
|
}
|
|
179232
|
+
if (validSegmentIds && !segments.some((sid) => validSegmentIds.has(sid))) {
|
|
179233
|
+
const areaName2 = this.registry.areas.get(haAreaId) ?? haAreaId;
|
|
179234
|
+
_BridgeRegistry.cleanAreaLogger.info(
|
|
179235
|
+
`${entityId}: Skipping stale HA area "${areaName2}" (${haAreaId}) \u2014 segments [${segments.join(", ")}] no longer exist on vacuum`
|
|
179236
|
+
);
|
|
179237
|
+
continue;
|
|
179238
|
+
}
|
|
179168
179239
|
const areaName = this.registry.areas.get(haAreaId) ?? haAreaId;
|
|
179169
179240
|
rooms.push({
|
|
179170
179241
|
areaId: hashAreaId(haAreaId),
|