mirror of
https://github.com/koush/scrypted.git
synced 2026-09-18 09:40:44 +01:00
updated the sensor bindings (#392)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { AmbientLightSensor, AudioSensor, BinarySensor, FloodSensor, HumiditySensor, MotionSensor, OccupancySensor, PM25Sensor, AirQualitySensor, ScryptedDevice, ScryptedDeviceType, ScryptedInterface, Thermometer, VOCSensor, AirQuality, EntrySensor, TamperSensor, CO2Sensor } from '@scrypted/sdk';
|
||||
import { AmbientLightSensor, AudioSensor, BinarySensor, FloodSensor, HumiditySensor, MotionSensor, OccupancySensor, PM10Sensor, PM25Sensor, AirQualitySensor, ScryptedDevice, ScryptedDeviceType, ScryptedInterface, Thermometer, VOCSensor, NOXSensor, AirQuality, EntrySensor, TamperSensor, CO2Sensor } from '@scrypted/sdk';
|
||||
import { addSupportedType, bindCharacteristic, DummyDevice, } from '../common';
|
||||
import { Characteristic, Service } from '../hap';
|
||||
import { makeAccessory } from './common';
|
||||
@@ -110,7 +110,7 @@ addSupportedType({
|
||||
() => airQualityToHomekit(device.airQuality));
|
||||
|
||||
if (device.interfaces.includes(ScryptedInterface.PM10Sensor)) {
|
||||
bindCharacteristic(device, ScryptedInterface.PM10Sensor, service, Characteristic.PM2_5Density,
|
||||
bindCharacteristic(device, ScryptedInterface.PM10Sensor, service, Characteristic.PM10Density,
|
||||
() => device.pm10Density || 0);
|
||||
}
|
||||
if (device.interfaces.includes(ScryptedInterface.PM25Sensor)) {
|
||||
@@ -122,7 +122,7 @@ addSupportedType({
|
||||
() => device.vocDensity || 0);
|
||||
}
|
||||
if (device.interfaces.includes(ScryptedInterface.NOXSensor)) {
|
||||
bindCharacteristic(device, ScryptedInterface.NOXSensor, service, Characteristic.PM2_5Density,
|
||||
bindCharacteristic(device, ScryptedInterface.NOXSensor, service, Characteristic.NitrogenDioxideDensity,
|
||||
() => device.noxDensity || 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Fan, FanMode, HumidityMode, HumiditySensor, HumiditySetting, OnOff, ScryptedDevice, ScryptedDeviceType, ScryptedInterface, TemperatureSetting, TemperatureUnit, Thermometer, ThermostatMode, AirQualitySensor, AirQuality, PM25Sensor, VOCSensor, CO2Sensor } from '@scrypted/sdk';
|
||||
import { Fan, FanMode, HumidityMode, HumiditySensor, HumiditySetting, OnOff, ScryptedDevice, ScryptedDeviceType, ScryptedInterface, TemperatureSetting, TemperatureUnit, Thermometer, ThermostatMode, AirQualitySensor, AirQuality, PM10Sensor, PM25Sensor, VOCSensor, NOXSensor, CO2Sensor } from '@scrypted/sdk';
|
||||
import { addSupportedType, bindCharacteristic, DummyDevice, } from '../common';
|
||||
import { Characteristic, CharacteristicEventTypes, CharacteristicSetCallback, CharacteristicValue, Service } from '../hap';
|
||||
import { makeAccessory } from './common';
|
||||
@@ -11,7 +11,7 @@ addSupportedType({
|
||||
return false;
|
||||
return true;
|
||||
},
|
||||
getAccessory: async (device: ScryptedDevice & TemperatureSetting & Thermometer & HumiditySensor & OnOff & Fan & HumiditySetting & AirQualitySensor & PM25Sensor & VOCSensor & CO2Sensor, homekitPlugin: HomeKitPlugin) => {
|
||||
getAccessory: async (device: ScryptedDevice & TemperatureSetting & Thermometer & HumiditySensor & OnOff & Fan & HumiditySetting & AirQualitySensor & PM10Sensor & PM25Sensor & VOCSensor & NOXSensor & CO2Sensor, homekitPlugin: HomeKitPlugin) => {
|
||||
const accessory = makeAccessory(device, homekitPlugin);
|
||||
const service = accessory.addService(Service.Thermostat, device.name);
|
||||
service.setPrimaryService();
|
||||
@@ -300,6 +300,10 @@ addSupportedType({
|
||||
bindCharacteristic(device, ScryptedInterface.AirQualitySensor, airQualityService, Characteristic.AirQuality,
|
||||
() => airQualityToHomekit(device.airQuality));
|
||||
|
||||
if (device.interfaces.includes(ScryptedInterface.PM10Sensor)) {
|
||||
bindCharacteristic(device, ScryptedInterface.PM10Sensor, airQualityService, Characteristic.PM10Density,
|
||||
() => device.pm10Density || 0);
|
||||
}
|
||||
if (device.interfaces.includes(ScryptedInterface.PM25Sensor)) {
|
||||
bindCharacteristic(device, ScryptedInterface.PM25Sensor, airQualityService, Characteristic.PM2_5Density,
|
||||
() => device.pm25Density || 0);
|
||||
@@ -308,6 +312,10 @@ addSupportedType({
|
||||
bindCharacteristic(device, ScryptedInterface.VOCSensor, airQualityService, Characteristic.VOCDensity,
|
||||
() => device.vocDensity || 0);
|
||||
}
|
||||
if (device.interfaces.includes(ScryptedInterface.NOXSensor)) {
|
||||
bindCharacteristic(device, ScryptedInterface.NOXSensor, airQualityService, Characteristic.NitrogenDioxideDensity,
|
||||
() => device.noxDensity || 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (device.interfaces.includes(ScryptedInterface.CO2Sensor)) {
|
||||
|
||||
Reference in New Issue
Block a user