mirror of
https://github.com/koush/scrypted.git
synced 2026-05-04 21:30:30 +01:00
Added NOXSensor and PM10Sensor for use (#384)
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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": [],
|
||||
|
||||
8
sdk/types/index.d.ts
vendored
8
sdk/types/index.d.ts
vendored
@@ -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",
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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": [],
|
||||
|
||||
Reference in New Issue
Block a user