@riddix/hamh 2.1.0-alpha.443 → 2.1.0-alpha.445
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";
|
|
@@ -146085,6 +146095,13 @@ var init_clusters2 = __esm({
|
|
|
146085
146095
|
}
|
|
146086
146096
|
});
|
|
146087
146097
|
|
|
146098
|
+
// ../common/dist/controller-profiles.js
|
|
146099
|
+
var init_controller_profiles = __esm({
|
|
146100
|
+
"../common/dist/controller-profiles.js"() {
|
|
146101
|
+
"use strict";
|
|
146102
|
+
}
|
|
146103
|
+
});
|
|
146104
|
+
|
|
146088
146105
|
// ../common/dist/diagnostic-event.js
|
|
146089
146106
|
var init_diagnostic_event = __esm({
|
|
146090
146107
|
"../common/dist/diagnostic-event.js"() {
|
|
@@ -146999,6 +147016,7 @@ var init_dist = __esm({
|
|
|
146999
147016
|
init_bridge_export();
|
|
147000
147017
|
init_bridge_templates();
|
|
147001
147018
|
init_clusters2();
|
|
147019
|
+
init_controller_profiles();
|
|
147002
147020
|
init_diagnostic_event();
|
|
147003
147021
|
init_domains();
|
|
147004
147022
|
init_endpoint_data();
|
|
@@ -149304,6 +149322,73 @@ function matterApi(bridgeService, haRegistry) {
|
|
|
149304
149322
|
areas.sort((a, b) => a.name.localeCompare(b.name));
|
|
149305
149323
|
res.status(200).json(areas);
|
|
149306
149324
|
});
|
|
149325
|
+
router.get("/areas/summary", async (_, res) => {
|
|
149326
|
+
if (!haRegistry) {
|
|
149327
|
+
res.status(503).json({ error: "Home Assistant registry not available" });
|
|
149328
|
+
return;
|
|
149329
|
+
}
|
|
149330
|
+
const supportedDomains = /* @__PURE__ */ new Set([
|
|
149331
|
+
"light",
|
|
149332
|
+
"switch",
|
|
149333
|
+
"sensor",
|
|
149334
|
+
"binary_sensor",
|
|
149335
|
+
"climate",
|
|
149336
|
+
"cover",
|
|
149337
|
+
"fan",
|
|
149338
|
+
"lock",
|
|
149339
|
+
"media_player",
|
|
149340
|
+
"vacuum",
|
|
149341
|
+
"valve",
|
|
149342
|
+
"humidifier",
|
|
149343
|
+
"water_heater",
|
|
149344
|
+
"select",
|
|
149345
|
+
"input_select",
|
|
149346
|
+
"input_boolean",
|
|
149347
|
+
"alarm_control_panel",
|
|
149348
|
+
"event",
|
|
149349
|
+
"automation",
|
|
149350
|
+
"script",
|
|
149351
|
+
"scene"
|
|
149352
|
+
]);
|
|
149353
|
+
const entities = Object.values(haRegistry.entities);
|
|
149354
|
+
const devices = haRegistry.devices;
|
|
149355
|
+
const states = haRegistry.states;
|
|
149356
|
+
const areaSummary = /* @__PURE__ */ new Map();
|
|
149357
|
+
for (const [areaId, areaName] of haRegistry.areas) {
|
|
149358
|
+
areaSummary.set(areaId, { name: areaName, entityCount: 0, domains: {} });
|
|
149359
|
+
}
|
|
149360
|
+
for (const entity of entities) {
|
|
149361
|
+
if (entity.disabled_by != null) continue;
|
|
149362
|
+
const domain = entity.entity_id.split(".")[0];
|
|
149363
|
+
if (!supportedDomains.has(domain)) continue;
|
|
149364
|
+
const state = states[entity.entity_id];
|
|
149365
|
+
if (!state || state.state === "unavailable") continue;
|
|
149366
|
+
let areaId;
|
|
149367
|
+
const entityAreaId = entity.area_id;
|
|
149368
|
+
if (entityAreaId && haRegistry.areas.has(entityAreaId)) {
|
|
149369
|
+
areaId = entityAreaId;
|
|
149370
|
+
} else {
|
|
149371
|
+
const device = entity.device_id ? devices[entity.device_id] : void 0;
|
|
149372
|
+
const deviceAreaId = device?.area_id;
|
|
149373
|
+
if (deviceAreaId && haRegistry.areas.has(deviceAreaId)) {
|
|
149374
|
+
areaId = deviceAreaId;
|
|
149375
|
+
}
|
|
149376
|
+
}
|
|
149377
|
+
if (!areaId) continue;
|
|
149378
|
+
const summary = areaSummary.get(areaId);
|
|
149379
|
+
if (summary) {
|
|
149380
|
+
summary.entityCount++;
|
|
149381
|
+
summary.domains[domain] = (summary.domains[domain] || 0) + 1;
|
|
149382
|
+
}
|
|
149383
|
+
}
|
|
149384
|
+
const result = [...areaSummary.entries()].map(([area_id, data]) => ({
|
|
149385
|
+
area_id,
|
|
149386
|
+
name: data.name,
|
|
149387
|
+
entityCount: data.entityCount,
|
|
149388
|
+
domains: data.domains
|
|
149389
|
+
})).sort((a, b) => a.name.localeCompare(b.name));
|
|
149390
|
+
res.status(200).json(result);
|
|
149391
|
+
});
|
|
149307
149392
|
router.get("/filter-values", async (_, res) => {
|
|
149308
149393
|
if (!haRegistry) {
|
|
149309
149394
|
res.status(503).json({ error: "Home Assistant registry not available" });
|
|
@@ -162249,6 +162334,7 @@ var SolarPowerDeviceDefinition = MutableEndpoint({
|
|
|
162249
162334
|
behaviors: SupportedBehaviors()
|
|
162250
162335
|
});
|
|
162251
162336
|
Object.freeze(SolarPowerDeviceDefinition);
|
|
162337
|
+
var SolarPowerDevice = SolarPowerDeviceDefinition;
|
|
162252
162338
|
|
|
162253
162339
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/devices/speaker.js
|
|
162254
162340
|
init_MutableEndpoint();
|
|
@@ -169354,6 +169440,12 @@ init_home_assistant_entity_behavior();
|
|
|
169354
169440
|
var logger170 = Logger.get("ColorControlServer");
|
|
169355
169441
|
var optimisticColorTimestamps = /* @__PURE__ */ new Map();
|
|
169356
169442
|
var OPTIMISTIC_COLOR_COOLDOWN_MS = 2e3;
|
|
169443
|
+
var pendingColorStaging = /* @__PURE__ */ new Map();
|
|
169444
|
+
function consumePendingColorStaging(entityId) {
|
|
169445
|
+
const data = pendingColorStaging.get(entityId);
|
|
169446
|
+
pendingColorStaging.delete(entityId);
|
|
169447
|
+
return data;
|
|
169448
|
+
}
|
|
169357
169449
|
var FeaturedBase7 = ColorControlServer.with("ColorTemperature", "HueSaturation");
|
|
169358
169450
|
var ColorControlServerBase = class extends FeaturedBase7 {
|
|
169359
169451
|
pendingTransitionTime;
|
|
@@ -169491,6 +169583,10 @@ var ColorControlServerBase = class extends FeaturedBase7 {
|
|
|
169491
169583
|
colorMode: ColorControl3.ColorMode.ColorTemperatureMireds
|
|
169492
169584
|
});
|
|
169493
169585
|
optimisticColorTimestamps.set(homeAssistant.entityId, Date.now());
|
|
169586
|
+
if (this.isLightOff()) {
|
|
169587
|
+
pendingColorStaging.set(homeAssistant.entityId, action.data ?? {});
|
|
169588
|
+
return;
|
|
169589
|
+
}
|
|
169494
169590
|
homeAssistant.callAction(action);
|
|
169495
169591
|
}
|
|
169496
169592
|
moveToHueLogic(targetHue) {
|
|
@@ -169522,8 +169618,16 @@ var ColorControlServerBase = class extends FeaturedBase7 {
|
|
|
169522
169618
|
colorMode: ColorControl3.ColorMode.CurrentHueAndCurrentSaturation
|
|
169523
169619
|
});
|
|
169524
169620
|
optimisticColorTimestamps.set(homeAssistant.entityId, Date.now());
|
|
169621
|
+
if (this.isLightOff()) {
|
|
169622
|
+
pendingColorStaging.set(homeAssistant.entityId, action.data ?? {});
|
|
169623
|
+
return;
|
|
169624
|
+
}
|
|
169525
169625
|
homeAssistant.callAction(action);
|
|
169526
169626
|
}
|
|
169627
|
+
isLightOff() {
|
|
169628
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
169629
|
+
return homeAssistant.entity.state.state === "off";
|
|
169630
|
+
}
|
|
169527
169631
|
applyTransition(action) {
|
|
169528
169632
|
const tenths = this.pendingTransitionTime;
|
|
169529
169633
|
this.pendingTransitionTime = void 0;
|
|
@@ -169623,12 +169727,16 @@ var LightLevelControlServer = LevelControlServer2(config8).with(
|
|
|
169623
169727
|
);
|
|
169624
169728
|
|
|
169625
169729
|
// src/matter/endpoints/legacy/light/behaviors/light-on-off-server.ts
|
|
169730
|
+
init_home_assistant_entity_behavior();
|
|
169626
169731
|
var LightOnOffServer = OnOffServer2({
|
|
169627
|
-
turnOn: () =>
|
|
169628
|
-
|
|
169629
|
-
|
|
169630
|
-
|
|
169631
|
-
|
|
169732
|
+
turnOn: (_value, agent) => {
|
|
169733
|
+
const entityId = agent.get(HomeAssistantEntityBehavior).entityId;
|
|
169734
|
+
const staged = consumePendingColorStaging(entityId);
|
|
169735
|
+
return {
|
|
169736
|
+
action: "light.turn_on",
|
|
169737
|
+
data: staged
|
|
169738
|
+
};
|
|
169739
|
+
},
|
|
169632
169740
|
turnOff: () => ({
|
|
169633
169741
|
action: "homeassistant.turn_off"
|
|
169634
169742
|
}),
|
|
@@ -171286,6 +171394,206 @@ var BatterySensorType = BatteryStorageDevice.with(
|
|
|
171286
171394
|
})
|
|
171287
171395
|
);
|
|
171288
171396
|
|
|
171397
|
+
// src/matter/behaviors/carbon-monoxide-concentration-measurement-server.ts
|
|
171398
|
+
init_home_assistant_entity_behavior();
|
|
171399
|
+
var CarbonMonoxideConcentrationMeasurementServerBase = CarbonMonoxideConcentrationMeasurementServer.with(
|
|
171400
|
+
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
171401
|
+
);
|
|
171402
|
+
var CarbonMonoxideConcentrationMeasurementServer2 = class extends CarbonMonoxideConcentrationMeasurementServerBase {
|
|
171403
|
+
async initialize() {
|
|
171404
|
+
if (this.state.measuredValue === void 0) {
|
|
171405
|
+
this.state.measuredValue = null;
|
|
171406
|
+
}
|
|
171407
|
+
if (this.state.minMeasuredValue === void 0) {
|
|
171408
|
+
this.state.minMeasuredValue = null;
|
|
171409
|
+
}
|
|
171410
|
+
if (this.state.maxMeasuredValue === void 0) {
|
|
171411
|
+
this.state.maxMeasuredValue = null;
|
|
171412
|
+
}
|
|
171413
|
+
if (this.state.uncertainty === void 0) {
|
|
171414
|
+
this.state.uncertainty = 0;
|
|
171415
|
+
}
|
|
171416
|
+
if (this.state.measurementUnit === void 0) {
|
|
171417
|
+
this.state.measurementUnit = ConcentrationMeasurement3.MeasurementUnit.Ppm;
|
|
171418
|
+
}
|
|
171419
|
+
if (this.state.measurementMedium === void 0) {
|
|
171420
|
+
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
171421
|
+
}
|
|
171422
|
+
await super.initialize();
|
|
171423
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171424
|
+
this.update(homeAssistant.entity);
|
|
171425
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171426
|
+
}
|
|
171427
|
+
update(entity) {
|
|
171428
|
+
if (!entity.state) {
|
|
171429
|
+
return;
|
|
171430
|
+
}
|
|
171431
|
+
const state = entity.state.state;
|
|
171432
|
+
let measuredValue = null;
|
|
171433
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
171434
|
+
measuredValue = +state;
|
|
171435
|
+
}
|
|
171436
|
+
applyPatchState(this.state, { measuredValue });
|
|
171437
|
+
}
|
|
171438
|
+
};
|
|
171439
|
+
|
|
171440
|
+
// src/matter/endpoints/legacy/sensor/devices/carbon-monoxide-sensor.ts
|
|
171441
|
+
init_home_assistant_entity_behavior();
|
|
171442
|
+
var CoAirQualityServerBase = AirQualityServer.with(
|
|
171443
|
+
AirQuality3.Feature.Fair,
|
|
171444
|
+
AirQuality3.Feature.Moderate,
|
|
171445
|
+
AirQuality3.Feature.VeryPoor,
|
|
171446
|
+
AirQuality3.Feature.ExtremelyPoor
|
|
171447
|
+
);
|
|
171448
|
+
var CoAirQualityServer = class extends CoAirQualityServerBase {
|
|
171449
|
+
async initialize() {
|
|
171450
|
+
if (this.state.airQuality === void 0) {
|
|
171451
|
+
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
171452
|
+
}
|
|
171453
|
+
await super.initialize();
|
|
171454
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171455
|
+
this.update(homeAssistant.entity);
|
|
171456
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171457
|
+
}
|
|
171458
|
+
update(entity) {
|
|
171459
|
+
const state = entity.state.state;
|
|
171460
|
+
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
171461
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
171462
|
+
const ppm = +state;
|
|
171463
|
+
if (ppm <= 9) {
|
|
171464
|
+
airQuality = AirQuality3.AirQualityEnum.Good;
|
|
171465
|
+
} else if (ppm <= 25) {
|
|
171466
|
+
airQuality = AirQuality3.AirQualityEnum.Fair;
|
|
171467
|
+
} else if (ppm <= 50) {
|
|
171468
|
+
airQuality = AirQuality3.AirQualityEnum.Moderate;
|
|
171469
|
+
} else if (ppm <= 100) {
|
|
171470
|
+
airQuality = AirQuality3.AirQualityEnum.Poor;
|
|
171471
|
+
} else if (ppm <= 200) {
|
|
171472
|
+
airQuality = AirQuality3.AirQualityEnum.VeryPoor;
|
|
171473
|
+
} else {
|
|
171474
|
+
airQuality = AirQuality3.AirQualityEnum.ExtremelyPoor;
|
|
171475
|
+
}
|
|
171476
|
+
}
|
|
171477
|
+
applyPatchState(this.state, { airQuality });
|
|
171478
|
+
}
|
|
171479
|
+
};
|
|
171480
|
+
var CarbonMonoxideSensorType = AirQualitySensorDevice.with(
|
|
171481
|
+
BasicInformationServer2,
|
|
171482
|
+
IdentifyServer2,
|
|
171483
|
+
HomeAssistantEntityBehavior,
|
|
171484
|
+
CoAirQualityServer,
|
|
171485
|
+
CarbonMonoxideConcentrationMeasurementServer2
|
|
171486
|
+
);
|
|
171487
|
+
|
|
171488
|
+
// src/matter/endpoints/legacy/sensor/devices/electrical-sensor.ts
|
|
171489
|
+
init_dist();
|
|
171490
|
+
init_home_assistant_entity_behavior();
|
|
171491
|
+
var StandalonePowerServer = class extends ElectricalPowerMeasurementServer {
|
|
171492
|
+
async initialize() {
|
|
171493
|
+
await super.initialize();
|
|
171494
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171495
|
+
this.update(homeAssistant.entity);
|
|
171496
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171497
|
+
}
|
|
171498
|
+
update(entity) {
|
|
171499
|
+
const state = entity.state.state;
|
|
171500
|
+
if (state == null || Number.isNaN(+state)) return;
|
|
171501
|
+
const attrs = entity.state.attributes;
|
|
171502
|
+
const dc = attrs.device_class;
|
|
171503
|
+
if (dc === SensorDeviceClass.power) {
|
|
171504
|
+
applyPatchState(this.state, {
|
|
171505
|
+
activePower: Math.round(+state * 1e3)
|
|
171506
|
+
});
|
|
171507
|
+
} else if (dc === SensorDeviceClass.voltage) {
|
|
171508
|
+
applyPatchState(this.state, {
|
|
171509
|
+
voltage: Math.round(+state * 1e3)
|
|
171510
|
+
});
|
|
171511
|
+
} else if (dc === SensorDeviceClass.current) {
|
|
171512
|
+
applyPatchState(this.state, {
|
|
171513
|
+
activeCurrent: Math.round(+state * 1e3)
|
|
171514
|
+
});
|
|
171515
|
+
}
|
|
171516
|
+
}
|
|
171517
|
+
};
|
|
171518
|
+
((StandalonePowerServer2) => {
|
|
171519
|
+
class State extends ElectricalPowerMeasurementServer.State {
|
|
171520
|
+
}
|
|
171521
|
+
StandalonePowerServer2.State = State;
|
|
171522
|
+
})(StandalonePowerServer || (StandalonePowerServer = {}));
|
|
171523
|
+
var PowerServer = StandalonePowerServer.set({
|
|
171524
|
+
powerMode: ElectricalPowerMeasurement3.PowerMode.Ac,
|
|
171525
|
+
numberOfMeasurementTypes: 1,
|
|
171526
|
+
accuracy: [
|
|
171527
|
+
{
|
|
171528
|
+
measurementType: ElectricalPowerMeasurement3.MeasurementType.ActivePower,
|
|
171529
|
+
measured: true,
|
|
171530
|
+
minMeasuredValue: -1e6,
|
|
171531
|
+
maxMeasuredValue: 1e8,
|
|
171532
|
+
accuracyRanges: [
|
|
171533
|
+
{
|
|
171534
|
+
rangeMin: -1e6,
|
|
171535
|
+
rangeMax: 1e8,
|
|
171536
|
+
fixedMax: 1e3
|
|
171537
|
+
}
|
|
171538
|
+
]
|
|
171539
|
+
}
|
|
171540
|
+
]
|
|
171541
|
+
});
|
|
171542
|
+
var EnergyFeaturedBase = ElectricalEnergyMeasurementServer.with(
|
|
171543
|
+
"CumulativeEnergy",
|
|
171544
|
+
"ImportedEnergy"
|
|
171545
|
+
);
|
|
171546
|
+
var StandaloneEnergyServer = class extends EnergyFeaturedBase {
|
|
171547
|
+
async initialize() {
|
|
171548
|
+
await super.initialize();
|
|
171549
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171550
|
+
this.update(homeAssistant.entity);
|
|
171551
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171552
|
+
}
|
|
171553
|
+
update(entity) {
|
|
171554
|
+
const attrs = entity.state.attributes;
|
|
171555
|
+
if (attrs.device_class !== SensorDeviceClass.energy) return;
|
|
171556
|
+
const state = entity.state.state;
|
|
171557
|
+
if (state == null || Number.isNaN(+state)) return;
|
|
171558
|
+
const energyMwh = Math.round(+state * 1e6);
|
|
171559
|
+
const energyImported = { energy: energyMwh };
|
|
171560
|
+
applyPatchState(this.state, {
|
|
171561
|
+
cumulativeEnergyImported: energyImported
|
|
171562
|
+
});
|
|
171563
|
+
this.events.cumulativeEnergyMeasured?.emit(
|
|
171564
|
+
{ energyImported, energyExported: void 0 },
|
|
171565
|
+
this.context
|
|
171566
|
+
);
|
|
171567
|
+
}
|
|
171568
|
+
};
|
|
171569
|
+
((StandaloneEnergyServer2) => {
|
|
171570
|
+
class State extends EnergyFeaturedBase.State {
|
|
171571
|
+
}
|
|
171572
|
+
StandaloneEnergyServer2.State = State;
|
|
171573
|
+
})(StandaloneEnergyServer || (StandaloneEnergyServer = {}));
|
|
171574
|
+
var EnergyServer = StandaloneEnergyServer.set({
|
|
171575
|
+
accuracy: {
|
|
171576
|
+
measurementType: ElectricalPowerMeasurement3.MeasurementType.ElectricalEnergy,
|
|
171577
|
+
measured: true,
|
|
171578
|
+
minMeasuredValue: -1e6,
|
|
171579
|
+
maxMeasuredValue: 1e11,
|
|
171580
|
+
accuracyRanges: [
|
|
171581
|
+
{
|
|
171582
|
+
rangeMin: -1e6,
|
|
171583
|
+
rangeMax: 1e11,
|
|
171584
|
+
fixedMax: 1e3
|
|
171585
|
+
}
|
|
171586
|
+
]
|
|
171587
|
+
}
|
|
171588
|
+
});
|
|
171589
|
+
var ElectricalSensorType = SolarPowerDevice.with(
|
|
171590
|
+
BasicInformationServer2,
|
|
171591
|
+
IdentifyServer2,
|
|
171592
|
+
HomeAssistantEntityBehavior,
|
|
171593
|
+
PowerServer,
|
|
171594
|
+
EnergyServer
|
|
171595
|
+
);
|
|
171596
|
+
|
|
171289
171597
|
// src/matter/behaviors/flow-measurement-server.ts
|
|
171290
171598
|
init_home_assistant_entity_behavior();
|
|
171291
171599
|
var FlowMeasurementServerBase = class extends FlowMeasurementServer {
|
|
@@ -171357,30 +171665,31 @@ var FlowSensorType = FlowSensorDevice.with(
|
|
|
171357
171665
|
FlowMeasurementServer2(flowSensorConfig)
|
|
171358
171666
|
);
|
|
171359
171667
|
|
|
171360
|
-
// src/matter/
|
|
171668
|
+
// src/matter/behaviors/formaldehyde-concentration-measurement-server.ts
|
|
171361
171669
|
init_home_assistant_entity_behavior();
|
|
171362
|
-
var
|
|
171363
|
-
|
|
171364
|
-
if (state == null || Number.isNaN(+state)) {
|
|
171365
|
-
return null;
|
|
171366
|
-
}
|
|
171367
|
-
return +state;
|
|
171368
|
-
}
|
|
171369
|
-
};
|
|
171370
|
-
var HumiditySensorType = HumiditySensorDevice.with(
|
|
171371
|
-
BasicInformationServer2,
|
|
171372
|
-
IdentifyServer2,
|
|
171373
|
-
HomeAssistantEntityBehavior,
|
|
171374
|
-
HumidityMeasurementServer(humiditySensorConfig)
|
|
171670
|
+
var FormaldehydeConcentrationMeasurementServerBase = FormaldehydeConcentrationMeasurementServer.with(
|
|
171671
|
+
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
171375
171672
|
);
|
|
171376
|
-
|
|
171377
|
-
// src/matter/endpoints/legacy/sensor/devices/illuminance-sensor.ts
|
|
171378
|
-
init_home_assistant_entity_behavior();
|
|
171379
|
-
|
|
171380
|
-
// src/matter/behaviors/illuminance-measurement-server.ts
|
|
171381
|
-
init_home_assistant_entity_behavior();
|
|
171382
|
-
var IlluminanceMeasurementServerBase = class extends IlluminanceMeasurementServer {
|
|
171673
|
+
var FormaldehydeConcentrationMeasurementServer2 = class extends FormaldehydeConcentrationMeasurementServerBase {
|
|
171383
171674
|
async initialize() {
|
|
171675
|
+
if (this.state.measuredValue === void 0) {
|
|
171676
|
+
this.state.measuredValue = null;
|
|
171677
|
+
}
|
|
171678
|
+
if (this.state.minMeasuredValue === void 0) {
|
|
171679
|
+
this.state.minMeasuredValue = null;
|
|
171680
|
+
}
|
|
171681
|
+
if (this.state.maxMeasuredValue === void 0) {
|
|
171682
|
+
this.state.maxMeasuredValue = null;
|
|
171683
|
+
}
|
|
171684
|
+
if (this.state.uncertainty === void 0) {
|
|
171685
|
+
this.state.uncertainty = 0;
|
|
171686
|
+
}
|
|
171687
|
+
if (this.state.measurementUnit === void 0) {
|
|
171688
|
+
this.state.measurementUnit = ConcentrationMeasurement3.MeasurementUnit.Ugm3;
|
|
171689
|
+
}
|
|
171690
|
+
if (this.state.measurementMedium === void 0) {
|
|
171691
|
+
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
171692
|
+
}
|
|
171384
171693
|
await super.initialize();
|
|
171385
171694
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171386
171695
|
this.update(homeAssistant.entity);
|
|
@@ -171390,29 +171699,119 @@ var IlluminanceMeasurementServerBase = class extends IlluminanceMeasurementServe
|
|
|
171390
171699
|
if (!entity.state) {
|
|
171391
171700
|
return;
|
|
171392
171701
|
}
|
|
171393
|
-
const
|
|
171394
|
-
|
|
171395
|
-
|
|
171396
|
-
|
|
171397
|
-
// Matter spec requires minMeasuredValue >= 1 for IlluminanceMeasurement
|
|
171398
|
-
minMeasuredValue: 1,
|
|
171399
|
-
maxMeasuredValue: 65534
|
|
171400
|
-
});
|
|
171401
|
-
}
|
|
171402
|
-
getIlluminance(config10, entity) {
|
|
171403
|
-
const illuminance = config10.getValue(entity, this.agent);
|
|
171404
|
-
if (illuminance == null) {
|
|
171405
|
-
return null;
|
|
171406
|
-
}
|
|
171407
|
-
if (illuminance < 1) {
|
|
171408
|
-
return 0;
|
|
171702
|
+
const state = entity.state.state;
|
|
171703
|
+
let measuredValue = null;
|
|
171704
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
171705
|
+
measuredValue = +state;
|
|
171409
171706
|
}
|
|
171410
|
-
|
|
171411
|
-
return Math.min(65534, Math.max(1, measuredValue));
|
|
171707
|
+
applyPatchState(this.state, { measuredValue });
|
|
171412
171708
|
}
|
|
171413
171709
|
};
|
|
171414
|
-
|
|
171415
|
-
|
|
171710
|
+
|
|
171711
|
+
// src/matter/endpoints/legacy/sensor/devices/formaldehyde-sensor.ts
|
|
171712
|
+
init_home_assistant_entity_behavior();
|
|
171713
|
+
var FormaldehydeAirQualityServerBase = AirQualityServer.with(
|
|
171714
|
+
AirQuality3.Feature.Fair,
|
|
171715
|
+
AirQuality3.Feature.Moderate,
|
|
171716
|
+
AirQuality3.Feature.VeryPoor,
|
|
171717
|
+
AirQuality3.Feature.ExtremelyPoor
|
|
171718
|
+
);
|
|
171719
|
+
var FormaldehydeAirQualityServer = class extends FormaldehydeAirQualityServerBase {
|
|
171720
|
+
async initialize() {
|
|
171721
|
+
if (this.state.airQuality === void 0) {
|
|
171722
|
+
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
171723
|
+
}
|
|
171724
|
+
await super.initialize();
|
|
171725
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171726
|
+
this.update(homeAssistant.entity);
|
|
171727
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171728
|
+
}
|
|
171729
|
+
update(entity) {
|
|
171730
|
+
const state = entity.state.state;
|
|
171731
|
+
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
171732
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
171733
|
+
const ugm3 = +state;
|
|
171734
|
+
if (ugm3 <= 30) {
|
|
171735
|
+
airQuality = AirQuality3.AirQualityEnum.Good;
|
|
171736
|
+
} else if (ugm3 <= 60) {
|
|
171737
|
+
airQuality = AirQuality3.AirQualityEnum.Fair;
|
|
171738
|
+
} else if (ugm3 <= 100) {
|
|
171739
|
+
airQuality = AirQuality3.AirQualityEnum.Moderate;
|
|
171740
|
+
} else if (ugm3 <= 200) {
|
|
171741
|
+
airQuality = AirQuality3.AirQualityEnum.Poor;
|
|
171742
|
+
} else if (ugm3 <= 500) {
|
|
171743
|
+
airQuality = AirQuality3.AirQualityEnum.VeryPoor;
|
|
171744
|
+
} else {
|
|
171745
|
+
airQuality = AirQuality3.AirQualityEnum.ExtremelyPoor;
|
|
171746
|
+
}
|
|
171747
|
+
}
|
|
171748
|
+
applyPatchState(this.state, { airQuality });
|
|
171749
|
+
}
|
|
171750
|
+
};
|
|
171751
|
+
var FormaldehydeSensorType = AirQualitySensorDevice.with(
|
|
171752
|
+
BasicInformationServer2,
|
|
171753
|
+
IdentifyServer2,
|
|
171754
|
+
HomeAssistantEntityBehavior,
|
|
171755
|
+
FormaldehydeAirQualityServer,
|
|
171756
|
+
FormaldehydeConcentrationMeasurementServer2
|
|
171757
|
+
);
|
|
171758
|
+
|
|
171759
|
+
// src/matter/endpoints/legacy/sensor/devices/humidity-sensor.ts
|
|
171760
|
+
init_home_assistant_entity_behavior();
|
|
171761
|
+
var humiditySensorConfig = {
|
|
171762
|
+
getValue({ state }) {
|
|
171763
|
+
if (state == null || Number.isNaN(+state)) {
|
|
171764
|
+
return null;
|
|
171765
|
+
}
|
|
171766
|
+
return +state;
|
|
171767
|
+
}
|
|
171768
|
+
};
|
|
171769
|
+
var HumiditySensorType = HumiditySensorDevice.with(
|
|
171770
|
+
BasicInformationServer2,
|
|
171771
|
+
IdentifyServer2,
|
|
171772
|
+
HomeAssistantEntityBehavior,
|
|
171773
|
+
HumidityMeasurementServer(humiditySensorConfig)
|
|
171774
|
+
);
|
|
171775
|
+
|
|
171776
|
+
// src/matter/endpoints/legacy/sensor/devices/illuminance-sensor.ts
|
|
171777
|
+
init_home_assistant_entity_behavior();
|
|
171778
|
+
|
|
171779
|
+
// src/matter/behaviors/illuminance-measurement-server.ts
|
|
171780
|
+
init_home_assistant_entity_behavior();
|
|
171781
|
+
var IlluminanceMeasurementServerBase = class extends IlluminanceMeasurementServer {
|
|
171782
|
+
async initialize() {
|
|
171783
|
+
await super.initialize();
|
|
171784
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171785
|
+
this.update(homeAssistant.entity);
|
|
171786
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171787
|
+
}
|
|
171788
|
+
update(entity) {
|
|
171789
|
+
if (!entity.state) {
|
|
171790
|
+
return;
|
|
171791
|
+
}
|
|
171792
|
+
const illuminance = this.getIlluminance(this.state.config, entity.state);
|
|
171793
|
+
applyPatchState(this.state, {
|
|
171794
|
+
measuredValue: illuminance,
|
|
171795
|
+
// min/max values: 1 (min valid) to 0xFFFE (max illuminance in log scale)
|
|
171796
|
+
// Matter spec requires minMeasuredValue >= 1 for IlluminanceMeasurement
|
|
171797
|
+
minMeasuredValue: 1,
|
|
171798
|
+
maxMeasuredValue: 65534
|
|
171799
|
+
});
|
|
171800
|
+
}
|
|
171801
|
+
getIlluminance(config10, entity) {
|
|
171802
|
+
const illuminance = config10.getValue(entity, this.agent);
|
|
171803
|
+
if (illuminance == null) {
|
|
171804
|
+
return null;
|
|
171805
|
+
}
|
|
171806
|
+
if (illuminance < 1) {
|
|
171807
|
+
return 0;
|
|
171808
|
+
}
|
|
171809
|
+
const measuredValue = Math.round(1e4 * Math.log10(illuminance) + 1);
|
|
171810
|
+
return Math.min(65534, Math.max(1, measuredValue));
|
|
171811
|
+
}
|
|
171812
|
+
};
|
|
171813
|
+
((IlluminanceMeasurementServerBase2) => {
|
|
171814
|
+
class State extends IlluminanceMeasurementServer.State {
|
|
171416
171815
|
config;
|
|
171417
171816
|
}
|
|
171418
171817
|
IlluminanceMeasurementServerBase2.State = State;
|
|
@@ -171437,6 +171836,285 @@ var IlluminanceSensorType = LightSensorDevice.with(
|
|
|
171437
171836
|
IlluminanceMeasurementServer2(illuminanceSensorConfig)
|
|
171438
171837
|
);
|
|
171439
171838
|
|
|
171839
|
+
// src/matter/endpoints/legacy/sensor/devices/nitrogen-dioxide-sensor.ts
|
|
171840
|
+
init_home_assistant_entity_behavior();
|
|
171841
|
+
|
|
171842
|
+
// src/matter/behaviors/nitrogen-dioxide-concentration-measurement-server.ts
|
|
171843
|
+
init_home_assistant_entity_behavior();
|
|
171844
|
+
var NitrogenDioxideConcentrationMeasurementServerBase = NitrogenDioxideConcentrationMeasurementServer.with(
|
|
171845
|
+
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
171846
|
+
);
|
|
171847
|
+
var NitrogenDioxideConcentrationMeasurementServer2 = class extends NitrogenDioxideConcentrationMeasurementServerBase {
|
|
171848
|
+
async initialize() {
|
|
171849
|
+
if (this.state.measuredValue === void 0) {
|
|
171850
|
+
this.state.measuredValue = null;
|
|
171851
|
+
}
|
|
171852
|
+
if (this.state.minMeasuredValue === void 0) {
|
|
171853
|
+
this.state.minMeasuredValue = null;
|
|
171854
|
+
}
|
|
171855
|
+
if (this.state.maxMeasuredValue === void 0) {
|
|
171856
|
+
this.state.maxMeasuredValue = null;
|
|
171857
|
+
}
|
|
171858
|
+
if (this.state.uncertainty === void 0) {
|
|
171859
|
+
this.state.uncertainty = 0;
|
|
171860
|
+
}
|
|
171861
|
+
if (this.state.measurementUnit === void 0) {
|
|
171862
|
+
this.state.measurementUnit = ConcentrationMeasurement3.MeasurementUnit.Ugm3;
|
|
171863
|
+
}
|
|
171864
|
+
if (this.state.measurementMedium === void 0) {
|
|
171865
|
+
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
171866
|
+
}
|
|
171867
|
+
await super.initialize();
|
|
171868
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171869
|
+
this.update(homeAssistant.entity);
|
|
171870
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171871
|
+
}
|
|
171872
|
+
update(entity) {
|
|
171873
|
+
if (!entity.state) {
|
|
171874
|
+
return;
|
|
171875
|
+
}
|
|
171876
|
+
const state = entity.state.state;
|
|
171877
|
+
let measuredValue = null;
|
|
171878
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
171879
|
+
measuredValue = +state;
|
|
171880
|
+
}
|
|
171881
|
+
applyPatchState(this.state, { measuredValue });
|
|
171882
|
+
}
|
|
171883
|
+
};
|
|
171884
|
+
|
|
171885
|
+
// src/matter/endpoints/legacy/sensor/devices/nitrogen-dioxide-sensor.ts
|
|
171886
|
+
var No2AirQualityServerBase = AirQualityServer.with(
|
|
171887
|
+
AirQuality3.Feature.Fair,
|
|
171888
|
+
AirQuality3.Feature.Moderate,
|
|
171889
|
+
AirQuality3.Feature.VeryPoor,
|
|
171890
|
+
AirQuality3.Feature.ExtremelyPoor
|
|
171891
|
+
);
|
|
171892
|
+
var No2AirQualityServer = class extends No2AirQualityServerBase {
|
|
171893
|
+
async initialize() {
|
|
171894
|
+
if (this.state.airQuality === void 0) {
|
|
171895
|
+
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
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
|
+
const state = entity.state.state;
|
|
171904
|
+
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
171905
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
171906
|
+
const ugm3 = +state;
|
|
171907
|
+
if (ugm3 <= 25) {
|
|
171908
|
+
airQuality = AirQuality3.AirQualityEnum.Good;
|
|
171909
|
+
} else if (ugm3 <= 50) {
|
|
171910
|
+
airQuality = AirQuality3.AirQualityEnum.Fair;
|
|
171911
|
+
} else if (ugm3 <= 100) {
|
|
171912
|
+
airQuality = AirQuality3.AirQualityEnum.Moderate;
|
|
171913
|
+
} else if (ugm3 <= 200) {
|
|
171914
|
+
airQuality = AirQuality3.AirQualityEnum.Poor;
|
|
171915
|
+
} else if (ugm3 <= 400) {
|
|
171916
|
+
airQuality = AirQuality3.AirQualityEnum.VeryPoor;
|
|
171917
|
+
} else {
|
|
171918
|
+
airQuality = AirQuality3.AirQualityEnum.ExtremelyPoor;
|
|
171919
|
+
}
|
|
171920
|
+
}
|
|
171921
|
+
applyPatchState(this.state, { airQuality });
|
|
171922
|
+
}
|
|
171923
|
+
};
|
|
171924
|
+
var NitrogenDioxideSensorType = AirQualitySensorDevice.with(
|
|
171925
|
+
BasicInformationServer2,
|
|
171926
|
+
IdentifyServer2,
|
|
171927
|
+
HomeAssistantEntityBehavior,
|
|
171928
|
+
No2AirQualityServer,
|
|
171929
|
+
NitrogenDioxideConcentrationMeasurementServer2
|
|
171930
|
+
);
|
|
171931
|
+
|
|
171932
|
+
// src/matter/endpoints/legacy/sensor/devices/ozone-sensor.ts
|
|
171933
|
+
init_home_assistant_entity_behavior();
|
|
171934
|
+
|
|
171935
|
+
// src/matter/behaviors/ozone-concentration-measurement-server.ts
|
|
171936
|
+
init_home_assistant_entity_behavior();
|
|
171937
|
+
var OzoneConcentrationMeasurementServerBase = OzoneConcentrationMeasurementServer.with(
|
|
171938
|
+
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
171939
|
+
);
|
|
171940
|
+
var OzoneConcentrationMeasurementServer2 = class extends OzoneConcentrationMeasurementServerBase {
|
|
171941
|
+
async initialize() {
|
|
171942
|
+
if (this.state.measuredValue === void 0) {
|
|
171943
|
+
this.state.measuredValue = null;
|
|
171944
|
+
}
|
|
171945
|
+
if (this.state.minMeasuredValue === void 0) {
|
|
171946
|
+
this.state.minMeasuredValue = null;
|
|
171947
|
+
}
|
|
171948
|
+
if (this.state.maxMeasuredValue === void 0) {
|
|
171949
|
+
this.state.maxMeasuredValue = null;
|
|
171950
|
+
}
|
|
171951
|
+
if (this.state.uncertainty === void 0) {
|
|
171952
|
+
this.state.uncertainty = 0;
|
|
171953
|
+
}
|
|
171954
|
+
if (this.state.measurementUnit === void 0) {
|
|
171955
|
+
this.state.measurementUnit = ConcentrationMeasurement3.MeasurementUnit.Ugm3;
|
|
171956
|
+
}
|
|
171957
|
+
if (this.state.measurementMedium === void 0) {
|
|
171958
|
+
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
171959
|
+
}
|
|
171960
|
+
await super.initialize();
|
|
171961
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171962
|
+
this.update(homeAssistant.entity);
|
|
171963
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
171964
|
+
}
|
|
171965
|
+
update(entity) {
|
|
171966
|
+
if (!entity.state) {
|
|
171967
|
+
return;
|
|
171968
|
+
}
|
|
171969
|
+
const state = entity.state.state;
|
|
171970
|
+
let measuredValue = null;
|
|
171971
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
171972
|
+
measuredValue = +state;
|
|
171973
|
+
}
|
|
171974
|
+
applyPatchState(this.state, { measuredValue });
|
|
171975
|
+
}
|
|
171976
|
+
};
|
|
171977
|
+
|
|
171978
|
+
// src/matter/endpoints/legacy/sensor/devices/ozone-sensor.ts
|
|
171979
|
+
var OzoneAirQualityServerBase = AirQualityServer.with(
|
|
171980
|
+
AirQuality3.Feature.Fair,
|
|
171981
|
+
AirQuality3.Feature.Moderate,
|
|
171982
|
+
AirQuality3.Feature.VeryPoor,
|
|
171983
|
+
AirQuality3.Feature.ExtremelyPoor
|
|
171984
|
+
);
|
|
171985
|
+
var OzoneAirQualityServer = class extends OzoneAirQualityServerBase {
|
|
171986
|
+
async initialize() {
|
|
171987
|
+
if (this.state.airQuality === void 0) {
|
|
171988
|
+
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
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
|
+
const state = entity.state.state;
|
|
171997
|
+
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
171998
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
171999
|
+
const ugm3 = +state;
|
|
172000
|
+
if (ugm3 <= 60) {
|
|
172001
|
+
airQuality = AirQuality3.AirQualityEnum.Good;
|
|
172002
|
+
} else if (ugm3 <= 100) {
|
|
172003
|
+
airQuality = AirQuality3.AirQualityEnum.Fair;
|
|
172004
|
+
} else if (ugm3 <= 140) {
|
|
172005
|
+
airQuality = AirQuality3.AirQualityEnum.Moderate;
|
|
172006
|
+
} else if (ugm3 <= 180) {
|
|
172007
|
+
airQuality = AirQuality3.AirQualityEnum.Poor;
|
|
172008
|
+
} else if (ugm3 <= 240) {
|
|
172009
|
+
airQuality = AirQuality3.AirQualityEnum.VeryPoor;
|
|
172010
|
+
} else {
|
|
172011
|
+
airQuality = AirQuality3.AirQualityEnum.ExtremelyPoor;
|
|
172012
|
+
}
|
|
172013
|
+
}
|
|
172014
|
+
applyPatchState(this.state, { airQuality });
|
|
172015
|
+
}
|
|
172016
|
+
};
|
|
172017
|
+
var OzoneSensorType = AirQualitySensorDevice.with(
|
|
172018
|
+
BasicInformationServer2,
|
|
172019
|
+
IdentifyServer2,
|
|
172020
|
+
HomeAssistantEntityBehavior,
|
|
172021
|
+
OzoneAirQualityServer,
|
|
172022
|
+
OzoneConcentrationMeasurementServer2
|
|
172023
|
+
);
|
|
172024
|
+
|
|
172025
|
+
// src/matter/endpoints/legacy/sensor/devices/pm1-sensor.ts
|
|
172026
|
+
init_home_assistant_entity_behavior();
|
|
172027
|
+
|
|
172028
|
+
// src/matter/behaviors/pm1-concentration-measurement-server.ts
|
|
172029
|
+
init_home_assistant_entity_behavior();
|
|
172030
|
+
var Pm1ConcentrationMeasurementServerBase = Pm1ConcentrationMeasurementServer.with(
|
|
172031
|
+
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
172032
|
+
);
|
|
172033
|
+
var Pm1ConcentrationMeasurementServer2 = class extends Pm1ConcentrationMeasurementServerBase {
|
|
172034
|
+
async initialize() {
|
|
172035
|
+
if (this.state.measuredValue === void 0) {
|
|
172036
|
+
this.state.measuredValue = null;
|
|
172037
|
+
}
|
|
172038
|
+
if (this.state.minMeasuredValue === void 0) {
|
|
172039
|
+
this.state.minMeasuredValue = null;
|
|
172040
|
+
}
|
|
172041
|
+
if (this.state.maxMeasuredValue === void 0) {
|
|
172042
|
+
this.state.maxMeasuredValue = null;
|
|
172043
|
+
}
|
|
172044
|
+
if (this.state.uncertainty === void 0) {
|
|
172045
|
+
this.state.uncertainty = 0;
|
|
172046
|
+
}
|
|
172047
|
+
if (this.state.measurementUnit === void 0) {
|
|
172048
|
+
this.state.measurementUnit = ConcentrationMeasurement3.MeasurementUnit.Ugm3;
|
|
172049
|
+
}
|
|
172050
|
+
if (this.state.measurementMedium === void 0) {
|
|
172051
|
+
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
172052
|
+
}
|
|
172053
|
+
await super.initialize();
|
|
172054
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
172055
|
+
this.update(homeAssistant.entity);
|
|
172056
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
172057
|
+
}
|
|
172058
|
+
update(entity) {
|
|
172059
|
+
if (!entity.state) {
|
|
172060
|
+
return;
|
|
172061
|
+
}
|
|
172062
|
+
const state = entity.state.state;
|
|
172063
|
+
let measuredValue = null;
|
|
172064
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
172065
|
+
measuredValue = +state;
|
|
172066
|
+
}
|
|
172067
|
+
applyPatchState(this.state, { measuredValue });
|
|
172068
|
+
}
|
|
172069
|
+
};
|
|
172070
|
+
|
|
172071
|
+
// src/matter/endpoints/legacy/sensor/devices/pm1-sensor.ts
|
|
172072
|
+
var Pm1AirQualityServerBase = AirQualityServer.with(
|
|
172073
|
+
AirQuality3.Feature.Fair,
|
|
172074
|
+
AirQuality3.Feature.Moderate,
|
|
172075
|
+
AirQuality3.Feature.VeryPoor,
|
|
172076
|
+
AirQuality3.Feature.ExtremelyPoor
|
|
172077
|
+
);
|
|
172078
|
+
var Pm1AirQualityServer = class extends Pm1AirQualityServerBase {
|
|
172079
|
+
async initialize() {
|
|
172080
|
+
if (this.state.airQuality === void 0) {
|
|
172081
|
+
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
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
|
+
const state = entity.state.state;
|
|
172090
|
+
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
172091
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
172092
|
+
const ugm3 = +state;
|
|
172093
|
+
if (ugm3 <= 10) {
|
|
172094
|
+
airQuality = AirQuality3.AirQualityEnum.Good;
|
|
172095
|
+
} else if (ugm3 <= 25) {
|
|
172096
|
+
airQuality = AirQuality3.AirQualityEnum.Fair;
|
|
172097
|
+
} else if (ugm3 <= 50) {
|
|
172098
|
+
airQuality = AirQuality3.AirQualityEnum.Moderate;
|
|
172099
|
+
} else if (ugm3 <= 100) {
|
|
172100
|
+
airQuality = AirQuality3.AirQualityEnum.Poor;
|
|
172101
|
+
} else if (ugm3 <= 200) {
|
|
172102
|
+
airQuality = AirQuality3.AirQualityEnum.VeryPoor;
|
|
172103
|
+
} else {
|
|
172104
|
+
airQuality = AirQuality3.AirQualityEnum.ExtremelyPoor;
|
|
172105
|
+
}
|
|
172106
|
+
}
|
|
172107
|
+
applyPatchState(this.state, { airQuality });
|
|
172108
|
+
}
|
|
172109
|
+
};
|
|
172110
|
+
var Pm1SensorType = AirQualitySensorDevice.with(
|
|
172111
|
+
BasicInformationServer2,
|
|
172112
|
+
IdentifyServer2,
|
|
172113
|
+
HomeAssistantEntityBehavior,
|
|
172114
|
+
Pm1AirQualityServer,
|
|
172115
|
+
Pm1ConcentrationMeasurementServer2
|
|
172116
|
+
);
|
|
172117
|
+
|
|
171440
172118
|
// src/matter/endpoints/legacy/sensor/devices/pressure-sensor.ts
|
|
171441
172119
|
init_home_assistant_entity_behavior();
|
|
171442
172120
|
var pressureSensorConfig = {
|
|
@@ -171457,6 +172135,99 @@ var PressureSensorType = PressureSensorDevice.with(
|
|
|
171457
172135
|
PressureMeasurementServer2(pressureSensorConfig)
|
|
171458
172136
|
);
|
|
171459
172137
|
|
|
172138
|
+
// src/matter/endpoints/legacy/sensor/devices/radon-sensor.ts
|
|
172139
|
+
init_home_assistant_entity_behavior();
|
|
172140
|
+
|
|
172141
|
+
// src/matter/behaviors/radon-concentration-measurement-server.ts
|
|
172142
|
+
init_home_assistant_entity_behavior();
|
|
172143
|
+
var RadonConcentrationMeasurementServerBase = RadonConcentrationMeasurementServer.with(
|
|
172144
|
+
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
172145
|
+
);
|
|
172146
|
+
var RadonConcentrationMeasurementServer2 = class extends RadonConcentrationMeasurementServerBase {
|
|
172147
|
+
async initialize() {
|
|
172148
|
+
if (this.state.measuredValue === void 0) {
|
|
172149
|
+
this.state.measuredValue = null;
|
|
172150
|
+
}
|
|
172151
|
+
if (this.state.minMeasuredValue === void 0) {
|
|
172152
|
+
this.state.minMeasuredValue = null;
|
|
172153
|
+
}
|
|
172154
|
+
if (this.state.maxMeasuredValue === void 0) {
|
|
172155
|
+
this.state.maxMeasuredValue = null;
|
|
172156
|
+
}
|
|
172157
|
+
if (this.state.uncertainty === void 0) {
|
|
172158
|
+
this.state.uncertainty = 0;
|
|
172159
|
+
}
|
|
172160
|
+
if (this.state.measurementUnit === void 0) {
|
|
172161
|
+
this.state.measurementUnit = ConcentrationMeasurement3.MeasurementUnit.Bqm3;
|
|
172162
|
+
}
|
|
172163
|
+
if (this.state.measurementMedium === void 0) {
|
|
172164
|
+
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
172165
|
+
}
|
|
172166
|
+
await super.initialize();
|
|
172167
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
172168
|
+
this.update(homeAssistant.entity);
|
|
172169
|
+
this.reactTo(homeAssistant.onChange, this.update);
|
|
172170
|
+
}
|
|
172171
|
+
update(entity) {
|
|
172172
|
+
if (!entity.state) {
|
|
172173
|
+
return;
|
|
172174
|
+
}
|
|
172175
|
+
const state = entity.state.state;
|
|
172176
|
+
let measuredValue = null;
|
|
172177
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
172178
|
+
measuredValue = +state;
|
|
172179
|
+
}
|
|
172180
|
+
applyPatchState(this.state, { measuredValue });
|
|
172181
|
+
}
|
|
172182
|
+
};
|
|
172183
|
+
|
|
172184
|
+
// src/matter/endpoints/legacy/sensor/devices/radon-sensor.ts
|
|
172185
|
+
var RadonAirQualityServerBase = AirQualityServer.with(
|
|
172186
|
+
AirQuality3.Feature.Fair,
|
|
172187
|
+
AirQuality3.Feature.Moderate,
|
|
172188
|
+
AirQuality3.Feature.VeryPoor,
|
|
172189
|
+
AirQuality3.Feature.ExtremelyPoor
|
|
172190
|
+
);
|
|
172191
|
+
var RadonAirQualityServer = class extends RadonAirQualityServerBase {
|
|
172192
|
+
async initialize() {
|
|
172193
|
+
if (this.state.airQuality === void 0) {
|
|
172194
|
+
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
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
|
+
const state = entity.state.state;
|
|
172203
|
+
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
172204
|
+
if (state != null && !Number.isNaN(+state)) {
|
|
172205
|
+
const bqm3 = +state;
|
|
172206
|
+
if (bqm3 <= 50) {
|
|
172207
|
+
airQuality = AirQuality3.AirQualityEnum.Good;
|
|
172208
|
+
} else if (bqm3 <= 100) {
|
|
172209
|
+
airQuality = AirQuality3.AirQualityEnum.Fair;
|
|
172210
|
+
} else if (bqm3 <= 200) {
|
|
172211
|
+
airQuality = AirQuality3.AirQualityEnum.Moderate;
|
|
172212
|
+
} else if (bqm3 <= 300) {
|
|
172213
|
+
airQuality = AirQuality3.AirQualityEnum.Poor;
|
|
172214
|
+
} else if (bqm3 <= 600) {
|
|
172215
|
+
airQuality = AirQuality3.AirQualityEnum.VeryPoor;
|
|
172216
|
+
} else {
|
|
172217
|
+
airQuality = AirQuality3.AirQualityEnum.ExtremelyPoor;
|
|
172218
|
+
}
|
|
172219
|
+
}
|
|
172220
|
+
applyPatchState(this.state, { airQuality });
|
|
172221
|
+
}
|
|
172222
|
+
};
|
|
172223
|
+
var RadonSensorType = AirQualitySensorDevice.with(
|
|
172224
|
+
BasicInformationServer2,
|
|
172225
|
+
IdentifyServer2,
|
|
172226
|
+
HomeAssistantEntityBehavior,
|
|
172227
|
+
RadonAirQualityServer,
|
|
172228
|
+
RadonConcentrationMeasurementServer2
|
|
172229
|
+
);
|
|
172230
|
+
|
|
171460
172231
|
// src/matter/endpoints/legacy/sensor/devices/temperature-sensor.ts
|
|
171461
172232
|
init_home_assistant_entity_behavior();
|
|
171462
172233
|
var temperatureSensorConfig = {
|
|
@@ -172164,6 +172935,21 @@ function SensorDevice(homeAssistantEntity) {
|
|
|
172164
172935
|
if (deviceClass === SensorDeviceClass.aqi) {
|
|
172165
172936
|
return AirQualitySensorType.set({ homeAssistantEntity });
|
|
172166
172937
|
}
|
|
172938
|
+
if (deviceClass === SensorDeviceClass.carbon_monoxide) {
|
|
172939
|
+
return CarbonMonoxideSensorType.set({ homeAssistantEntity });
|
|
172940
|
+
}
|
|
172941
|
+
if (deviceClass === SensorDeviceClass.nitrogen_dioxide) {
|
|
172942
|
+
return NitrogenDioxideSensorType.set({ homeAssistantEntity });
|
|
172943
|
+
}
|
|
172944
|
+
if (deviceClass === SensorDeviceClass.ozone) {
|
|
172945
|
+
return OzoneSensorType.set({ homeAssistantEntity });
|
|
172946
|
+
}
|
|
172947
|
+
if (deviceClass === SensorDeviceClass.pm1) {
|
|
172948
|
+
return Pm1SensorType.set({ homeAssistantEntity });
|
|
172949
|
+
}
|
|
172950
|
+
if (deviceClass === SensorDeviceClass.power || deviceClass === SensorDeviceClass.energy || deviceClass === SensorDeviceClass.voltage || deviceClass === SensorDeviceClass.current) {
|
|
172951
|
+
return ElectricalSensorType.set({ homeAssistantEntity });
|
|
172952
|
+
}
|
|
172167
172953
|
if (deviceClass === SensorDeviceClass.battery) {
|
|
172168
172954
|
return BatterySensorType.set({ homeAssistantEntity });
|
|
172169
172955
|
}
|
|
@@ -174547,6 +175333,27 @@ var matterDeviceTypeFactories = {
|
|
|
174547
175333
|
tvoc_sensor: (ha) => TvocSensorType.set({
|
|
174548
175334
|
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
174549
175335
|
}),
|
|
175336
|
+
carbon_monoxide_sensor: (ha) => CarbonMonoxideSensorType.set({
|
|
175337
|
+
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
175338
|
+
}),
|
|
175339
|
+
nitrogen_dioxide_sensor: (ha) => NitrogenDioxideSensorType.set({
|
|
175340
|
+
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
175341
|
+
}),
|
|
175342
|
+
ozone_sensor: (ha) => OzoneSensorType.set({
|
|
175343
|
+
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
175344
|
+
}),
|
|
175345
|
+
formaldehyde_sensor: (ha) => FormaldehydeSensorType.set({
|
|
175346
|
+
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
175347
|
+
}),
|
|
175348
|
+
radon_sensor: (ha) => RadonSensorType.set({
|
|
175349
|
+
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
175350
|
+
}),
|
|
175351
|
+
pm1_sensor: (ha) => Pm1SensorType.set({
|
|
175352
|
+
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
175353
|
+
}),
|
|
175354
|
+
electrical_sensor: (ha) => ElectricalSensorType.set({
|
|
175355
|
+
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
175356
|
+
}),
|
|
174550
175357
|
mode_select: SelectDevice,
|
|
174551
175358
|
water_valve: ValveDevice,
|
|
174552
175359
|
pump: PumpEndpoint,
|