@riddix/hamh 2.1.0-alpha.831 → 2.1.0-alpha.832
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
|
@@ -130689,7 +130689,14 @@ var init_controller_compat = __esm({
|
|
|
130689
130689
|
google: "no",
|
|
130690
130690
|
alexa: "unknown",
|
|
130691
130691
|
aqara: "unknown",
|
|
130692
|
-
note: "
|
|
130692
|
+
note: "SolarPower is only rendered standalone by SmartThings today."
|
|
130693
|
+
},
|
|
130694
|
+
1300: {
|
|
130695
|
+
apple: "no",
|
|
130696
|
+
google: "yes",
|
|
130697
|
+
alexa: "no",
|
|
130698
|
+
aqara: "unknown",
|
|
130699
|
+
note: "ElectricalMeter shows in Google Home and SmartThings; Apple and Alexa do not surface standalone power/energy."
|
|
130693
130700
|
},
|
|
130694
130701
|
24: {
|
|
130695
130702
|
apple: "no",
|
|
@@ -132628,6 +132635,10 @@ WARNING: ${includeIdentity ? "This backup contains sensitive Matter identity dat
|
|
|
132628
132635
|
lockPinMaxLength: config11.lockPinMaxLength,
|
|
132629
132636
|
powerEntity: config11.powerEntity,
|
|
132630
132637
|
energyEntity: config11.energyEntity,
|
|
132638
|
+
voltageEntity: config11.voltageEntity,
|
|
132639
|
+
currentEntity: config11.currentEntity,
|
|
132640
|
+
batteryPowerEntity: config11.batteryPowerEntity,
|
|
132641
|
+
batteryEnergyEntity: config11.batteryEnergyEntity,
|
|
132631
132642
|
suctionLevelEntity: config11.suctionLevelEntity,
|
|
132632
132643
|
mopIntensityEntity: config11.mopIntensityEntity,
|
|
132633
132644
|
valetudoIdentifier: config11.valetudoIdentifier,
|
|
@@ -132785,6 +132796,10 @@ WARNING: ${includeIdentity ? "This backup contains sensitive Matter identity dat
|
|
|
132785
132796
|
lockPinMaxLength: config11.lockPinMaxLength,
|
|
132786
132797
|
powerEntity: config11.powerEntity,
|
|
132787
132798
|
energyEntity: config11.energyEntity,
|
|
132799
|
+
voltageEntity: config11.voltageEntity,
|
|
132800
|
+
currentEntity: config11.currentEntity,
|
|
132801
|
+
batteryPowerEntity: config11.batteryPowerEntity,
|
|
132802
|
+
batteryEnergyEntity: config11.batteryEnergyEntity,
|
|
132788
132803
|
suctionLevelEntity: config11.suctionLevelEntity,
|
|
132789
132804
|
mopIntensityEntity: config11.mopIntensityEntity,
|
|
132790
132805
|
temperatureEntity: config11.temperatureEntity,
|
|
@@ -133633,6 +133648,10 @@ function entityMappingApi(mappingStorage, identityStorage) {
|
|
|
133633
133648
|
lockPinMaxLength: body.lockPinMaxLength,
|
|
133634
133649
|
powerEntity: body.powerEntity,
|
|
133635
133650
|
energyEntity: body.energyEntity,
|
|
133651
|
+
voltageEntity: body.voltageEntity,
|
|
133652
|
+
currentEntity: body.currentEntity,
|
|
133653
|
+
batteryPowerEntity: body.batteryPowerEntity,
|
|
133654
|
+
batteryEnergyEntity: body.batteryEnergyEntity,
|
|
133636
133655
|
suctionLevelEntity: body.suctionLevelEntity,
|
|
133637
133656
|
mopIntensityEntity: body.mopIntensityEntity,
|
|
133638
133657
|
customServiceAreas: body.customServiceAreas,
|
|
@@ -134130,6 +134149,10 @@ function configToProfileEntry(config11) {
|
|
|
134130
134149
|
lockPinMaxLength: config11.lockPinMaxLength,
|
|
134131
134150
|
powerEntity: config11.powerEntity,
|
|
134132
134151
|
energyEntity: config11.energyEntity,
|
|
134152
|
+
voltageEntity: config11.voltageEntity,
|
|
134153
|
+
currentEntity: config11.currentEntity,
|
|
134154
|
+
batteryPowerEntity: config11.batteryPowerEntity,
|
|
134155
|
+
batteryEnergyEntity: config11.batteryEnergyEntity,
|
|
134133
134156
|
suctionLevelEntity: config11.suctionLevelEntity,
|
|
134134
134157
|
mopIntensityEntity: config11.mopIntensityEntity,
|
|
134135
134158
|
customServiceAreas: config11.customServiceAreas,
|
|
@@ -134265,6 +134288,10 @@ function mappingProfileApi(mappingStorage) {
|
|
|
134265
134288
|
lockPinMaxLength: entry.lockPinMaxLength,
|
|
134266
134289
|
powerEntity: entry.powerEntity,
|
|
134267
134290
|
energyEntity: entry.energyEntity,
|
|
134291
|
+
voltageEntity: entry.voltageEntity,
|
|
134292
|
+
currentEntity: entry.currentEntity,
|
|
134293
|
+
batteryPowerEntity: entry.batteryPowerEntity,
|
|
134294
|
+
batteryEnergyEntity: entry.batteryEnergyEntity,
|
|
134268
134295
|
suctionLevelEntity: entry.suctionLevelEntity,
|
|
134269
134296
|
mopIntensityEntity: entry.mopIntensityEntity,
|
|
134270
134297
|
customServiceAreas: entry.customServiceAreas,
|
|
@@ -138581,6 +138608,10 @@ var EntityMappingStorage = class extends Service {
|
|
|
138581
138608
|
lockPinMaxLength: pinLengths.max,
|
|
138582
138609
|
powerEntity: request.powerEntity?.trim() || void 0,
|
|
138583
138610
|
energyEntity: request.energyEntity?.trim() || void 0,
|
|
138611
|
+
voltageEntity: request.voltageEntity?.trim() || void 0,
|
|
138612
|
+
currentEntity: request.currentEntity?.trim() || void 0,
|
|
138613
|
+
batteryPowerEntity: request.batteryPowerEntity?.trim() || void 0,
|
|
138614
|
+
batteryEnergyEntity: request.batteryEnergyEntity?.trim() || void 0,
|
|
138584
138615
|
pressureEntity: request.pressureEntity?.trim() || void 0,
|
|
138585
138616
|
suctionLevelEntity: request.suctionLevelEntity?.trim() || void 0,
|
|
138586
138617
|
mopIntensityEntity: request.mopIntensityEntity?.trim() || void 0,
|
|
@@ -138609,7 +138640,7 @@ var EntityMappingStorage = class extends Service {
|
|
|
138609
138640
|
composedEntities: request.composedEntities?.filter((e) => e.entityId?.trim()) ?? void 0,
|
|
138610
138641
|
disableMomentaryFlip: request.disableMomentaryFlip || void 0
|
|
138611
138642
|
};
|
|
138612
|
-
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.disableBatteryMapping && !config11.chargingStateEntity && !config11.roomEntities && !config11.disableLockPin && !config11.lockUsercodeService && config11.lockUsercodeSlot === void 0 && config11.lockPinMinLength === void 0 && config11.lockPinMaxLength === void 0 && !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.fanWindPresets || (config11.fanWindPresets.natural?.length ?? 0) === 0 && (config11.fanWindPresets.sleep?.length ?? 0) === 0) && !config11.fanRestoreSpeedOnPowerOn && !config11.currentRoomEntity && !config11.cleanedAreaEntity && !config11.disableCustomAreaRoomModes && !config11.valetudoIdentifier && !config11.coverSwapOpenClose && !config11.coverExposeAsDimmableLight && !config11.selectExposeAsSwitch && !config11.selectSwitchOnOption && !config11.selectSwitchOffOption && !config11.coverSliderDebounceMs && !config11.updateThrottleMs && !config11.disableClimateOnOff && !config11.disableClimateFanControl && !config11.climateKeepModeOnIdle && !config11.climateExposeFan && !config11.climateAutoMode && (!config11.composedEntities || config11.composedEntities.length === 0) && !config11.disableMomentaryFlip) {
|
|
138643
|
+
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.disableBatteryMapping && !config11.chargingStateEntity && !config11.roomEntities && !config11.disableLockPin && !config11.lockUsercodeService && config11.lockUsercodeSlot === void 0 && config11.lockPinMinLength === void 0 && config11.lockPinMaxLength === void 0 && !config11.powerEntity && !config11.energyEntity && !config11.voltageEntity && !config11.currentEntity && !config11.batteryPowerEntity && !config11.batteryEnergyEntity && !config11.pressureEntity && !config11.suctionLevelEntity && !config11.mopIntensityEntity && (!config11.customServiceAreas || config11.customServiceAreas.length === 0) && (!config11.customFanSpeedTags || Object.keys(config11.customFanSpeedTags).length === 0) && (!config11.fanWindPresets || (config11.fanWindPresets.natural?.length ?? 0) === 0 && (config11.fanWindPresets.sleep?.length ?? 0) === 0) && !config11.fanRestoreSpeedOnPowerOn && !config11.currentRoomEntity && !config11.cleanedAreaEntity && !config11.disableCustomAreaRoomModes && !config11.valetudoIdentifier && !config11.coverSwapOpenClose && !config11.coverExposeAsDimmableLight && !config11.selectExposeAsSwitch && !config11.selectSwitchOnOption && !config11.selectSwitchOffOption && !config11.coverSliderDebounceMs && !config11.updateThrottleMs && !config11.disableClimateOnOff && !config11.disableClimateFanControl && !config11.climateKeepModeOnIdle && !config11.climateExposeFan && !config11.climateAutoMode && (!config11.composedEntities || config11.composedEntities.length === 0) && !config11.disableMomentaryFlip) {
|
|
138613
138644
|
bridgeMap.delete(request.entityId);
|
|
138614
138645
|
} else {
|
|
138615
138646
|
bridgeMap.set(request.entityId, config11);
|
|
@@ -148423,6 +148454,7 @@ var ElectricalMeterDeviceDefinition = MutableEndpoint({
|
|
|
148423
148454
|
behaviors: SupportedBehaviors()
|
|
148424
148455
|
});
|
|
148425
148456
|
Object.freeze(ElectricalMeterDeviceDefinition);
|
|
148457
|
+
var ElectricalMeterDevice = ElectricalMeterDeviceDefinition;
|
|
148426
148458
|
|
|
148427
148459
|
// ../../node_modules/.pnpm/@matter+types@0.17.5/node_modules/@matter/types/dist/esm/clusters/meter-identification.js
|
|
148428
148460
|
init_ClusterType();
|
|
@@ -157144,6 +157176,10 @@ function getMappedEntityIds(mapping) {
|
|
|
157144
157176
|
if (mapping.filterLifeEntity) ids.push(mapping.filterLifeEntity);
|
|
157145
157177
|
if (mapping.powerEntity) ids.push(mapping.powerEntity);
|
|
157146
157178
|
if (mapping.energyEntity) ids.push(mapping.energyEntity);
|
|
157179
|
+
if (mapping.voltageEntity) ids.push(mapping.voltageEntity);
|
|
157180
|
+
if (mapping.currentEntity) ids.push(mapping.currentEntity);
|
|
157181
|
+
if (mapping.batteryPowerEntity) ids.push(mapping.batteryPowerEntity);
|
|
157182
|
+
if (mapping.batteryEnergyEntity) ids.push(mapping.batteryEnergyEntity);
|
|
157147
157183
|
if (mapping.currentRoomEntity) ids.push(mapping.currentRoomEntity);
|
|
157148
157184
|
if (mapping.cleanedAreaEntity) ids.push(mapping.cleanedAreaEntity);
|
|
157149
157185
|
if (mapping.composedEntities) {
|
|
@@ -157586,7 +157622,8 @@ var HaElectricalEnergyMeasurementServer = ElectricalEnergyMeasurementServerBase.
|
|
|
157586
157622
|
init_esm();
|
|
157587
157623
|
init_home_assistant_entity_behavior();
|
|
157588
157624
|
var logger203 = Logger.get("ElectricalPowerMeasurementServer");
|
|
157589
|
-
var
|
|
157625
|
+
var FeaturedBase2 = ElectricalPowerMeasurementServer.with("AlternatingCurrent");
|
|
157626
|
+
var ElectricalPowerMeasurementServerBase = class extends FeaturedBase2 {
|
|
157590
157627
|
async initialize() {
|
|
157591
157628
|
await super.initialize();
|
|
157592
157629
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -157602,23 +157639,38 @@ var ElectricalPowerMeasurementServerBase = class extends ElectricalPowerMeasurem
|
|
|
157602
157639
|
}
|
|
157603
157640
|
update() {
|
|
157604
157641
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
157605
|
-
const
|
|
157606
|
-
|
|
157642
|
+
const mapping = homeAssistant.state.mapping;
|
|
157643
|
+
const powerEntity = mapping?.powerEntity;
|
|
157644
|
+
const voltageEntity = mapping?.voltageEntity;
|
|
157645
|
+
const currentEntity = mapping?.currentEntity;
|
|
157646
|
+
if (!powerEntity && !voltageEntity && !currentEntity) return;
|
|
157607
157647
|
const stateProvider = this.agent.env.get(EntityStateProvider);
|
|
157608
|
-
const
|
|
157609
|
-
if (
|
|
157610
|
-
|
|
157611
|
-
|
|
157648
|
+
const patch = {};
|
|
157649
|
+
if (powerEntity) {
|
|
157650
|
+
const powerWatts = stateProvider.getNumericState(powerEntity);
|
|
157651
|
+
if (powerWatts != null) patch.activePower = Math.round(powerWatts * 1e3);
|
|
157652
|
+
}
|
|
157653
|
+
if (voltageEntity) {
|
|
157654
|
+
const volts = stateProvider.getNumericState(voltageEntity);
|
|
157655
|
+
if (volts != null) patch.voltage = Math.round(volts * 1e3);
|
|
157656
|
+
}
|
|
157657
|
+
if (currentEntity) {
|
|
157658
|
+
const amps = stateProvider.getNumericState(currentEntity);
|
|
157659
|
+
if (amps != null) patch.activeCurrent = Math.round(amps * 1e3);
|
|
157660
|
+
}
|
|
157661
|
+
if (Object.keys(patch).length > 0) applyPatchState(this.state, patch);
|
|
157612
157662
|
}
|
|
157613
157663
|
};
|
|
157614
157664
|
((ElectricalPowerMeasurementServerBase2) => {
|
|
157615
|
-
class State extends
|
|
157665
|
+
class State extends FeaturedBase2.State {
|
|
157616
157666
|
}
|
|
157617
157667
|
ElectricalPowerMeasurementServerBase2.State = State;
|
|
157618
157668
|
})(ElectricalPowerMeasurementServerBase || (ElectricalPowerMeasurementServerBase = {}));
|
|
157619
157669
|
var HaElectricalPowerMeasurementServer = ElectricalPowerMeasurementServerBase.set({
|
|
157620
157670
|
powerMode: ElectricalPowerMeasurement3.PowerMode.Ac,
|
|
157621
|
-
|
|
157671
|
+
// Voltage and current are folded onto this endpoint when mapped, so the
|
|
157672
|
+
// accuracy list carries an entry for each reported measurement type.
|
|
157673
|
+
numberOfMeasurementTypes: 3,
|
|
157622
157674
|
accuracy: [
|
|
157623
157675
|
{
|
|
157624
157676
|
measurementType: ElectricalPowerMeasurement3.MeasurementType.ActivePower,
|
|
@@ -157635,6 +157687,37 @@ var HaElectricalPowerMeasurementServer = ElectricalPowerMeasurementServerBase.se
|
|
|
157635
157687
|
// 1W accuracy
|
|
157636
157688
|
}
|
|
157637
157689
|
]
|
|
157690
|
+
},
|
|
157691
|
+
{
|
|
157692
|
+
measurementType: ElectricalPowerMeasurement3.MeasurementType.Voltage,
|
|
157693
|
+
measured: true,
|
|
157694
|
+
minMeasuredValue: 0,
|
|
157695
|
+
maxMeasuredValue: 1e6,
|
|
157696
|
+
// 1000V in mV
|
|
157697
|
+
accuracyRanges: [
|
|
157698
|
+
{
|
|
157699
|
+
rangeMin: 0,
|
|
157700
|
+
rangeMax: 1e6,
|
|
157701
|
+
fixedMax: 1e3
|
|
157702
|
+
// 1V accuracy
|
|
157703
|
+
}
|
|
157704
|
+
]
|
|
157705
|
+
},
|
|
157706
|
+
{
|
|
157707
|
+
measurementType: ElectricalPowerMeasurement3.MeasurementType.ActiveCurrent,
|
|
157708
|
+
measured: true,
|
|
157709
|
+
minMeasuredValue: -1e6,
|
|
157710
|
+
// -1000A in mA
|
|
157711
|
+
maxMeasuredValue: 1e6,
|
|
157712
|
+
// 1000A in mA
|
|
157713
|
+
accuracyRanges: [
|
|
157714
|
+
{
|
|
157715
|
+
rangeMin: -1e6,
|
|
157716
|
+
rangeMax: 1e6,
|
|
157717
|
+
fixedMax: 1e3
|
|
157718
|
+
// 1A accuracy
|
|
157719
|
+
}
|
|
157720
|
+
]
|
|
157638
157721
|
}
|
|
157639
157722
|
]
|
|
157640
157723
|
});
|
|
@@ -157730,8 +157813,8 @@ function HumidityMeasurementServer(config11) {
|
|
|
157730
157813
|
init_esm();
|
|
157731
157814
|
init_home_assistant_entity_behavior();
|
|
157732
157815
|
var logger205 = Logger.get("PowerSourceServer");
|
|
157733
|
-
var
|
|
157734
|
-
var PowerSourceServerBase = class extends
|
|
157816
|
+
var FeaturedBase3 = PowerSourceServer.with("Battery", "Rechargeable");
|
|
157817
|
+
var PowerSourceServerBase = class extends FeaturedBase3 {
|
|
157735
157818
|
async initialize() {
|
|
157736
157819
|
await super.initialize();
|
|
157737
157820
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -157809,7 +157892,7 @@ var PowerSourceServerBase = class extends FeaturedBase2 {
|
|
|
157809
157892
|
}
|
|
157810
157893
|
};
|
|
157811
157894
|
((PowerSourceServerBase2) => {
|
|
157812
|
-
class State extends
|
|
157895
|
+
class State extends FeaturedBase3.State {
|
|
157813
157896
|
config;
|
|
157814
157897
|
}
|
|
157815
157898
|
PowerSourceServerBase2.State = State;
|
|
@@ -157890,8 +157973,8 @@ function TemperatureMeasurementServer2(config11) {
|
|
|
157890
157973
|
|
|
157891
157974
|
// src/matter/behaviors/hepa-filter-monitoring-server.ts
|
|
157892
157975
|
init_home_assistant_entity_behavior();
|
|
157893
|
-
var
|
|
157894
|
-
var HepaFilterMonitoringServerBase = class extends
|
|
157976
|
+
var FeaturedBase4 = HepaFilterMonitoringServer.with("Condition", "Warning");
|
|
157977
|
+
var HepaFilterMonitoringServerBase = class extends FeaturedBase4 {
|
|
157895
157978
|
async initialize() {
|
|
157896
157979
|
this.state.condition = 100;
|
|
157897
157980
|
this.state.degradationDirection = ResourceMonitoring3.DegradationDirection.Down;
|
|
@@ -157928,7 +158011,7 @@ var HepaFilterMonitoringServerBase = class extends FeaturedBase3 {
|
|
|
157928
158011
|
}
|
|
157929
158012
|
};
|
|
157930
158013
|
((HepaFilterMonitoringServerBase2) => {
|
|
157931
|
-
class State extends
|
|
158014
|
+
class State extends FeaturedBase4.State {
|
|
157932
158015
|
config;
|
|
157933
158016
|
}
|
|
157934
158017
|
HepaFilterMonitoringServerBase2.State = State;
|
|
@@ -158186,8 +158269,8 @@ function notifyLightTurnedOn(entityId) {
|
|
|
158186
158269
|
lastTurnOnTimestamps.set(entityId, now);
|
|
158187
158270
|
}
|
|
158188
158271
|
var logger206 = Logger.get("LevelControlServer");
|
|
158189
|
-
var
|
|
158190
|
-
var LevelControlServerBase = class extends
|
|
158272
|
+
var FeaturedBase5 = LevelControlServer.with("OnOff", "Lighting");
|
|
158273
|
+
var LevelControlServerBase = class extends FeaturedBase5 {
|
|
158191
158274
|
pendingTransitionTime;
|
|
158192
158275
|
async initialize() {
|
|
158193
158276
|
if (this.state.currentLevel == null) {
|
|
@@ -158344,7 +158427,7 @@ var LevelControlServerBase = class extends FeaturedBase4 {
|
|
|
158344
158427
|
}
|
|
158345
158428
|
};
|
|
158346
158429
|
((LevelControlServerBase2) => {
|
|
158347
|
-
class State extends
|
|
158430
|
+
class State extends FeaturedBase5.State {
|
|
158348
158431
|
config;
|
|
158349
158432
|
}
|
|
158350
158433
|
LevelControlServerBase2.State = State;
|
|
@@ -158486,7 +158569,7 @@ var logger208 = Logger.get("FanControlServer");
|
|
|
158486
158569
|
var defaultStepSize = 33.33;
|
|
158487
158570
|
var minSpeedMax = 3;
|
|
158488
158571
|
var maxSpeedMax = 100;
|
|
158489
|
-
var
|
|
158572
|
+
var FeaturedBase6 = FanControlServer.with(
|
|
158490
158573
|
"Step",
|
|
158491
158574
|
"MultiSpeed",
|
|
158492
158575
|
"AirflowDirection",
|
|
@@ -158496,7 +158579,7 @@ var FeaturedBase5 = FanControlServer.with(
|
|
|
158496
158579
|
).set({
|
|
158497
158580
|
windSupport: { naturalWind: true, sleepWind: true }
|
|
158498
158581
|
});
|
|
158499
|
-
var FanControlServerBase = class extends
|
|
158582
|
+
var FanControlServerBase = class extends FeaturedBase6 {
|
|
158500
158583
|
// Fallback last-speed tracking for endpoints without FanSpeedMemoryBehavior
|
|
158501
158584
|
// (climate companion, humidifier). matter.js builds behavior instances per
|
|
158502
158585
|
// transaction, so these fields only live within one interaction; fans use
|
|
@@ -158949,7 +159032,7 @@ var FanControlServerBase = class extends FeaturedBase5 {
|
|
|
158949
159032
|
}
|
|
158950
159033
|
};
|
|
158951
159034
|
((FanControlServerBase2) => {
|
|
158952
|
-
class State extends
|
|
159035
|
+
class State extends FeaturedBase6.State {
|
|
158953
159036
|
config;
|
|
158954
159037
|
}
|
|
158955
159038
|
FanControlServerBase2.State = State;
|
|
@@ -161951,7 +162034,7 @@ init_home_assistant_actions();
|
|
|
161951
162034
|
init_home_assistant_entity_behavior();
|
|
161952
162035
|
var logger216 = Logger.get("WindowCoveringServer");
|
|
161953
162036
|
var MovementStatus = WindowCovering3.MovementStatus;
|
|
161954
|
-
var
|
|
162037
|
+
var FeaturedBase7 = WindowCoveringServer.with(
|
|
161955
162038
|
"Lift",
|
|
161956
162039
|
"PositionAwareLift",
|
|
161957
162040
|
"Tilt",
|
|
@@ -161987,7 +162070,7 @@ function clearPendingTilt(st) {
|
|
|
161987
162070
|
}
|
|
161988
162071
|
st.pendingTilt = null;
|
|
161989
162072
|
}
|
|
161990
|
-
var WindowCoveringServerBase = class _WindowCoveringServerBase extends
|
|
162073
|
+
var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedBase7 {
|
|
161991
162074
|
// Written and read within one synchronous command (upOrOpen fires lift then
|
|
161992
162075
|
// tilt on the same instance), so these stay as instance fields (#246).
|
|
161993
162076
|
lastLiftMovementMs = 0;
|
|
@@ -162296,7 +162379,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
162296
162379
|
}
|
|
162297
162380
|
};
|
|
162298
162381
|
((WindowCoveringServerBase2) => {
|
|
162299
|
-
class State extends
|
|
162382
|
+
class State extends FeaturedBase7.State {
|
|
162300
162383
|
config;
|
|
162301
162384
|
}
|
|
162302
162385
|
WindowCoveringServerBase2.State = State;
|
|
@@ -164008,8 +164091,8 @@ function consumePendingColorStaging(entityId) {
|
|
|
164008
164091
|
pendingColorStaging.delete(entityId);
|
|
164009
164092
|
return data;
|
|
164010
164093
|
}
|
|
164011
|
-
var
|
|
164012
|
-
var ColorControlServerBase = class extends
|
|
164094
|
+
var FeaturedBase8 = ColorControlServer.with("ColorTemperature", "HueSaturation", "Xy");
|
|
164095
|
+
var ColorControlServerBase = class extends FeaturedBase8 {
|
|
164013
164096
|
pendingTransitionTime;
|
|
164014
164097
|
async [Symbol.asyncDispose]() {
|
|
164015
164098
|
const entityId = this.agent.get(HomeAssistantEntityBehavior).entityId;
|
|
@@ -164354,7 +164437,7 @@ var ColorControlServerBase = class extends FeaturedBase7 {
|
|
|
164354
164437
|
}
|
|
164355
164438
|
};
|
|
164356
164439
|
((ColorControlServerBase2) => {
|
|
164357
|
-
class State extends
|
|
164440
|
+
class State extends FeaturedBase8.State {
|
|
164358
164441
|
config;
|
|
164359
164442
|
}
|
|
164360
164443
|
ColorControlServerBase2.State = State;
|
|
@@ -164571,11 +164654,12 @@ function LightDevice(homeAssistantEntity) {
|
|
|
164571
164654
|
) : supportsBrightness ? hasBattery ? DimmableLightWithBatteryType : DimmableLightType : hasBattery ? OnOffLightWithBatteryType : OnOffLightType;
|
|
164572
164655
|
const hasPowerEntity = !!homeAssistantEntity.mapping?.powerEntity;
|
|
164573
164656
|
const hasEnergyEntity = !!homeAssistantEntity.mapping?.energyEntity;
|
|
164657
|
+
const hasElectricalPower = hasPowerEntity || !!homeAssistantEntity.mapping?.voltageEntity || !!homeAssistantEntity.mapping?.currentEntity;
|
|
164574
164658
|
let device = deviceType;
|
|
164575
|
-
if (
|
|
164659
|
+
if (hasElectricalPower || hasEnergyEntity) {
|
|
164576
164660
|
device = device.with(HaPowerTopologyServer);
|
|
164577
164661
|
}
|
|
164578
|
-
if (
|
|
164662
|
+
if (hasElectricalPower) {
|
|
164579
164663
|
device = device.with(HaElectricalPowerMeasurementServer);
|
|
164580
164664
|
}
|
|
164581
164665
|
if (hasEnergyEntity) {
|
|
@@ -165607,8 +165691,8 @@ function sweepOptimisticLevel2(now) {
|
|
|
165607
165691
|
}
|
|
165608
165692
|
}
|
|
165609
165693
|
}
|
|
165610
|
-
var
|
|
165611
|
-
var SpeakerLevelControlServerBase = class extends
|
|
165694
|
+
var FeaturedBase9 = LevelControlServer.with("OnOff");
|
|
165695
|
+
var SpeakerLevelControlServerBase = class extends FeaturedBase9 {
|
|
165612
165696
|
async initialize() {
|
|
165613
165697
|
if (this.state.currentLevel == null) {
|
|
165614
165698
|
this.state.currentLevel = 0;
|
|
@@ -165710,7 +165794,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
|
|
|
165710
165794
|
}
|
|
165711
165795
|
};
|
|
165712
165796
|
((SpeakerLevelControlServerBase2) => {
|
|
165713
|
-
class State extends
|
|
165797
|
+
class State extends FeaturedBase9.State {
|
|
165714
165798
|
config;
|
|
165715
165799
|
}
|
|
165716
165800
|
SpeakerLevelControlServerBase2.State = State;
|
|
@@ -166144,6 +166228,126 @@ var BatterySensorType = BatteryStorageDevice.with(
|
|
|
166144
166228
|
})
|
|
166145
166229
|
);
|
|
166146
166230
|
|
|
166231
|
+
// src/matter/endpoints/legacy/sensor/devices/battery-storage-ess.ts
|
|
166232
|
+
init_home_assistant_entity_behavior();
|
|
166233
|
+
var PowerFeaturedBase = ElectricalPowerMeasurementServer.with("DirectCurrent");
|
|
166234
|
+
var EssPowerServer = class extends PowerFeaturedBase {
|
|
166235
|
+
async initialize() {
|
|
166236
|
+
await super.initialize();
|
|
166237
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
166238
|
+
this.update();
|
|
166239
|
+
this.reactTo(homeAssistant.onChange, this.update, { offline: true });
|
|
166240
|
+
}
|
|
166241
|
+
update() {
|
|
166242
|
+
const mapping = this.agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
166243
|
+
const powerEntity = mapping?.batteryPowerEntity;
|
|
166244
|
+
if (!powerEntity) return;
|
|
166245
|
+
const stateProvider = this.agent.env.get(EntityStateProvider);
|
|
166246
|
+
const watts = stateProvider.getNumericState(powerEntity);
|
|
166247
|
+
if (watts == null) return;
|
|
166248
|
+
applyPatchState(this.state, { activePower: Math.round(watts * -1e3) });
|
|
166249
|
+
}
|
|
166250
|
+
};
|
|
166251
|
+
((EssPowerServer2) => {
|
|
166252
|
+
class State extends PowerFeaturedBase.State {
|
|
166253
|
+
}
|
|
166254
|
+
EssPowerServer2.State = State;
|
|
166255
|
+
})(EssPowerServer || (EssPowerServer = {}));
|
|
166256
|
+
var EssPower = EssPowerServer.set({
|
|
166257
|
+
powerMode: ElectricalPowerMeasurement3.PowerMode.Dc,
|
|
166258
|
+
numberOfMeasurementTypes: 1,
|
|
166259
|
+
// Seed 0 so the cluster reports a value before the first update (SmartThings).
|
|
166260
|
+
activePower: 0,
|
|
166261
|
+
accuracy: [
|
|
166262
|
+
{
|
|
166263
|
+
measurementType: ElectricalPowerMeasurement3.MeasurementType.ActivePower,
|
|
166264
|
+
measured: true,
|
|
166265
|
+
// Wide symmetric range: batteries both charge (negative) and discharge.
|
|
166266
|
+
minMeasuredValue: -1e8,
|
|
166267
|
+
maxMeasuredValue: 1e8,
|
|
166268
|
+
accuracyRanges: [
|
|
166269
|
+
{
|
|
166270
|
+
rangeMin: -1e8,
|
|
166271
|
+
rangeMax: 1e8,
|
|
166272
|
+
fixedMax: 1e3
|
|
166273
|
+
}
|
|
166274
|
+
]
|
|
166275
|
+
}
|
|
166276
|
+
]
|
|
166277
|
+
});
|
|
166278
|
+
var EnergyFeaturedBase = ElectricalEnergyMeasurementServer.with(
|
|
166279
|
+
"CumulativeEnergy",
|
|
166280
|
+
"ImportedEnergy"
|
|
166281
|
+
);
|
|
166282
|
+
var EssEnergyServer = class extends EnergyFeaturedBase {
|
|
166283
|
+
async initialize() {
|
|
166284
|
+
await super.initialize();
|
|
166285
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
166286
|
+
this.update();
|
|
166287
|
+
this.reactTo(homeAssistant.onChange, this.update, { offline: true });
|
|
166288
|
+
}
|
|
166289
|
+
update() {
|
|
166290
|
+
const mapping = this.agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
166291
|
+
const energyEntity = mapping?.batteryEnergyEntity;
|
|
166292
|
+
if (!energyEntity) return;
|
|
166293
|
+
const stateProvider = this.agent.env.get(EntityStateProvider);
|
|
166294
|
+
const kwh = stateProvider.getNumericState(energyEntity);
|
|
166295
|
+
if (kwh == null) return;
|
|
166296
|
+
const energyImported = { energy: Math.round(kwh * 1e6) };
|
|
166297
|
+
const changed = applyPatchState(this.state, {
|
|
166298
|
+
cumulativeEnergyImported: energyImported
|
|
166299
|
+
});
|
|
166300
|
+
if ("cumulativeEnergyImported" in changed) {
|
|
166301
|
+
this.events.cumulativeEnergyMeasured?.emit(
|
|
166302
|
+
{ energyImported, energyExported: void 0 },
|
|
166303
|
+
this.context
|
|
166304
|
+
);
|
|
166305
|
+
}
|
|
166306
|
+
}
|
|
166307
|
+
};
|
|
166308
|
+
((EssEnergyServer2) => {
|
|
166309
|
+
class State extends EnergyFeaturedBase.State {
|
|
166310
|
+
}
|
|
166311
|
+
EssEnergyServer2.State = State;
|
|
166312
|
+
})(EssEnergyServer || (EssEnergyServer = {}));
|
|
166313
|
+
var EssEnergy = EssEnergyServer.set({
|
|
166314
|
+
cumulativeEnergyImported: { energy: 0 },
|
|
166315
|
+
accuracy: {
|
|
166316
|
+
measurementType: ElectricalPowerMeasurement3.MeasurementType.ElectricalEnergy,
|
|
166317
|
+
measured: true,
|
|
166318
|
+
minMeasuredValue: -1e6,
|
|
166319
|
+
maxMeasuredValue: 1e11,
|
|
166320
|
+
accuracyRanges: [
|
|
166321
|
+
{
|
|
166322
|
+
rangeMin: -1e6,
|
|
166323
|
+
rangeMax: 1e11,
|
|
166324
|
+
fixedMax: 1e3
|
|
166325
|
+
}
|
|
166326
|
+
]
|
|
166327
|
+
}
|
|
166328
|
+
});
|
|
166329
|
+
var BatteryStorageEssBase = BatteryStorageDevice.with(
|
|
166330
|
+
BasicInformationServer2,
|
|
166331
|
+
IdentifyServer2,
|
|
166332
|
+
HomeAssistantEntityBehavior,
|
|
166333
|
+
HaPowerTopologyServer,
|
|
166334
|
+
PowerSourceServer2({
|
|
166335
|
+
getBatteryPercent(entity) {
|
|
166336
|
+
const state = entity.state;
|
|
166337
|
+
if (state == null || Number.isNaN(+state)) {
|
|
166338
|
+
return null;
|
|
166339
|
+
}
|
|
166340
|
+
return +state;
|
|
166341
|
+
}
|
|
166342
|
+
})
|
|
166343
|
+
);
|
|
166344
|
+
function batteryStorageEssType(mapping) {
|
|
166345
|
+
let device = BatteryStorageEssBase;
|
|
166346
|
+
if (mapping?.batteryPowerEntity) device = device.with(EssPower);
|
|
166347
|
+
if (mapping?.batteryEnergyEntity) device = device.with(EssEnergy);
|
|
166348
|
+
return device;
|
|
166349
|
+
}
|
|
166350
|
+
|
|
166147
166351
|
// src/matter/behaviors/carbon-monoxide-concentration-measurement-server.ts
|
|
166148
166352
|
init_home_assistant_entity_behavior();
|
|
166149
166353
|
var CarbonMonoxideConcentrationMeasurementServerBase = CarbonMonoxideConcentrationMeasurementServer.with(
|
|
@@ -166235,10 +166439,14 @@ var CarbonMonoxideSensorType = AirQualitySensorDevice.with(
|
|
|
166235
166439
|
CarbonMonoxideConcentrationMeasurementServer2
|
|
166236
166440
|
);
|
|
166237
166441
|
|
|
166442
|
+
// src/matter/endpoints/legacy/sensor/devices/electrical-meter.ts
|
|
166443
|
+
init_home_assistant_entity_behavior();
|
|
166444
|
+
|
|
166238
166445
|
// src/matter/endpoints/legacy/sensor/devices/electrical-sensor.ts
|
|
166239
166446
|
init_dist();
|
|
166240
166447
|
init_home_assistant_entity_behavior();
|
|
166241
|
-
var
|
|
166448
|
+
var PowerFeaturedBase2 = ElectricalPowerMeasurementServer.with("AlternatingCurrent");
|
|
166449
|
+
var StandalonePowerServer = class extends PowerFeaturedBase2 {
|
|
166242
166450
|
async initialize() {
|
|
166243
166451
|
await super.initialize();
|
|
166244
166452
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -166246,36 +166454,48 @@ var StandalonePowerServer = class extends ElectricalPowerMeasurementServer {
|
|
|
166246
166454
|
this.reactTo(homeAssistant.onChange, this.update, { offline: true });
|
|
166247
166455
|
}
|
|
166248
166456
|
update(entity) {
|
|
166249
|
-
|
|
166250
|
-
|
|
166251
|
-
|
|
166252
|
-
const
|
|
166253
|
-
if (
|
|
166254
|
-
|
|
166255
|
-
|
|
166256
|
-
|
|
166257
|
-
|
|
166258
|
-
|
|
166259
|
-
|
|
166260
|
-
|
|
166261
|
-
|
|
166262
|
-
|
|
166263
|
-
|
|
166264
|
-
|
|
166265
|
-
|
|
166266
|
-
|
|
166267
|
-
|
|
166457
|
+
const patch = {};
|
|
166458
|
+
const attrs = entity.state?.attributes;
|
|
166459
|
+
const dc = attrs?.device_class;
|
|
166460
|
+
const primary = entity.state?.state;
|
|
166461
|
+
if (primary != null && !Number.isNaN(+primary)) {
|
|
166462
|
+
if (dc === SensorDeviceClass.power) {
|
|
166463
|
+
patch.activePower = Math.round(+primary * 1e3);
|
|
166464
|
+
} else if (dc === SensorDeviceClass.voltage) {
|
|
166465
|
+
patch.voltage = Math.round(+primary * 1e3);
|
|
166466
|
+
} else if (dc === SensorDeviceClass.current) {
|
|
166467
|
+
patch.activeCurrent = Math.round(+primary * 1e3);
|
|
166468
|
+
}
|
|
166469
|
+
}
|
|
166470
|
+
const mapping = this.agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
166471
|
+
if (mapping?.powerEntity || mapping?.voltageEntity || mapping?.currentEntity) {
|
|
166472
|
+
const stateProvider = this.agent.env.get(EntityStateProvider);
|
|
166473
|
+
if (mapping.powerEntity) {
|
|
166474
|
+
const w = stateProvider.getNumericState(mapping.powerEntity);
|
|
166475
|
+
if (w != null) patch.activePower = Math.round(w * 1e3);
|
|
166476
|
+
}
|
|
166477
|
+
if (mapping.voltageEntity) {
|
|
166478
|
+
const v = stateProvider.getNumericState(mapping.voltageEntity);
|
|
166479
|
+
if (v != null) patch.voltage = Math.round(v * 1e3);
|
|
166480
|
+
}
|
|
166481
|
+
if (mapping.currentEntity) {
|
|
166482
|
+
const a = stateProvider.getNumericState(mapping.currentEntity);
|
|
166483
|
+
if (a != null) patch.activeCurrent = Math.round(a * 1e3);
|
|
166484
|
+
}
|
|
166268
166485
|
}
|
|
166486
|
+
if (Object.keys(patch).length > 0) applyPatchState(this.state, patch);
|
|
166269
166487
|
}
|
|
166270
166488
|
};
|
|
166271
166489
|
((StandalonePowerServer2) => {
|
|
166272
|
-
class State extends
|
|
166490
|
+
class State extends PowerFeaturedBase2.State {
|
|
166273
166491
|
}
|
|
166274
166492
|
StandalonePowerServer2.State = State;
|
|
166275
166493
|
})(StandalonePowerServer || (StandalonePowerServer = {}));
|
|
166276
166494
|
var PowerServer = StandalonePowerServer.set({
|
|
166277
166495
|
powerMode: ElectricalPowerMeasurement3.PowerMode.Ac,
|
|
166278
|
-
|
|
166496
|
+
// Power, voltage and current can all be folded onto this endpoint, so the
|
|
166497
|
+
// accuracy list carries an entry for each reported measurement type.
|
|
166498
|
+
numberOfMeasurementTypes: 3,
|
|
166279
166499
|
// SmartThings keeps the endpoint in a "device not yet updated" state
|
|
166280
166500
|
// when activePower stays null. Seed 0 so the cluster reports a value
|
|
166281
166501
|
// for energy/voltage/current-only sensors that never feed activePower.
|
|
@@ -166293,14 +166513,43 @@ var PowerServer = StandalonePowerServer.set({
|
|
|
166293
166513
|
fixedMax: 1e3
|
|
166294
166514
|
}
|
|
166295
166515
|
]
|
|
166516
|
+
},
|
|
166517
|
+
{
|
|
166518
|
+
measurementType: ElectricalPowerMeasurement3.MeasurementType.Voltage,
|
|
166519
|
+
measured: true,
|
|
166520
|
+
minMeasuredValue: 0,
|
|
166521
|
+
maxMeasuredValue: 1e6,
|
|
166522
|
+
// 1000V in mV
|
|
166523
|
+
accuracyRanges: [
|
|
166524
|
+
{
|
|
166525
|
+
rangeMin: 0,
|
|
166526
|
+
rangeMax: 1e6,
|
|
166527
|
+
fixedMax: 1e3
|
|
166528
|
+
}
|
|
166529
|
+
]
|
|
166530
|
+
},
|
|
166531
|
+
{
|
|
166532
|
+
measurementType: ElectricalPowerMeasurement3.MeasurementType.ActiveCurrent,
|
|
166533
|
+
measured: true,
|
|
166534
|
+
minMeasuredValue: -1e6,
|
|
166535
|
+
// -1000A in mA
|
|
166536
|
+
maxMeasuredValue: 1e6,
|
|
166537
|
+
// 1000A in mA
|
|
166538
|
+
accuracyRanges: [
|
|
166539
|
+
{
|
|
166540
|
+
rangeMin: -1e6,
|
|
166541
|
+
rangeMax: 1e6,
|
|
166542
|
+
fixedMax: 1e3
|
|
166543
|
+
}
|
|
166544
|
+
]
|
|
166296
166545
|
}
|
|
166297
166546
|
]
|
|
166298
166547
|
});
|
|
166299
|
-
var
|
|
166548
|
+
var EnergyFeaturedBase2 = ElectricalEnergyMeasurementServer.with(
|
|
166300
166549
|
"CumulativeEnergy",
|
|
166301
166550
|
"ImportedEnergy"
|
|
166302
166551
|
);
|
|
166303
|
-
var StandaloneEnergyServer = class extends
|
|
166552
|
+
var StandaloneEnergyServer = class extends EnergyFeaturedBase2 {
|
|
166304
166553
|
async initialize() {
|
|
166305
166554
|
await super.initialize();
|
|
166306
166555
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -166308,32 +166557,39 @@ var StandaloneEnergyServer = class extends EnergyFeaturedBase {
|
|
|
166308
166557
|
this.reactTo(homeAssistant.onChange, this.update, { offline: true });
|
|
166309
166558
|
}
|
|
166310
166559
|
update(entity) {
|
|
166311
|
-
|
|
166312
|
-
|
|
166560
|
+
let energyKwh = null;
|
|
166561
|
+
const attrs = entity.state?.attributes;
|
|
166562
|
+
if (attrs?.device_class === SensorDeviceClass.energy) {
|
|
166563
|
+
const state = entity.state?.state;
|
|
166564
|
+
if (state != null && !Number.isNaN(+state)) energyKwh = +state;
|
|
166565
|
+
}
|
|
166566
|
+
const mapping = this.agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
166567
|
+
if (mapping?.energyEntity) {
|
|
166568
|
+
const stateProvider = this.agent.env.get(EntityStateProvider);
|
|
166569
|
+
const mapped = stateProvider.getNumericState(mapping.energyEntity);
|
|
166570
|
+
if (mapped != null) energyKwh = mapped;
|
|
166313
166571
|
}
|
|
166314
|
-
|
|
166315
|
-
|
|
166316
|
-
const
|
|
166317
|
-
if (state == null || Number.isNaN(+state)) return;
|
|
166318
|
-
const energyMwh = Math.round(+state * 1e6);
|
|
166319
|
-
const energyImported = { energy: energyMwh };
|
|
166320
|
-
applyPatchState(this.state, {
|
|
166572
|
+
if (energyKwh == null) return;
|
|
166573
|
+
const energyImported = { energy: Math.round(energyKwh * 1e6) };
|
|
166574
|
+
const changed = applyPatchState(this.state, {
|
|
166321
166575
|
cumulativeEnergyImported: energyImported
|
|
166322
166576
|
});
|
|
166323
|
-
|
|
166324
|
-
|
|
166325
|
-
|
|
166326
|
-
|
|
166577
|
+
if ("cumulativeEnergyImported" in changed) {
|
|
166578
|
+
this.events.cumulativeEnergyMeasured?.emit(
|
|
166579
|
+
{ energyImported, energyExported: void 0 },
|
|
166580
|
+
this.context
|
|
166581
|
+
);
|
|
166582
|
+
}
|
|
166327
166583
|
}
|
|
166328
166584
|
};
|
|
166329
166585
|
((StandaloneEnergyServer2) => {
|
|
166330
|
-
class State extends
|
|
166586
|
+
class State extends EnergyFeaturedBase2.State {
|
|
166331
166587
|
}
|
|
166332
166588
|
StandaloneEnergyServer2.State = State;
|
|
166333
166589
|
})(StandaloneEnergyServer || (StandaloneEnergyServer = {}));
|
|
166334
166590
|
var EnergyServer = StandaloneEnergyServer.set({
|
|
166335
166591
|
// Match the activePower=0 default so SmartThings doesn't show "- kWh"
|
|
166336
|
-
// on
|
|
166592
|
+
// on an endpoint whose mapped entity only carries power data.
|
|
166337
166593
|
cumulativeEnergyImported: { energy: 0 },
|
|
166338
166594
|
accuracy: {
|
|
166339
166595
|
measurementType: ElectricalPowerMeasurement3.MeasurementType.ElectricalEnergy,
|
|
@@ -166358,6 +166614,15 @@ var ElectricalSensorType = SolarPowerDevice.with(
|
|
|
166358
166614
|
EnergyServer
|
|
166359
166615
|
);
|
|
166360
166616
|
|
|
166617
|
+
// src/matter/endpoints/legacy/sensor/devices/electrical-meter.ts
|
|
166618
|
+
var ElectricalMeterType = ElectricalMeterDevice.with(
|
|
166619
|
+
BasicInformationServer2,
|
|
166620
|
+
IdentifyServer2,
|
|
166621
|
+
HomeAssistantEntityBehavior,
|
|
166622
|
+
PowerServer,
|
|
166623
|
+
EnergyServer
|
|
166624
|
+
);
|
|
166625
|
+
|
|
166361
166626
|
// src/matter/behaviors/flow-measurement-server.ts
|
|
166362
166627
|
init_home_assistant_entity_behavior();
|
|
166363
166628
|
var FlowMeasurementServerBase = class extends FlowMeasurementServer {
|
|
@@ -167725,9 +167990,12 @@ function SensorDevice(homeAssistantEntity) {
|
|
|
167725
167990
|
return RadonSensorType.set({ homeAssistantEntity });
|
|
167726
167991
|
}
|
|
167727
167992
|
if (deviceClass === SensorDeviceClass.power || deviceClass === SensorDeviceClass.energy || deviceClass === SensorDeviceClass.voltage || deviceClass === SensorDeviceClass.current) {
|
|
167728
|
-
return
|
|
167993
|
+
return ElectricalMeterType.set({ homeAssistantEntity });
|
|
167729
167994
|
}
|
|
167730
167995
|
if (deviceClass === SensorDeviceClass.battery) {
|
|
167996
|
+
if (mapping?.batteryPowerEntity || mapping?.batteryEnergyEntity) {
|
|
167997
|
+
return batteryStorageEssType(mapping).set({ homeAssistantEntity });
|
|
167998
|
+
}
|
|
167731
167999
|
return BatterySensorType.set({ homeAssistantEntity });
|
|
167732
168000
|
}
|
|
167733
168001
|
if (deviceClass) {
|
|
@@ -167801,11 +168069,12 @@ function SwitchDevice(homeAssistantEntity) {
|
|
|
167801
168069
|
const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
|
|
167802
168070
|
const hasPowerEntity = !!homeAssistantEntity.mapping?.powerEntity;
|
|
167803
168071
|
const hasEnergyEntity = !!homeAssistantEntity.mapping?.energyEntity;
|
|
168072
|
+
const hasElectricalPower = hasPowerEntity || !!homeAssistantEntity.mapping?.voltageEntity || !!homeAssistantEntity.mapping?.currentEntity;
|
|
167804
168073
|
let device = hasBatteryAttr || hasBatteryEntity ? SwitchWithBatteryEndpointType : SwitchEndpointType;
|
|
167805
|
-
if (
|
|
168074
|
+
if (hasElectricalPower || hasEnergyEntity) {
|
|
167806
168075
|
device = device.with(HaPowerTopologyServer);
|
|
167807
168076
|
}
|
|
167808
|
-
if (
|
|
168077
|
+
if (hasElectricalPower) {
|
|
167809
168078
|
device = device.with(HaElectricalPowerMeasurementServer);
|
|
167810
168079
|
}
|
|
167811
168080
|
if (hasEnergyEntity) {
|
|
@@ -170243,7 +170512,12 @@ var matterDeviceTypeFactories = {
|
|
|
170243
170512
|
light_sensor: (ha) => IlluminanceSensorType.set({ homeAssistantEntity: ha }),
|
|
170244
170513
|
flow_sensor: (ha) => FlowSensorType.set({ homeAssistantEntity: ha }),
|
|
170245
170514
|
air_quality_sensor: (ha) => AirQualitySensorType.set({ homeAssistantEntity: ha }),
|
|
170246
|
-
battery_storage: (ha) =>
|
|
170515
|
+
battery_storage: (ha) => {
|
|
170516
|
+
if (ha.mapping?.batteryPowerEntity || ha.mapping?.batteryEnergyEntity) {
|
|
170517
|
+
return batteryStorageEssType(ha.mapping).set({ homeAssistantEntity: ha });
|
|
170518
|
+
}
|
|
170519
|
+
return BatterySensorType.set({ homeAssistantEntity: ha });
|
|
170520
|
+
},
|
|
170247
170521
|
tvoc_sensor: (ha) => TvocSensorType.set({ homeAssistantEntity: ha }),
|
|
170248
170522
|
carbon_monoxide_sensor: (ha) => CarbonMonoxideSensorType.set({ homeAssistantEntity: ha }),
|
|
170249
170523
|
nitrogen_dioxide_sensor: (ha) => NitrogenDioxideSensorType.set({ homeAssistantEntity: ha }),
|
|
@@ -170251,7 +170525,10 @@ var matterDeviceTypeFactories = {
|
|
|
170251
170525
|
formaldehyde_sensor: (ha) => FormaldehydeSensorType.set({ homeAssistantEntity: ha }),
|
|
170252
170526
|
radon_sensor: (ha) => RadonSensorType.set({ homeAssistantEntity: ha }),
|
|
170253
170527
|
pm1_sensor: (ha) => Pm1SensorType.set({ homeAssistantEntity: ha }),
|
|
170528
|
+
electrical_meter: (ha) => ElectricalMeterType.set({ homeAssistantEntity: ha }),
|
|
170529
|
+
// Legacy SolarPower alias, kept for existing mappings.
|
|
170254
170530
|
electrical_sensor: (ha) => ElectricalSensorType.set({ homeAssistantEntity: ha }),
|
|
170531
|
+
solar_power: (ha) => ElectricalSensorType.set({ homeAssistantEntity: ha }),
|
|
170255
170532
|
contact_sensor: (ha) => ContactSensorType.set({ homeAssistantEntity: ha }),
|
|
170256
170533
|
motion_sensor: (ha) => MotionSensorType.set({ homeAssistantEntity: ha }),
|
|
170257
170534
|
occupancy_sensor: (ha) => OccupancySensorType.set({ homeAssistantEntity: ha }),
|