@riddix/hamh 2.1.0-alpha.444 → 2.1.0-alpha.446
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
|
@@ -146057,14 +146057,23 @@ var init_clusters2 = __esm({
|
|
|
146057
146057
|
ClusterId3["bridgedDeviceBasicInformation"] = "bridgedDeviceBasicInformation";
|
|
146058
146058
|
ClusterId3["airQuality"] = "airQuality";
|
|
146059
146059
|
ClusterId3["booleanState"] = "booleanState";
|
|
146060
|
+
ClusterId3["carbonDioxideConcentrationMeasurement"] = "carbonDioxideConcentrationMeasurement";
|
|
146061
|
+
ClusterId3["carbonMonoxideConcentrationMeasurement"] = "carbonMonoxideConcentrationMeasurement";
|
|
146060
146062
|
ClusterId3["colorControl"] = "colorControl";
|
|
146061
146063
|
ClusterId3["doorLock"] = "doorLock";
|
|
146064
|
+
ClusterId3["electricalEnergyMeasurement"] = "electricalEnergyMeasurement";
|
|
146065
|
+
ClusterId3["electricalPowerMeasurement"] = "electricalPowerMeasurement";
|
|
146062
146066
|
ClusterId3["flowMeasurement"] = "flowMeasurement";
|
|
146063
146067
|
ClusterId3["levelControl"] = "levelControl";
|
|
146064
146068
|
ClusterId3["fanControl"] = "fanControl";
|
|
146065
146069
|
ClusterId3["illuminanceMeasurement"] = "illuminanceMeasurement";
|
|
146070
|
+
ClusterId3["nitrogenDioxideConcentrationMeasurement"] = "nitrogenDioxideConcentrationMeasurement";
|
|
146066
146071
|
ClusterId3["occupancySensing"] = "occupancySensing";
|
|
146067
146072
|
ClusterId3["onOff"] = "onOff";
|
|
146073
|
+
ClusterId3["ozoneConcentrationMeasurement"] = "ozoneConcentrationMeasurement";
|
|
146074
|
+
ClusterId3["pm1ConcentrationMeasurement"] = "pm1ConcentrationMeasurement";
|
|
146075
|
+
ClusterId3["pm10ConcentrationMeasurement"] = "pm10ConcentrationMeasurement";
|
|
146076
|
+
ClusterId3["pm25ConcentrationMeasurement"] = "pm25ConcentrationMeasurement";
|
|
146068
146077
|
ClusterId3["powerSource"] = "powerSource";
|
|
146069
146078
|
ClusterId3["pressureMeasurement"] = "pressureMeasurement";
|
|
146070
146079
|
ClusterId3["relativeHumidityMeasurement"] = "relativeHumidityMeasurement";
|
|
@@ -146072,6 +146081,7 @@ var init_clusters2 = __esm({
|
|
|
146072
146081
|
ClusterId3["temperatureMeasurement"] = "temperatureMeasurement";
|
|
146073
146082
|
ClusterId3["thermostat"] = "thermostat";
|
|
146074
146083
|
ClusterId3["thermostatUserInterfaceConfiguration"] = "thermostatUserInterfaceConfiguration";
|
|
146084
|
+
ClusterId3["totalVolatileOrganicCompoundsConcentrationMeasurement"] = "totalVolatileOrganicCompoundsConcentrationMeasurement";
|
|
146075
146085
|
ClusterId3["valveConfigurationAndControl"] = "valveConfigurationAndControl";
|
|
146076
146086
|
ClusterId3["windowCovering"] = "windowCovering";
|
|
146077
146087
|
ClusterId3["mediaInput"] = "mediaInput";
|
|
@@ -149735,6 +149745,36 @@ function detectEnvironment2() {
|
|
|
149735
149745
|
}
|
|
149736
149746
|
function systemApi(version) {
|
|
149737
149747
|
const router = express12.Router();
|
|
149748
|
+
router.get("/update-check", async (_req, res) => {
|
|
149749
|
+
try {
|
|
149750
|
+
const response = await fetch(
|
|
149751
|
+
"https://api.github.com/repos/riddix/home-assistant-matter-hub/releases/latest",
|
|
149752
|
+
{
|
|
149753
|
+
headers: { Accept: "application/vnd.github.v3+json" },
|
|
149754
|
+
signal: AbortSignal.timeout(1e4)
|
|
149755
|
+
}
|
|
149756
|
+
);
|
|
149757
|
+
if (!response.ok) {
|
|
149758
|
+
res.status(502).json({ error: "Failed to check for updates" });
|
|
149759
|
+
return;
|
|
149760
|
+
}
|
|
149761
|
+
const data = await response.json();
|
|
149762
|
+
const latestVersion = data.tag_name.replace(/^v/, "");
|
|
149763
|
+
const updateAvailable = version !== "0.0.0-dev" && latestVersion !== version;
|
|
149764
|
+
res.json({
|
|
149765
|
+
currentVersion: version,
|
|
149766
|
+
latestVersion,
|
|
149767
|
+
updateAvailable,
|
|
149768
|
+
releaseUrl: data.html_url,
|
|
149769
|
+
publishedAt: data.published_at,
|
|
149770
|
+
releaseNotes: data.body ? data.body.substring(0, 500) : void 0,
|
|
149771
|
+
environment: detectEnvironment2()
|
|
149772
|
+
});
|
|
149773
|
+
} catch (error) {
|
|
149774
|
+
logger141.error("Failed to check for updates:", error);
|
|
149775
|
+
res.status(500).json({ error: "Failed to check for updates" });
|
|
149776
|
+
}
|
|
149777
|
+
});
|
|
149738
149778
|
router.get("/info", async (_req, res) => {
|
|
149739
149779
|
try {
|
|
149740
149780
|
const totalMem = os2.totalmem();
|
|
@@ -162324,6 +162364,7 @@ var SolarPowerDeviceDefinition = MutableEndpoint({
|
|
|
162324
162364
|
behaviors: SupportedBehaviors()
|
|
162325
162365
|
});
|
|
162326
162366
|
Object.freeze(SolarPowerDeviceDefinition);
|
|
162367
|
+
var SolarPowerDevice = SolarPowerDeviceDefinition;
|
|
162327
162368
|
|
|
162328
162369
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/devices/speaker.js
|
|
162329
162370
|
init_MutableEndpoint();
|
|
@@ -169429,6 +169470,12 @@ init_home_assistant_entity_behavior();
|
|
|
169429
169470
|
var logger170 = Logger.get("ColorControlServer");
|
|
169430
169471
|
var optimisticColorTimestamps = /* @__PURE__ */ new Map();
|
|
169431
169472
|
var OPTIMISTIC_COLOR_COOLDOWN_MS = 2e3;
|
|
169473
|
+
var pendingColorStaging = /* @__PURE__ */ new Map();
|
|
169474
|
+
function consumePendingColorStaging(entityId) {
|
|
169475
|
+
const data = pendingColorStaging.get(entityId);
|
|
169476
|
+
pendingColorStaging.delete(entityId);
|
|
169477
|
+
return data;
|
|
169478
|
+
}
|
|
169432
169479
|
var FeaturedBase7 = ColorControlServer.with("ColorTemperature", "HueSaturation");
|
|
169433
169480
|
var ColorControlServerBase = class extends FeaturedBase7 {
|
|
169434
169481
|
pendingTransitionTime;
|
|
@@ -169566,6 +169613,10 @@ var ColorControlServerBase = class extends FeaturedBase7 {
|
|
|
169566
169613
|
colorMode: ColorControl3.ColorMode.ColorTemperatureMireds
|
|
169567
169614
|
});
|
|
169568
169615
|
optimisticColorTimestamps.set(homeAssistant.entityId, Date.now());
|
|
169616
|
+
if (this.isLightOff()) {
|
|
169617
|
+
pendingColorStaging.set(homeAssistant.entityId, action.data ?? {});
|
|
169618
|
+
return;
|
|
169619
|
+
}
|
|
169569
169620
|
homeAssistant.callAction(action);
|
|
169570
169621
|
}
|
|
169571
169622
|
moveToHueLogic(targetHue) {
|
|
@@ -169597,8 +169648,16 @@ var ColorControlServerBase = class extends FeaturedBase7 {
|
|
|
169597
169648
|
colorMode: ColorControl3.ColorMode.CurrentHueAndCurrentSaturation
|
|
169598
169649
|
});
|
|
169599
169650
|
optimisticColorTimestamps.set(homeAssistant.entityId, Date.now());
|
|
169651
|
+
if (this.isLightOff()) {
|
|
169652
|
+
pendingColorStaging.set(homeAssistant.entityId, action.data ?? {});
|
|
169653
|
+
return;
|
|
169654
|
+
}
|
|
169600
169655
|
homeAssistant.callAction(action);
|
|
169601
169656
|
}
|
|
169657
|
+
isLightOff() {
|
|
169658
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
169659
|
+
return homeAssistant.entity.state.state === "off";
|
|
169660
|
+
}
|
|
169602
169661
|
applyTransition(action) {
|
|
169603
169662
|
const tenths = this.pendingTransitionTime;
|
|
169604
169663
|
this.pendingTransitionTime = void 0;
|
|
@@ -169698,12 +169757,16 @@ var LightLevelControlServer = LevelControlServer2(config8).with(
|
|
|
169698
169757
|
);
|
|
169699
169758
|
|
|
169700
169759
|
// src/matter/endpoints/legacy/light/behaviors/light-on-off-server.ts
|
|
169760
|
+
init_home_assistant_entity_behavior();
|
|
169701
169761
|
var LightOnOffServer = OnOffServer2({
|
|
169702
|
-
turnOn: () =>
|
|
169703
|
-
|
|
169704
|
-
|
|
169705
|
-
|
|
169706
|
-
|
|
169762
|
+
turnOn: (_value, agent) => {
|
|
169763
|
+
const entityId = agent.get(HomeAssistantEntityBehavior).entityId;
|
|
169764
|
+
const staged = consumePendingColorStaging(entityId);
|
|
169765
|
+
return {
|
|
169766
|
+
action: "light.turn_on",
|
|
169767
|
+
data: staged
|
|
169768
|
+
};
|
|
169769
|
+
},
|
|
169707
169770
|
turnOff: () => ({
|
|
169708
169771
|
action: "homeassistant.turn_off"
|
|
169709
169772
|
}),
|
|
@@ -171361,6 +171424,206 @@ var BatterySensorType = BatteryStorageDevice.with(
|
|
|
171361
171424
|
})
|
|
171362
171425
|
);
|
|
171363
171426
|
|
|
171427
|
+
// src/matter/behaviors/carbon-monoxide-concentration-measurement-server.ts
|
|
171428
|
+
init_home_assistant_entity_behavior();
|
|
171429
|
+
var CarbonMonoxideConcentrationMeasurementServerBase = CarbonMonoxideConcentrationMeasurementServer.with(
|
|
171430
|
+
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
171431
|
+
);
|
|
171432
|
+
var CarbonMonoxideConcentrationMeasurementServer2 = class extends CarbonMonoxideConcentrationMeasurementServerBase {
|
|
171433
|
+
async initialize() {
|
|
171434
|
+
if (this.state.measuredValue === void 0) {
|
|
171435
|
+
this.state.measuredValue = null;
|
|
171436
|
+
}
|
|
171437
|
+
if (this.state.minMeasuredValue === void 0) {
|
|
171438
|
+
this.state.minMeasuredValue = null;
|
|
171439
|
+
}
|
|
171440
|
+
if (this.state.maxMeasuredValue === void 0) {
|
|
171441
|
+
this.state.maxMeasuredValue = null;
|
|
171442
|
+
}
|
|
171443
|
+
if (this.state.uncertainty === void 0) {
|
|
171444
|
+
this.state.uncertainty = 0;
|
|
171445
|
+
}
|
|
171446
|
+
if (this.state.measurementUnit === void 0) {
|
|
171447
|
+
this.state.measurementUnit = ConcentrationMeasurement3.MeasurementUnit.Ppm;
|
|
171448
|
+
}
|
|
171449
|
+
if (this.state.measurementMedium === void 0) {
|
|
171450
|
+
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
171451
|
+
}
|
|
171452
|
+
await super.initialize();
|
|
171453
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171454
|
+
this.update(homeAssistant.entity);
|
|
171455
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171456
|
+
}
|
|
171457
|
+
update(entity) {
|
|
171458
|
+
if (!entity.state) {
|
|
171459
|
+
return;
|
|
171460
|
+
}
|
|
171461
|
+
const state = entity.state.state;
|
|
171462
|
+
let measuredValue = null;
|
|
171463
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
171464
|
+
measuredValue = +state;
|
|
171465
|
+
}
|
|
171466
|
+
applyPatchState(this.state, { measuredValue });
|
|
171467
|
+
}
|
|
171468
|
+
};
|
|
171469
|
+
|
|
171470
|
+
// src/matter/endpoints/legacy/sensor/devices/carbon-monoxide-sensor.ts
|
|
171471
|
+
init_home_assistant_entity_behavior();
|
|
171472
|
+
var CoAirQualityServerBase = AirQualityServer.with(
|
|
171473
|
+
AirQuality3.Feature.Fair,
|
|
171474
|
+
AirQuality3.Feature.Moderate,
|
|
171475
|
+
AirQuality3.Feature.VeryPoor,
|
|
171476
|
+
AirQuality3.Feature.ExtremelyPoor
|
|
171477
|
+
);
|
|
171478
|
+
var CoAirQualityServer = class extends CoAirQualityServerBase {
|
|
171479
|
+
async initialize() {
|
|
171480
|
+
if (this.state.airQuality === void 0) {
|
|
171481
|
+
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
171482
|
+
}
|
|
171483
|
+
await super.initialize();
|
|
171484
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171485
|
+
this.update(homeAssistant.entity);
|
|
171486
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171487
|
+
}
|
|
171488
|
+
update(entity) {
|
|
171489
|
+
const state = entity.state.state;
|
|
171490
|
+
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
171491
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
171492
|
+
const ppm = +state;
|
|
171493
|
+
if (ppm <= 9) {
|
|
171494
|
+
airQuality = AirQuality3.AirQualityEnum.Good;
|
|
171495
|
+
} else if (ppm <= 25) {
|
|
171496
|
+
airQuality = AirQuality3.AirQualityEnum.Fair;
|
|
171497
|
+
} else if (ppm <= 50) {
|
|
171498
|
+
airQuality = AirQuality3.AirQualityEnum.Moderate;
|
|
171499
|
+
} else if (ppm <= 100) {
|
|
171500
|
+
airQuality = AirQuality3.AirQualityEnum.Poor;
|
|
171501
|
+
} else if (ppm <= 200) {
|
|
171502
|
+
airQuality = AirQuality3.AirQualityEnum.VeryPoor;
|
|
171503
|
+
} else {
|
|
171504
|
+
airQuality = AirQuality3.AirQualityEnum.ExtremelyPoor;
|
|
171505
|
+
}
|
|
171506
|
+
}
|
|
171507
|
+
applyPatchState(this.state, { airQuality });
|
|
171508
|
+
}
|
|
171509
|
+
};
|
|
171510
|
+
var CarbonMonoxideSensorType = AirQualitySensorDevice.with(
|
|
171511
|
+
BasicInformationServer2,
|
|
171512
|
+
IdentifyServer2,
|
|
171513
|
+
HomeAssistantEntityBehavior,
|
|
171514
|
+
CoAirQualityServer,
|
|
171515
|
+
CarbonMonoxideConcentrationMeasurementServer2
|
|
171516
|
+
);
|
|
171517
|
+
|
|
171518
|
+
// src/matter/endpoints/legacy/sensor/devices/electrical-sensor.ts
|
|
171519
|
+
init_dist();
|
|
171520
|
+
init_home_assistant_entity_behavior();
|
|
171521
|
+
var StandalonePowerServer = class extends ElectricalPowerMeasurementServer {
|
|
171522
|
+
async initialize() {
|
|
171523
|
+
await super.initialize();
|
|
171524
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171525
|
+
this.update(homeAssistant.entity);
|
|
171526
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171527
|
+
}
|
|
171528
|
+
update(entity) {
|
|
171529
|
+
const state = entity.state.state;
|
|
171530
|
+
if (state == null || Number.isNaN(+state)) return;
|
|
171531
|
+
const attrs = entity.state.attributes;
|
|
171532
|
+
const dc = attrs.device_class;
|
|
171533
|
+
if (dc === SensorDeviceClass.power) {
|
|
171534
|
+
applyPatchState(this.state, {
|
|
171535
|
+
activePower: Math.round(+state * 1e3)
|
|
171536
|
+
});
|
|
171537
|
+
} else if (dc === SensorDeviceClass.voltage) {
|
|
171538
|
+
applyPatchState(this.state, {
|
|
171539
|
+
voltage: Math.round(+state * 1e3)
|
|
171540
|
+
});
|
|
171541
|
+
} else if (dc === SensorDeviceClass.current) {
|
|
171542
|
+
applyPatchState(this.state, {
|
|
171543
|
+
activeCurrent: Math.round(+state * 1e3)
|
|
171544
|
+
});
|
|
171545
|
+
}
|
|
171546
|
+
}
|
|
171547
|
+
};
|
|
171548
|
+
((StandalonePowerServer2) => {
|
|
171549
|
+
class State extends ElectricalPowerMeasurementServer.State {
|
|
171550
|
+
}
|
|
171551
|
+
StandalonePowerServer2.State = State;
|
|
171552
|
+
})(StandalonePowerServer || (StandalonePowerServer = {}));
|
|
171553
|
+
var PowerServer = StandalonePowerServer.set({
|
|
171554
|
+
powerMode: ElectricalPowerMeasurement3.PowerMode.Ac,
|
|
171555
|
+
numberOfMeasurementTypes: 1,
|
|
171556
|
+
accuracy: [
|
|
171557
|
+
{
|
|
171558
|
+
measurementType: ElectricalPowerMeasurement3.MeasurementType.ActivePower,
|
|
171559
|
+
measured: true,
|
|
171560
|
+
minMeasuredValue: -1e6,
|
|
171561
|
+
maxMeasuredValue: 1e8,
|
|
171562
|
+
accuracyRanges: [
|
|
171563
|
+
{
|
|
171564
|
+
rangeMin: -1e6,
|
|
171565
|
+
rangeMax: 1e8,
|
|
171566
|
+
fixedMax: 1e3
|
|
171567
|
+
}
|
|
171568
|
+
]
|
|
171569
|
+
}
|
|
171570
|
+
]
|
|
171571
|
+
});
|
|
171572
|
+
var EnergyFeaturedBase = ElectricalEnergyMeasurementServer.with(
|
|
171573
|
+
"CumulativeEnergy",
|
|
171574
|
+
"ImportedEnergy"
|
|
171575
|
+
);
|
|
171576
|
+
var StandaloneEnergyServer = class extends EnergyFeaturedBase {
|
|
171577
|
+
async initialize() {
|
|
171578
|
+
await super.initialize();
|
|
171579
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171580
|
+
this.update(homeAssistant.entity);
|
|
171581
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171582
|
+
}
|
|
171583
|
+
update(entity) {
|
|
171584
|
+
const attrs = entity.state.attributes;
|
|
171585
|
+
if (attrs.device_class !== SensorDeviceClass.energy) return;
|
|
171586
|
+
const state = entity.state.state;
|
|
171587
|
+
if (state == null || Number.isNaN(+state)) return;
|
|
171588
|
+
const energyMwh = Math.round(+state * 1e6);
|
|
171589
|
+
const energyImported = { energy: energyMwh };
|
|
171590
|
+
applyPatchState(this.state, {
|
|
171591
|
+
cumulativeEnergyImported: energyImported
|
|
171592
|
+
});
|
|
171593
|
+
this.events.cumulativeEnergyMeasured?.emit(
|
|
171594
|
+
{ energyImported, energyExported: void 0 },
|
|
171595
|
+
this.context
|
|
171596
|
+
);
|
|
171597
|
+
}
|
|
171598
|
+
};
|
|
171599
|
+
((StandaloneEnergyServer2) => {
|
|
171600
|
+
class State extends EnergyFeaturedBase.State {
|
|
171601
|
+
}
|
|
171602
|
+
StandaloneEnergyServer2.State = State;
|
|
171603
|
+
})(StandaloneEnergyServer || (StandaloneEnergyServer = {}));
|
|
171604
|
+
var EnergyServer = StandaloneEnergyServer.set({
|
|
171605
|
+
accuracy: {
|
|
171606
|
+
measurementType: ElectricalPowerMeasurement3.MeasurementType.ElectricalEnergy,
|
|
171607
|
+
measured: true,
|
|
171608
|
+
minMeasuredValue: -1e6,
|
|
171609
|
+
maxMeasuredValue: 1e11,
|
|
171610
|
+
accuracyRanges: [
|
|
171611
|
+
{
|
|
171612
|
+
rangeMin: -1e6,
|
|
171613
|
+
rangeMax: 1e11,
|
|
171614
|
+
fixedMax: 1e3
|
|
171615
|
+
}
|
|
171616
|
+
]
|
|
171617
|
+
}
|
|
171618
|
+
});
|
|
171619
|
+
var ElectricalSensorType = SolarPowerDevice.with(
|
|
171620
|
+
BasicInformationServer2,
|
|
171621
|
+
IdentifyServer2,
|
|
171622
|
+
HomeAssistantEntityBehavior,
|
|
171623
|
+
PowerServer,
|
|
171624
|
+
EnergyServer
|
|
171625
|
+
);
|
|
171626
|
+
|
|
171364
171627
|
// src/matter/behaviors/flow-measurement-server.ts
|
|
171365
171628
|
init_home_assistant_entity_behavior();
|
|
171366
171629
|
var FlowMeasurementServerBase = class extends FlowMeasurementServer {
|
|
@@ -171432,6 +171695,97 @@ var FlowSensorType = FlowSensorDevice.with(
|
|
|
171432
171695
|
FlowMeasurementServer2(flowSensorConfig)
|
|
171433
171696
|
);
|
|
171434
171697
|
|
|
171698
|
+
// src/matter/behaviors/formaldehyde-concentration-measurement-server.ts
|
|
171699
|
+
init_home_assistant_entity_behavior();
|
|
171700
|
+
var FormaldehydeConcentrationMeasurementServerBase = FormaldehydeConcentrationMeasurementServer.with(
|
|
171701
|
+
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
171702
|
+
);
|
|
171703
|
+
var FormaldehydeConcentrationMeasurementServer2 = class extends FormaldehydeConcentrationMeasurementServerBase {
|
|
171704
|
+
async initialize() {
|
|
171705
|
+
if (this.state.measuredValue === void 0) {
|
|
171706
|
+
this.state.measuredValue = null;
|
|
171707
|
+
}
|
|
171708
|
+
if (this.state.minMeasuredValue === void 0) {
|
|
171709
|
+
this.state.minMeasuredValue = null;
|
|
171710
|
+
}
|
|
171711
|
+
if (this.state.maxMeasuredValue === void 0) {
|
|
171712
|
+
this.state.maxMeasuredValue = null;
|
|
171713
|
+
}
|
|
171714
|
+
if (this.state.uncertainty === void 0) {
|
|
171715
|
+
this.state.uncertainty = 0;
|
|
171716
|
+
}
|
|
171717
|
+
if (this.state.measurementUnit === void 0) {
|
|
171718
|
+
this.state.measurementUnit = ConcentrationMeasurement3.MeasurementUnit.Ugm3;
|
|
171719
|
+
}
|
|
171720
|
+
if (this.state.measurementMedium === void 0) {
|
|
171721
|
+
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
171722
|
+
}
|
|
171723
|
+
await super.initialize();
|
|
171724
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171725
|
+
this.update(homeAssistant.entity);
|
|
171726
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171727
|
+
}
|
|
171728
|
+
update(entity) {
|
|
171729
|
+
if (!entity.state) {
|
|
171730
|
+
return;
|
|
171731
|
+
}
|
|
171732
|
+
const state = entity.state.state;
|
|
171733
|
+
let measuredValue = null;
|
|
171734
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
171735
|
+
measuredValue = +state;
|
|
171736
|
+
}
|
|
171737
|
+
applyPatchState(this.state, { measuredValue });
|
|
171738
|
+
}
|
|
171739
|
+
};
|
|
171740
|
+
|
|
171741
|
+
// src/matter/endpoints/legacy/sensor/devices/formaldehyde-sensor.ts
|
|
171742
|
+
init_home_assistant_entity_behavior();
|
|
171743
|
+
var FormaldehydeAirQualityServerBase = AirQualityServer.with(
|
|
171744
|
+
AirQuality3.Feature.Fair,
|
|
171745
|
+
AirQuality3.Feature.Moderate,
|
|
171746
|
+
AirQuality3.Feature.VeryPoor,
|
|
171747
|
+
AirQuality3.Feature.ExtremelyPoor
|
|
171748
|
+
);
|
|
171749
|
+
var FormaldehydeAirQualityServer = class extends FormaldehydeAirQualityServerBase {
|
|
171750
|
+
async initialize() {
|
|
171751
|
+
if (this.state.airQuality === void 0) {
|
|
171752
|
+
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
171753
|
+
}
|
|
171754
|
+
await super.initialize();
|
|
171755
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171756
|
+
this.update(homeAssistant.entity);
|
|
171757
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171758
|
+
}
|
|
171759
|
+
update(entity) {
|
|
171760
|
+
const state = entity.state.state;
|
|
171761
|
+
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
171762
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
171763
|
+
const ugm3 = +state;
|
|
171764
|
+
if (ugm3 <= 30) {
|
|
171765
|
+
airQuality = AirQuality3.AirQualityEnum.Good;
|
|
171766
|
+
} else if (ugm3 <= 60) {
|
|
171767
|
+
airQuality = AirQuality3.AirQualityEnum.Fair;
|
|
171768
|
+
} else if (ugm3 <= 100) {
|
|
171769
|
+
airQuality = AirQuality3.AirQualityEnum.Moderate;
|
|
171770
|
+
} else if (ugm3 <= 200) {
|
|
171771
|
+
airQuality = AirQuality3.AirQualityEnum.Poor;
|
|
171772
|
+
} else if (ugm3 <= 500) {
|
|
171773
|
+
airQuality = AirQuality3.AirQualityEnum.VeryPoor;
|
|
171774
|
+
} else {
|
|
171775
|
+
airQuality = AirQuality3.AirQualityEnum.ExtremelyPoor;
|
|
171776
|
+
}
|
|
171777
|
+
}
|
|
171778
|
+
applyPatchState(this.state, { airQuality });
|
|
171779
|
+
}
|
|
171780
|
+
};
|
|
171781
|
+
var FormaldehydeSensorType = AirQualitySensorDevice.with(
|
|
171782
|
+
BasicInformationServer2,
|
|
171783
|
+
IdentifyServer2,
|
|
171784
|
+
HomeAssistantEntityBehavior,
|
|
171785
|
+
FormaldehydeAirQualityServer,
|
|
171786
|
+
FormaldehydeConcentrationMeasurementServer2
|
|
171787
|
+
);
|
|
171788
|
+
|
|
171435
171789
|
// src/matter/endpoints/legacy/sensor/devices/humidity-sensor.ts
|
|
171436
171790
|
init_home_assistant_entity_behavior();
|
|
171437
171791
|
var humiditySensorConfig = {
|
|
@@ -171512,6 +171866,285 @@ var IlluminanceSensorType = LightSensorDevice.with(
|
|
|
171512
171866
|
IlluminanceMeasurementServer2(illuminanceSensorConfig)
|
|
171513
171867
|
);
|
|
171514
171868
|
|
|
171869
|
+
// src/matter/endpoints/legacy/sensor/devices/nitrogen-dioxide-sensor.ts
|
|
171870
|
+
init_home_assistant_entity_behavior();
|
|
171871
|
+
|
|
171872
|
+
// src/matter/behaviors/nitrogen-dioxide-concentration-measurement-server.ts
|
|
171873
|
+
init_home_assistant_entity_behavior();
|
|
171874
|
+
var NitrogenDioxideConcentrationMeasurementServerBase = NitrogenDioxideConcentrationMeasurementServer.with(
|
|
171875
|
+
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
171876
|
+
);
|
|
171877
|
+
var NitrogenDioxideConcentrationMeasurementServer2 = class extends NitrogenDioxideConcentrationMeasurementServerBase {
|
|
171878
|
+
async initialize() {
|
|
171879
|
+
if (this.state.measuredValue === void 0) {
|
|
171880
|
+
this.state.measuredValue = null;
|
|
171881
|
+
}
|
|
171882
|
+
if (this.state.minMeasuredValue === void 0) {
|
|
171883
|
+
this.state.minMeasuredValue = null;
|
|
171884
|
+
}
|
|
171885
|
+
if (this.state.maxMeasuredValue === void 0) {
|
|
171886
|
+
this.state.maxMeasuredValue = null;
|
|
171887
|
+
}
|
|
171888
|
+
if (this.state.uncertainty === void 0) {
|
|
171889
|
+
this.state.uncertainty = 0;
|
|
171890
|
+
}
|
|
171891
|
+
if (this.state.measurementUnit === void 0) {
|
|
171892
|
+
this.state.measurementUnit = ConcentrationMeasurement3.MeasurementUnit.Ugm3;
|
|
171893
|
+
}
|
|
171894
|
+
if (this.state.measurementMedium === void 0) {
|
|
171895
|
+
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
171896
|
+
}
|
|
171897
|
+
await super.initialize();
|
|
171898
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171899
|
+
this.update(homeAssistant.entity);
|
|
171900
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171901
|
+
}
|
|
171902
|
+
update(entity) {
|
|
171903
|
+
if (!entity.state) {
|
|
171904
|
+
return;
|
|
171905
|
+
}
|
|
171906
|
+
const state = entity.state.state;
|
|
171907
|
+
let measuredValue = null;
|
|
171908
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
171909
|
+
measuredValue = +state;
|
|
171910
|
+
}
|
|
171911
|
+
applyPatchState(this.state, { measuredValue });
|
|
171912
|
+
}
|
|
171913
|
+
};
|
|
171914
|
+
|
|
171915
|
+
// src/matter/endpoints/legacy/sensor/devices/nitrogen-dioxide-sensor.ts
|
|
171916
|
+
var No2AirQualityServerBase = AirQualityServer.with(
|
|
171917
|
+
AirQuality3.Feature.Fair,
|
|
171918
|
+
AirQuality3.Feature.Moderate,
|
|
171919
|
+
AirQuality3.Feature.VeryPoor,
|
|
171920
|
+
AirQuality3.Feature.ExtremelyPoor
|
|
171921
|
+
);
|
|
171922
|
+
var No2AirQualityServer = class extends No2AirQualityServerBase {
|
|
171923
|
+
async initialize() {
|
|
171924
|
+
if (this.state.airQuality === void 0) {
|
|
171925
|
+
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
171926
|
+
}
|
|
171927
|
+
await super.initialize();
|
|
171928
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171929
|
+
this.update(homeAssistant.entity);
|
|
171930
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171931
|
+
}
|
|
171932
|
+
update(entity) {
|
|
171933
|
+
const state = entity.state.state;
|
|
171934
|
+
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
171935
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
171936
|
+
const ugm3 = +state;
|
|
171937
|
+
if (ugm3 <= 25) {
|
|
171938
|
+
airQuality = AirQuality3.AirQualityEnum.Good;
|
|
171939
|
+
} else if (ugm3 <= 50) {
|
|
171940
|
+
airQuality = AirQuality3.AirQualityEnum.Fair;
|
|
171941
|
+
} else if (ugm3 <= 100) {
|
|
171942
|
+
airQuality = AirQuality3.AirQualityEnum.Moderate;
|
|
171943
|
+
} else if (ugm3 <= 200) {
|
|
171944
|
+
airQuality = AirQuality3.AirQualityEnum.Poor;
|
|
171945
|
+
} else if (ugm3 <= 400) {
|
|
171946
|
+
airQuality = AirQuality3.AirQualityEnum.VeryPoor;
|
|
171947
|
+
} else {
|
|
171948
|
+
airQuality = AirQuality3.AirQualityEnum.ExtremelyPoor;
|
|
171949
|
+
}
|
|
171950
|
+
}
|
|
171951
|
+
applyPatchState(this.state, { airQuality });
|
|
171952
|
+
}
|
|
171953
|
+
};
|
|
171954
|
+
var NitrogenDioxideSensorType = AirQualitySensorDevice.with(
|
|
171955
|
+
BasicInformationServer2,
|
|
171956
|
+
IdentifyServer2,
|
|
171957
|
+
HomeAssistantEntityBehavior,
|
|
171958
|
+
No2AirQualityServer,
|
|
171959
|
+
NitrogenDioxideConcentrationMeasurementServer2
|
|
171960
|
+
);
|
|
171961
|
+
|
|
171962
|
+
// src/matter/endpoints/legacy/sensor/devices/ozone-sensor.ts
|
|
171963
|
+
init_home_assistant_entity_behavior();
|
|
171964
|
+
|
|
171965
|
+
// src/matter/behaviors/ozone-concentration-measurement-server.ts
|
|
171966
|
+
init_home_assistant_entity_behavior();
|
|
171967
|
+
var OzoneConcentrationMeasurementServerBase = OzoneConcentrationMeasurementServer.with(
|
|
171968
|
+
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
171969
|
+
);
|
|
171970
|
+
var OzoneConcentrationMeasurementServer2 = class extends OzoneConcentrationMeasurementServerBase {
|
|
171971
|
+
async initialize() {
|
|
171972
|
+
if (this.state.measuredValue === void 0) {
|
|
171973
|
+
this.state.measuredValue = null;
|
|
171974
|
+
}
|
|
171975
|
+
if (this.state.minMeasuredValue === void 0) {
|
|
171976
|
+
this.state.minMeasuredValue = null;
|
|
171977
|
+
}
|
|
171978
|
+
if (this.state.maxMeasuredValue === void 0) {
|
|
171979
|
+
this.state.maxMeasuredValue = null;
|
|
171980
|
+
}
|
|
171981
|
+
if (this.state.uncertainty === void 0) {
|
|
171982
|
+
this.state.uncertainty = 0;
|
|
171983
|
+
}
|
|
171984
|
+
if (this.state.measurementUnit === void 0) {
|
|
171985
|
+
this.state.measurementUnit = ConcentrationMeasurement3.MeasurementUnit.Ugm3;
|
|
171986
|
+
}
|
|
171987
|
+
if (this.state.measurementMedium === void 0) {
|
|
171988
|
+
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
171989
|
+
}
|
|
171990
|
+
await super.initialize();
|
|
171991
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171992
|
+
this.update(homeAssistant.entity);
|
|
171993
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171994
|
+
}
|
|
171995
|
+
update(entity) {
|
|
171996
|
+
if (!entity.state) {
|
|
171997
|
+
return;
|
|
171998
|
+
}
|
|
171999
|
+
const state = entity.state.state;
|
|
172000
|
+
let measuredValue = null;
|
|
172001
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
172002
|
+
measuredValue = +state;
|
|
172003
|
+
}
|
|
172004
|
+
applyPatchState(this.state, { measuredValue });
|
|
172005
|
+
}
|
|
172006
|
+
};
|
|
172007
|
+
|
|
172008
|
+
// src/matter/endpoints/legacy/sensor/devices/ozone-sensor.ts
|
|
172009
|
+
var OzoneAirQualityServerBase = AirQualityServer.with(
|
|
172010
|
+
AirQuality3.Feature.Fair,
|
|
172011
|
+
AirQuality3.Feature.Moderate,
|
|
172012
|
+
AirQuality3.Feature.VeryPoor,
|
|
172013
|
+
AirQuality3.Feature.ExtremelyPoor
|
|
172014
|
+
);
|
|
172015
|
+
var OzoneAirQualityServer = class extends OzoneAirQualityServerBase {
|
|
172016
|
+
async initialize() {
|
|
172017
|
+
if (this.state.airQuality === void 0) {
|
|
172018
|
+
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
172019
|
+
}
|
|
172020
|
+
await super.initialize();
|
|
172021
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
172022
|
+
this.update(homeAssistant.entity);
|
|
172023
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
172024
|
+
}
|
|
172025
|
+
update(entity) {
|
|
172026
|
+
const state = entity.state.state;
|
|
172027
|
+
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
172028
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
172029
|
+
const ugm3 = +state;
|
|
172030
|
+
if (ugm3 <= 60) {
|
|
172031
|
+
airQuality = AirQuality3.AirQualityEnum.Good;
|
|
172032
|
+
} else if (ugm3 <= 100) {
|
|
172033
|
+
airQuality = AirQuality3.AirQualityEnum.Fair;
|
|
172034
|
+
} else if (ugm3 <= 140) {
|
|
172035
|
+
airQuality = AirQuality3.AirQualityEnum.Moderate;
|
|
172036
|
+
} else if (ugm3 <= 180) {
|
|
172037
|
+
airQuality = AirQuality3.AirQualityEnum.Poor;
|
|
172038
|
+
} else if (ugm3 <= 240) {
|
|
172039
|
+
airQuality = AirQuality3.AirQualityEnum.VeryPoor;
|
|
172040
|
+
} else {
|
|
172041
|
+
airQuality = AirQuality3.AirQualityEnum.ExtremelyPoor;
|
|
172042
|
+
}
|
|
172043
|
+
}
|
|
172044
|
+
applyPatchState(this.state, { airQuality });
|
|
172045
|
+
}
|
|
172046
|
+
};
|
|
172047
|
+
var OzoneSensorType = AirQualitySensorDevice.with(
|
|
172048
|
+
BasicInformationServer2,
|
|
172049
|
+
IdentifyServer2,
|
|
172050
|
+
HomeAssistantEntityBehavior,
|
|
172051
|
+
OzoneAirQualityServer,
|
|
172052
|
+
OzoneConcentrationMeasurementServer2
|
|
172053
|
+
);
|
|
172054
|
+
|
|
172055
|
+
// src/matter/endpoints/legacy/sensor/devices/pm1-sensor.ts
|
|
172056
|
+
init_home_assistant_entity_behavior();
|
|
172057
|
+
|
|
172058
|
+
// src/matter/behaviors/pm1-concentration-measurement-server.ts
|
|
172059
|
+
init_home_assistant_entity_behavior();
|
|
172060
|
+
var Pm1ConcentrationMeasurementServerBase = Pm1ConcentrationMeasurementServer.with(
|
|
172061
|
+
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
172062
|
+
);
|
|
172063
|
+
var Pm1ConcentrationMeasurementServer2 = class extends Pm1ConcentrationMeasurementServerBase {
|
|
172064
|
+
async initialize() {
|
|
172065
|
+
if (this.state.measuredValue === void 0) {
|
|
172066
|
+
this.state.measuredValue = null;
|
|
172067
|
+
}
|
|
172068
|
+
if (this.state.minMeasuredValue === void 0) {
|
|
172069
|
+
this.state.minMeasuredValue = null;
|
|
172070
|
+
}
|
|
172071
|
+
if (this.state.maxMeasuredValue === void 0) {
|
|
172072
|
+
this.state.maxMeasuredValue = null;
|
|
172073
|
+
}
|
|
172074
|
+
if (this.state.uncertainty === void 0) {
|
|
172075
|
+
this.state.uncertainty = 0;
|
|
172076
|
+
}
|
|
172077
|
+
if (this.state.measurementUnit === void 0) {
|
|
172078
|
+
this.state.measurementUnit = ConcentrationMeasurement3.MeasurementUnit.Ugm3;
|
|
172079
|
+
}
|
|
172080
|
+
if (this.state.measurementMedium === void 0) {
|
|
172081
|
+
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
172082
|
+
}
|
|
172083
|
+
await super.initialize();
|
|
172084
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
172085
|
+
this.update(homeAssistant.entity);
|
|
172086
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
172087
|
+
}
|
|
172088
|
+
update(entity) {
|
|
172089
|
+
if (!entity.state) {
|
|
172090
|
+
return;
|
|
172091
|
+
}
|
|
172092
|
+
const state = entity.state.state;
|
|
172093
|
+
let measuredValue = null;
|
|
172094
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
172095
|
+
measuredValue = +state;
|
|
172096
|
+
}
|
|
172097
|
+
applyPatchState(this.state, { measuredValue });
|
|
172098
|
+
}
|
|
172099
|
+
};
|
|
172100
|
+
|
|
172101
|
+
// src/matter/endpoints/legacy/sensor/devices/pm1-sensor.ts
|
|
172102
|
+
var Pm1AirQualityServerBase = AirQualityServer.with(
|
|
172103
|
+
AirQuality3.Feature.Fair,
|
|
172104
|
+
AirQuality3.Feature.Moderate,
|
|
172105
|
+
AirQuality3.Feature.VeryPoor,
|
|
172106
|
+
AirQuality3.Feature.ExtremelyPoor
|
|
172107
|
+
);
|
|
172108
|
+
var Pm1AirQualityServer = class extends Pm1AirQualityServerBase {
|
|
172109
|
+
async initialize() {
|
|
172110
|
+
if (this.state.airQuality === void 0) {
|
|
172111
|
+
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
172112
|
+
}
|
|
172113
|
+
await super.initialize();
|
|
172114
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
172115
|
+
this.update(homeAssistant.entity);
|
|
172116
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
172117
|
+
}
|
|
172118
|
+
update(entity) {
|
|
172119
|
+
const state = entity.state.state;
|
|
172120
|
+
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
172121
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
172122
|
+
const ugm3 = +state;
|
|
172123
|
+
if (ugm3 <= 10) {
|
|
172124
|
+
airQuality = AirQuality3.AirQualityEnum.Good;
|
|
172125
|
+
} else if (ugm3 <= 25) {
|
|
172126
|
+
airQuality = AirQuality3.AirQualityEnum.Fair;
|
|
172127
|
+
} else if (ugm3 <= 50) {
|
|
172128
|
+
airQuality = AirQuality3.AirQualityEnum.Moderate;
|
|
172129
|
+
} else if (ugm3 <= 100) {
|
|
172130
|
+
airQuality = AirQuality3.AirQualityEnum.Poor;
|
|
172131
|
+
} else if (ugm3 <= 200) {
|
|
172132
|
+
airQuality = AirQuality3.AirQualityEnum.VeryPoor;
|
|
172133
|
+
} else {
|
|
172134
|
+
airQuality = AirQuality3.AirQualityEnum.ExtremelyPoor;
|
|
172135
|
+
}
|
|
172136
|
+
}
|
|
172137
|
+
applyPatchState(this.state, { airQuality });
|
|
172138
|
+
}
|
|
172139
|
+
};
|
|
172140
|
+
var Pm1SensorType = AirQualitySensorDevice.with(
|
|
172141
|
+
BasicInformationServer2,
|
|
172142
|
+
IdentifyServer2,
|
|
172143
|
+
HomeAssistantEntityBehavior,
|
|
172144
|
+
Pm1AirQualityServer,
|
|
172145
|
+
Pm1ConcentrationMeasurementServer2
|
|
172146
|
+
);
|
|
172147
|
+
|
|
171515
172148
|
// src/matter/endpoints/legacy/sensor/devices/pressure-sensor.ts
|
|
171516
172149
|
init_home_assistant_entity_behavior();
|
|
171517
172150
|
var pressureSensorConfig = {
|
|
@@ -171532,6 +172165,99 @@ var PressureSensorType = PressureSensorDevice.with(
|
|
|
171532
172165
|
PressureMeasurementServer2(pressureSensorConfig)
|
|
171533
172166
|
);
|
|
171534
172167
|
|
|
172168
|
+
// src/matter/endpoints/legacy/sensor/devices/radon-sensor.ts
|
|
172169
|
+
init_home_assistant_entity_behavior();
|
|
172170
|
+
|
|
172171
|
+
// src/matter/behaviors/radon-concentration-measurement-server.ts
|
|
172172
|
+
init_home_assistant_entity_behavior();
|
|
172173
|
+
var RadonConcentrationMeasurementServerBase = RadonConcentrationMeasurementServer.with(
|
|
172174
|
+
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
172175
|
+
);
|
|
172176
|
+
var RadonConcentrationMeasurementServer2 = class extends RadonConcentrationMeasurementServerBase {
|
|
172177
|
+
async initialize() {
|
|
172178
|
+
if (this.state.measuredValue === void 0) {
|
|
172179
|
+
this.state.measuredValue = null;
|
|
172180
|
+
}
|
|
172181
|
+
if (this.state.minMeasuredValue === void 0) {
|
|
172182
|
+
this.state.minMeasuredValue = null;
|
|
172183
|
+
}
|
|
172184
|
+
if (this.state.maxMeasuredValue === void 0) {
|
|
172185
|
+
this.state.maxMeasuredValue = null;
|
|
172186
|
+
}
|
|
172187
|
+
if (this.state.uncertainty === void 0) {
|
|
172188
|
+
this.state.uncertainty = 0;
|
|
172189
|
+
}
|
|
172190
|
+
if (this.state.measurementUnit === void 0) {
|
|
172191
|
+
this.state.measurementUnit = ConcentrationMeasurement3.MeasurementUnit.Bqm3;
|
|
172192
|
+
}
|
|
172193
|
+
if (this.state.measurementMedium === void 0) {
|
|
172194
|
+
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
172195
|
+
}
|
|
172196
|
+
await super.initialize();
|
|
172197
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
172198
|
+
this.update(homeAssistant.entity);
|
|
172199
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
172200
|
+
}
|
|
172201
|
+
update(entity) {
|
|
172202
|
+
if (!entity.state) {
|
|
172203
|
+
return;
|
|
172204
|
+
}
|
|
172205
|
+
const state = entity.state.state;
|
|
172206
|
+
let measuredValue = null;
|
|
172207
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
172208
|
+
measuredValue = +state;
|
|
172209
|
+
}
|
|
172210
|
+
applyPatchState(this.state, { measuredValue });
|
|
172211
|
+
}
|
|
172212
|
+
};
|
|
172213
|
+
|
|
172214
|
+
// src/matter/endpoints/legacy/sensor/devices/radon-sensor.ts
|
|
172215
|
+
var RadonAirQualityServerBase = AirQualityServer.with(
|
|
172216
|
+
AirQuality3.Feature.Fair,
|
|
172217
|
+
AirQuality3.Feature.Moderate,
|
|
172218
|
+
AirQuality3.Feature.VeryPoor,
|
|
172219
|
+
AirQuality3.Feature.ExtremelyPoor
|
|
172220
|
+
);
|
|
172221
|
+
var RadonAirQualityServer = class extends RadonAirQualityServerBase {
|
|
172222
|
+
async initialize() {
|
|
172223
|
+
if (this.state.airQuality === void 0) {
|
|
172224
|
+
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
172225
|
+
}
|
|
172226
|
+
await super.initialize();
|
|
172227
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
172228
|
+
this.update(homeAssistant.entity);
|
|
172229
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
172230
|
+
}
|
|
172231
|
+
update(entity) {
|
|
172232
|
+
const state = entity.state.state;
|
|
172233
|
+
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
172234
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
172235
|
+
const bqm3 = +state;
|
|
172236
|
+
if (bqm3 <= 50) {
|
|
172237
|
+
airQuality = AirQuality3.AirQualityEnum.Good;
|
|
172238
|
+
} else if (bqm3 <= 100) {
|
|
172239
|
+
airQuality = AirQuality3.AirQualityEnum.Fair;
|
|
172240
|
+
} else if (bqm3 <= 200) {
|
|
172241
|
+
airQuality = AirQuality3.AirQualityEnum.Moderate;
|
|
172242
|
+
} else if (bqm3 <= 300) {
|
|
172243
|
+
airQuality = AirQuality3.AirQualityEnum.Poor;
|
|
172244
|
+
} else if (bqm3 <= 600) {
|
|
172245
|
+
airQuality = AirQuality3.AirQualityEnum.VeryPoor;
|
|
172246
|
+
} else {
|
|
172247
|
+
airQuality = AirQuality3.AirQualityEnum.ExtremelyPoor;
|
|
172248
|
+
}
|
|
172249
|
+
}
|
|
172250
|
+
applyPatchState(this.state, { airQuality });
|
|
172251
|
+
}
|
|
172252
|
+
};
|
|
172253
|
+
var RadonSensorType = AirQualitySensorDevice.with(
|
|
172254
|
+
BasicInformationServer2,
|
|
172255
|
+
IdentifyServer2,
|
|
172256
|
+
HomeAssistantEntityBehavior,
|
|
172257
|
+
RadonAirQualityServer,
|
|
172258
|
+
RadonConcentrationMeasurementServer2
|
|
172259
|
+
);
|
|
172260
|
+
|
|
171535
172261
|
// src/matter/endpoints/legacy/sensor/devices/temperature-sensor.ts
|
|
171536
172262
|
init_home_assistant_entity_behavior();
|
|
171537
172263
|
var temperatureSensorConfig = {
|
|
@@ -172239,6 +172965,21 @@ function SensorDevice(homeAssistantEntity) {
|
|
|
172239
172965
|
if (deviceClass === SensorDeviceClass.aqi) {
|
|
172240
172966
|
return AirQualitySensorType.set({ homeAssistantEntity });
|
|
172241
172967
|
}
|
|
172968
|
+
if (deviceClass === SensorDeviceClass.carbon_monoxide) {
|
|
172969
|
+
return CarbonMonoxideSensorType.set({ homeAssistantEntity });
|
|
172970
|
+
}
|
|
172971
|
+
if (deviceClass === SensorDeviceClass.nitrogen_dioxide) {
|
|
172972
|
+
return NitrogenDioxideSensorType.set({ homeAssistantEntity });
|
|
172973
|
+
}
|
|
172974
|
+
if (deviceClass === SensorDeviceClass.ozone) {
|
|
172975
|
+
return OzoneSensorType.set({ homeAssistantEntity });
|
|
172976
|
+
}
|
|
172977
|
+
if (deviceClass === SensorDeviceClass.pm1) {
|
|
172978
|
+
return Pm1SensorType.set({ homeAssistantEntity });
|
|
172979
|
+
}
|
|
172980
|
+
if (deviceClass === SensorDeviceClass.power || deviceClass === SensorDeviceClass.energy || deviceClass === SensorDeviceClass.voltage || deviceClass === SensorDeviceClass.current) {
|
|
172981
|
+
return ElectricalSensorType.set({ homeAssistantEntity });
|
|
172982
|
+
}
|
|
172242
172983
|
if (deviceClass === SensorDeviceClass.battery) {
|
|
172243
172984
|
return BatterySensorType.set({ homeAssistantEntity });
|
|
172244
172985
|
}
|
|
@@ -174622,6 +175363,27 @@ var matterDeviceTypeFactories = {
|
|
|
174622
175363
|
tvoc_sensor: (ha) => TvocSensorType.set({
|
|
174623
175364
|
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
174624
175365
|
}),
|
|
175366
|
+
carbon_monoxide_sensor: (ha) => CarbonMonoxideSensorType.set({
|
|
175367
|
+
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
175368
|
+
}),
|
|
175369
|
+
nitrogen_dioxide_sensor: (ha) => NitrogenDioxideSensorType.set({
|
|
175370
|
+
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
175371
|
+
}),
|
|
175372
|
+
ozone_sensor: (ha) => OzoneSensorType.set({
|
|
175373
|
+
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
175374
|
+
}),
|
|
175375
|
+
formaldehyde_sensor: (ha) => FormaldehydeSensorType.set({
|
|
175376
|
+
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
175377
|
+
}),
|
|
175378
|
+
radon_sensor: (ha) => RadonSensorType.set({
|
|
175379
|
+
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
175380
|
+
}),
|
|
175381
|
+
pm1_sensor: (ha) => Pm1SensorType.set({
|
|
175382
|
+
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
175383
|
+
}),
|
|
175384
|
+
electrical_sensor: (ha) => ElectricalSensorType.set({
|
|
175385
|
+
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
175386
|
+
}),
|
|
174625
175387
|
mode_select: SelectDevice,
|
|
174626
175388
|
water_valve: ValveDevice,
|
|
174627
175389
|
pump: PumpEndpoint,
|