diff --git a/plugins/core/src/aggregate.ts b/plugins/core/src/aggregate.ts index 30344066f..227d0049f 100644 --- a/plugins/core/src/aggregate.ts +++ b/plugins/core/src/aggregate.ts @@ -33,6 +33,8 @@ aggregators.set(ScryptedInterface.LuminanceSensor, average); aggregators.set(ScryptedInterface.UltravioletSensor, average); aggregators.set(ScryptedInterface.CO2Sensor, average); aggregators.set(ScryptedInterface.PM25Sensor, average); +aggregators.set(ScryptedInterface.PM10Sensor, average); +aggregators.set(ScryptedInterface.NOXSensor, average); aggregators.set(ScryptedInterface.FloodSensor, allFalse); aggregators.set(ScryptedInterface.Lock, values => values.reduce((prev, cur) => cur === LockState.Unlocked ? cur : prev, LockState.Locked)); diff --git a/plugins/homekit/src/types/sensor.ts b/plugins/homekit/src/types/sensor.ts index 84aac241b..f6cd4e77b 100644 --- a/plugins/homekit/src/types/sensor.ts +++ b/plugins/homekit/src/types/sensor.ts @@ -31,8 +31,10 @@ const supportedSensors: string[] = [ ScryptedInterface.HumiditySensor, ScryptedInterface.FloodSensor, ScryptedInterface.AirQualitySensor, + ScryptedInterface.PM10Sensor, ScryptedInterface.PM25Sensor, ScryptedInterface.VOCSensor, + ScryptedInterface.NOXSensor, ScryptedInterface.EntrySensor, ScryptedInterface.CO2Sensor, ]; @@ -46,7 +48,7 @@ addSupportedType({ } return false; }, - getAccessory: async (device: ScryptedDevice & OccupancySensor & AmbientLightSensor & AmbientLightSensor & AudioSensor & BinarySensor & MotionSensor & Thermometer & HumiditySensor & FloodSensor & AirQualitySensor & PM25Sensor & VOCSensor & EntrySensor & TamperSensor & CO2Sensor, homekitPlugin: HomeKitPlugin) => { + getAccessory: async (device: ScryptedDevice & OccupancySensor & AmbientLightSensor & AmbientLightSensor & AudioSensor & BinarySensor & MotionSensor & Thermometer & HumiditySensor & FloodSensor & AirQualitySensor & PM10Sensor & PM25Sensor & VOCSensor & NOXSensor & EntrySensor & TamperSensor & CO2Sensor, homekitPlugin: HomeKitPlugin) => { const accessory = makeAccessory(device, homekitPlugin); if (device.interfaces.includes(ScryptedInterface.EntrySensor)) { @@ -106,7 +108,11 @@ addSupportedType({ const service = accessory.addService(Service.AirQualitySensor, device.name); bindCharacteristic(device, ScryptedInterface.AirQualitySensor, service, Characteristic.AirQuality, () => airQualityToHomekit(device.airQuality)); - + + if (device.interfaces.includes(ScryptedInterface.PM10Sensor)) { + bindCharacteristic(device, ScryptedInterface.PM10Sensor, service, Characteristic.PM2_5Density, + () => device.pm10Density || 0); + } if (device.interfaces.includes(ScryptedInterface.PM25Sensor)) { bindCharacteristic(device, ScryptedInterface.PM25Sensor, service, Characteristic.PM2_5Density, () => device.pm25Density || 0); @@ -115,6 +121,10 @@ addSupportedType({ bindCharacteristic(device, ScryptedInterface.VOCSensor, service, Characteristic.VOCDensity, () => device.vocDensity || 0); } + if (device.interfaces.includes(ScryptedInterface.NOXSensor)) { + bindCharacteristic(device, ScryptedInterface.NOXSensor, service, Characteristic.PM2_5Density, + () => device.noxDensity || 0); + } } diff --git a/sdk/gen/types.input.ts b/sdk/gen/types.input.ts index e986378b8..bc45d059e 100644 --- a/sdk/gen/types.input.ts +++ b/sdk/gen/types.input.ts @@ -960,12 +960,18 @@ export interface Position { export interface PositionSensor { position?: Position; } +export interface PM10Sensor { + pm10Density?: number; +} export interface PM25Sensor { pm25Density?: number; } export interface VOCSensor { vocDensity?: number; } +export interface NOXSensor { + noxDensity?: number; +} export interface CO2Sensor { co2ppm?: number; } @@ -1583,8 +1589,10 @@ export enum ScryptedInterface { LuminanceSensor = "LuminanceSensor", PositionSensor = "PositionSensor", SecuritySystem = 'SecuritySystem', + PM10Sensor = "PM10Sensor", PM25Sensor = "PM25Sensor", VOCSensor = "VOCSensor", + NOXSensor = "NOXSensor", CO2Sensor = "CO2Sensor", AirQualitySensor = "AirQualitySensor", Readme = "Readme", diff --git a/sdk/scrypted_python/scrypted_sdk/types.py b/sdk/scrypted_python/scrypted_sdk/types.py index 90c7d418a..5f7e89a0a 100644 --- a/sdk/scrypted_python/scrypted_sdk/types.py +++ b/sdk/scrypted_python/scrypted_sdk/types.py @@ -106,12 +106,14 @@ class ScryptedInterface(Enum): MixinProvider = "MixinProvider" MotionSensor = "MotionSensor" Notifier = "Notifier" + NOXSensor = "NOXSensor" OauthClient = "OauthClient" ObjectDetection = "ObjectDetection" ObjectDetector = "ObjectDetector" OccupancySensor = "OccupancySensor" OnOff = "OnOff" Online = "Online" + PM10Sensor = "PM10Sensor" PM25Sensor = "PM25Sensor" PanTiltZoom = "PanTiltZoom" PasswordStore = "PasswordStore" @@ -804,6 +806,10 @@ class Notifier: pass pass +class NOXSensor: + noxDensity: float + pass + class OauthClient: async def getOauthUrl(self) -> str: pass @@ -841,6 +847,10 @@ class Online: online: bool pass +class PM10Sensor: + pm10Density: float + pass + class PM25Sensor: pm25Density: float pass @@ -2090,6 +2100,13 @@ ScryptedInterfaceDescriptors = { "securitySystemState" ] }, + "PM10Sensor": { + "name": "PM10Sensor", + "methods": [], + "properties": [ + "pm10Density" + ] + }, "PM25Sensor": { "name": "PM25Sensor", "methods": [], @@ -2104,6 +2121,13 @@ ScryptedInterfaceDescriptors = { "vocDensity" ] }, + "NOXSensor": { + "name": "NOXSensor", + "methods": [], + "properties": [ + "noxDensity" + ] + }, "CO2Sensor": { "name": "CO2Sensor", "methods": [], diff --git a/sdk/types/index.d.ts b/sdk/types/index.d.ts index 956d23ab6..5f207a4f0 100644 --- a/sdk/types/index.d.ts +++ b/sdk/types/index.d.ts @@ -1048,12 +1048,18 @@ export interface Position { export interface PositionSensor { position?: Position; } +export interface PM10Sensor { + pm10Density?: number; +} export interface PM25Sensor { pm25Density?: number; } export interface VOCSensor { vocDensity?: number; } +export interface NOXSensor { + noxDensity?: number; +} export interface CO2Sensor { co2ppm?: number; } @@ -1616,8 +1622,10 @@ export declare enum ScryptedInterface { LuminanceSensor = "LuminanceSensor", PositionSensor = "PositionSensor", SecuritySystem = "SecuritySystem", + PM10Sensor = "PM10Sensor", PM25Sensor = "PM25Sensor", VOCSensor = "VOCSensor", + NOXSensor = "NOXSensor", CO2Sensor = "CO2Sensor", AirQualitySensor = "AirQualitySensor", Readme = "Readme", diff --git a/sdk/types/index.js b/sdk/types/index.js index a4e0cbf7a..182a0bdc2 100644 --- a/sdk/types/index.js +++ b/sdk/types/index.js @@ -518,6 +518,13 @@ exports.ScryptedInterfaceDescriptors = { 'securitySystemState' ] }, + PM10Sensor: { + name: 'PM10Sensor', + methods: [], + properties: [ + 'pm10Density' + ] + }, PM25Sensor: { name: 'PM25Sensor', methods: [], @@ -532,6 +539,13 @@ exports.ScryptedInterfaceDescriptors = { 'vocDensity' ] }, + NOXSensor: { + name: 'NOXSensor', + methods: [], + properties: [ + 'noxDensity' + ] + }, CO2Sensor: { name: 'CO2Sensor', methods: [], @@ -829,8 +843,10 @@ var ScryptedInterface; ScryptedInterface["LuminanceSensor"] = "LuminanceSensor"; ScryptedInterface["PositionSensor"] = "PositionSensor"; ScryptedInterface["SecuritySystem"] = "SecuritySystem"; + ScryptedInterface["PM10Sensor"] = "PM10Sensor"; ScryptedInterface["PM25Sensor"] = "PM25Sensor"; ScryptedInterface["VOCSensor"] = "VOCSensor"; + ScryptedInterface["NOXSensor"] = "NOXSensor"; ScryptedInterface["CO2Sensor"] = "CO2Sensor"; ScryptedInterface["AirQualitySensor"] = "AirQualitySensor"; ScryptedInterface["Readme"] = "Readme"; diff --git a/sdk/types/index.ts b/sdk/types/index.ts index 200ca4ac8..477553cf8 100644 --- a/sdk/types/index.ts +++ b/sdk/types/index.ts @@ -638,6 +638,13 @@ export const ScryptedInterfaceDescriptors: { [scryptedInterface: string]: Scrypt 'securitySystemState' ] }, + PM10Sensor: { + name: 'PM10Sensor', + methods: [], + properties: [ + 'pm10Density' + ] + }, PM25Sensor: { name: 'PM25Sensor', methods: [], @@ -652,6 +659,13 @@ export const ScryptedInterfaceDescriptors: { [scryptedInterface: string]: Scrypt 'vocDensity' ] }, + NOXSensor: { + name: 'NOXSensor', + methods: [], + properties: [ + 'noxDensity' + ] + }, CO2Sensor: { name: 'CO2Sensor', methods: [], @@ -2369,8 +2383,10 @@ export enum ScryptedInterface { LuminanceSensor = "LuminanceSensor", PositionSensor = "PositionSensor", SecuritySystem = 'SecuritySystem', + PM10Sensor = "PM10Sensor", PM25Sensor = "PM25Sensor", VOCSensor = "VOCSensor", + NOXSensor = "NOXSensor", CO2Sensor = "CO2Sensor", AirQualitySensor = "AirQualitySensor", Readme = "Readme", diff --git a/sdk/types/scrypted_python/scrypted_sdk/types.py b/sdk/types/scrypted_python/scrypted_sdk/types.py index 90c7d418a..5f7e89a0a 100644 --- a/sdk/types/scrypted_python/scrypted_sdk/types.py +++ b/sdk/types/scrypted_python/scrypted_sdk/types.py @@ -106,12 +106,14 @@ class ScryptedInterface(Enum): MixinProvider = "MixinProvider" MotionSensor = "MotionSensor" Notifier = "Notifier" + NOXSensor = "NOXSensor" OauthClient = "OauthClient" ObjectDetection = "ObjectDetection" ObjectDetector = "ObjectDetector" OccupancySensor = "OccupancySensor" OnOff = "OnOff" Online = "Online" + PM10Sensor = "PM10Sensor" PM25Sensor = "PM25Sensor" PanTiltZoom = "PanTiltZoom" PasswordStore = "PasswordStore" @@ -804,6 +806,10 @@ class Notifier: pass pass +class NOXSensor: + noxDensity: float + pass + class OauthClient: async def getOauthUrl(self) -> str: pass @@ -841,6 +847,10 @@ class Online: online: bool pass +class PM10Sensor: + pm10Density: float + pass + class PM25Sensor: pm25Density: float pass @@ -2090,6 +2100,13 @@ ScryptedInterfaceDescriptors = { "securitySystemState" ] }, + "PM10Sensor": { + "name": "PM10Sensor", + "methods": [], + "properties": [ + "pm10Density" + ] + }, "PM25Sensor": { "name": "PM25Sensor", "methods": [], @@ -2104,6 +2121,13 @@ ScryptedInterfaceDescriptors = { "vocDensity" ] }, + "NOXSensor": { + "name": "NOXSensor", + "methods": [], + "properties": [ + "noxDensity" + ] + }, "CO2Sensor": { "name": "CO2Sensor", "methods": [],