diff --git a/ChangeLog.md b/ChangeLog.md
index d573344..9b2084a 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,10 +1,21 @@
+# 1.4.1 #
+
+## Added logging capability to Eve App to several sensor and accessories ##
+
+Accessorys: switch, lightbulb, outlet, thermostat
+Sensors: motion, contact, CO2, humidity
+More information about this in the README on GitHub.
+
# 1.4.0 #
-Change from node-snap7 to napi-snap7.
+## Change from node-snap7 to napi-snap7 ##
+
+To ensure compatibility with Node.js 18.x and 20.x.
# 1.3.8 #
-Adding logging of all values to an InfluxDB.
+## Adding logging of all values to an InfluxDB ##
+
And as a test, log a temperature using Fakegato in the Eve app.
More information about this in the README on GitHub.
@@ -14,40 +25,40 @@ Added logging for all accessories and sensors.
For [Homebridge-Logging](https://github.com/Sinclair81/Homebridge-Logging) or any other freely configurable udp server for logging.
# 1.3.6 #
-
+
Integrated valve as sub-accessory of IrrigationSystem.
Fix pushButton in all Accessories.
# 1.3.5 #
-
+
Hotfix for no Snap7 in Node.js versions 19.x and 20.x!
# 1.3.4 #
-
+
Add Outlet Accessory.
# 1.3.3 #
-
+
Bugfix to avoid memory leak.
-
+
# 1.3.2 #
-
+
Reading of negative numbers and error handling improved, in Modbus and Snap7.
-
+
# 1.3.1 #
-
+
Removed unnecessary debug messages.
-
+
# 1.3.0 #
-
+
## Snap7 Support ##
-
+
From now on, the S7 protocol via Snap7 is also supported in this plug-in.
-
+
# 1.2.0 #
-
+
## Improvements in Garagedoor Accessory ##
-
+
Add functionality to read digital state values for CurrentDoorState and TargetDoorState.
The digital status for open and closed is on purpose reversed.
Analog - 0 = Open; 1 = Closed; 2 = Opening; 3 = Closing; 4 = Stopped;
diff --git a/README.md b/README.md
index eab07b2..021e1b1 100644
--- a/README.md
+++ b/README.md
@@ -59,7 +59,10 @@ __Examples:__
## Thanks to ##
-- [Tellicious](https://github.com/Tellicious) for Integrated valve as sub-accessory of IrrigationSystem and his Bugfix to avoid memory leak.
+- [Tellicious](https://github.com/Tellicious) for:
+ - Adding logging to the Eve app.
+ - Integrated valve as sub-accessory of IrrigationSystem.
+ - His Bugfix to avoid memory leak.
## Special thanks to ##
@@ -615,24 +618,24 @@ Name | Value | Required | Option for | Notes
| Type | Characteristic | InfluxDB | Eve App |
|-----------------------|----------------------------------------------------------------------------------------------------|---------------------------------|----------------------------|
-| Switch | On | yes | no |
-| Lightbulb | On
Brightness | yes
yes | no
no |
+| Switch | On | yes | yes |
+| Lightbulb | On
Brightness | yes
yes | yes
no |
| Blind | CurrentPosition
PositionState
TargetPosition | yes
yes
yes | no
no
no |
| Window | CurrentPosition
PositionState
TargetPosition | yes
yes
yes | no
no
no |
| Garage Door | CurrentDoorState
TargetDoorState
ObstructionDetected | yes
yes
yes | no
no
no |
-| Thermostat | CurrentHeatingCoolingState
TargetHeatingCoolingState
CurrentTemperature
TargetTemperature | yes
yes
yes
yes | no
no
no
no |
+| Thermostat | CurrentHeatingCoolingState
TargetHeatingCoolingState
CurrentTemperature
TargetTemperature | yes
yes
yes
yes | no
no
yes
yes |
| Irrigation System | Active
ProgramMode
InUse
RemainingDuration
WaterLevel | yes
yes
yes
yes
yes | no
no
no
no
no |
| Valve | Active
InUse
RemainingDuration
SetDuration
IsConfigured | yes
yes
yes
yes
yes | no
no
no
no
no |
| Fan | On
RotationDirection
RotationSpeed | yes
yes
yes | no
no
no |
| Filter Maintenance | FilterChangeIndication
FilterLifeLevel
ResetFilterIndication | yes
yes
yes | no
no
no |
-| Outlet | On
InUse | yes
yes | no
no |
+| Outlet | On
InUse | yes
yes | yes
no |
| Light Sensor | CurrentAmbientLightLevel | yes | no |
-| Motion Sensor | MotionDetected | yes | no |
-| Contact Sensor | ContactSensorState | yes | no |
+| Motion Sensor | MotionDetected | yes | yes |
+| Contact Sensor | ContactSensorState | yes | yes |
| Smoke Sensor | SmokeDetected | yes | no |
| Temperature Sensor | CurrentTemperature | yes | yes |
-| Humidity Sensor | CurrentRelativeHumidity | yes | no |
-| Carbon Dioxide Sensor | CarbonDioxideDetected
CarbonDioxideLevel
CarbonDioxidePeakLevel | yes
yes
yes | no
no
no |
+| Humidity Sensor | CurrentRelativeHumidity | yes | yes |
+| Carbon Dioxide Sensor | CarbonDioxideDetected
CarbonDioxideLevel
CarbonDioxidePeakLevel | yes
yes
yes | no
yes
no |
| Air Quality Sensor | AirQuality | yes | no |
| Leak Sensor | LeakDetected
WaterLevel | yes
yes | no
no |
diff --git a/package-lock.json b/package-lock.json
index bc4ffda..a7fb573 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "homebridge-logo-platform",
- "version": "1.4.0",
+ "version": "1.4.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "homebridge-logo-platform",
- "version": "1.4.0",
+ "version": "1.4.1",
"license": "---",
"dependencies": {
"@influxdata/influxdb-client": "^1.33.2",
diff --git a/package.json b/package.json
index 889316b..aa0ab7f 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"displayName": "Homebridge Logo Platform",
"name": "homebridge-logo-platform",
- "version": "1.4.0",
+ "version": "1.4.1",
"model": "Logo Platform",
"description": "This is a Siemens LOGO! Platform Plugin.",
"license": "---",
diff --git a/src/accessories/lightbulbPlatformAccessory.ts b/src/accessories/lightbulbPlatformAccessory.ts
index 1057ec0..458ab89 100644
--- a/src/accessories/lightbulbPlatformAccessory.ts
+++ b/src/accessories/lightbulbPlatformAccessory.ts
@@ -13,6 +13,9 @@ export class LightbulbPlatformAccessory implements AccessoryPlugin {
private service: Service;
private information: Service;
+ private fakegatoService: any;
+ public services: Service[];
+
private platform: any;
private device: any;
private pushButton: number;
@@ -36,6 +39,9 @@ export class LightbulbPlatformAccessory implements AccessoryPlugin {
this.pushButton = this.device.pushButton || this.platform.pushButton;
this.logging = this.device.logging || 0;
+ this.fakegatoService = [];
+ this.services = [];
+
this.errorCheck();
this.service = new this.api.hap.Service.Lightbulb(this.device.name);
@@ -54,6 +60,8 @@ export class LightbulbPlatformAccessory implements AccessoryPlugin {
.setCharacteristic(this.api.hap.Characteristic.SerialNumber, md5(this.device.name + this.model))
.setCharacteristic(this.api.hap.Characteristic.FirmwareRevision, this.platform.firmwareRevision);
+ this.services.push(this.service, this.information);
+
this.updateBrightnessQueued = false;
this.updateOnQueued = false;
@@ -65,6 +73,12 @@ export class LightbulbPlatformAccessory implements AccessoryPlugin {
}
if (this.logging) {
+
+ if (this.platform.loggerType == LoggerType.Fakegato) {
+ this.fakegatoService = new this.platform.FakeGatoHistoryService("custom", this, {storage: 'fs'});
+ this.services.push(this.fakegatoService);
+ }
+
setInterval(() => {
this.logAccessory();
}, this.platform.loggerInterval);
@@ -80,7 +94,7 @@ export class LightbulbPlatformAccessory implements AccessoryPlugin {
}
getServices(): Service[] {
- return [ this.information, this.service ];
+ return this.services;
}
async setOn(value: CharacteristicValue) {
@@ -198,7 +212,7 @@ export class LightbulbPlatformAccessory implements AccessoryPlugin {
if (this.platform.loggerType == LoggerType.Fakegato) {
- // this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), temp: this.sensStates.CurrentTemperature});
+ this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), status: this.accStates.On});
}
diff --git a/src/accessories/outletPlatformAccessory.ts b/src/accessories/outletPlatformAccessory.ts
index 91362b2..7b3a422 100644
--- a/src/accessories/outletPlatformAccessory.ts
+++ b/src/accessories/outletPlatformAccessory.ts
@@ -16,6 +16,9 @@ export class OutletPlatformAccessory implements AccessoryPlugin {
private service: Service;
private information: Service;
+ private fakegatoService: any;
+ public services: Service[];
+
private platform: any;
private device: any;
private pushButton: number;
@@ -41,6 +44,9 @@ export class OutletPlatformAccessory implements AccessoryPlugin {
this.logging = this.device.logging || 0;
this.inUseIsSet = false;
+ this.fakegatoService = [];
+ this.services = [];
+
this.errorCheck();
this.service = new this.api.hap.Service.Outlet(this.device.name);
@@ -58,6 +64,8 @@ export class OutletPlatformAccessory implements AccessoryPlugin {
.setCharacteristic(this.api.hap.Characteristic.SerialNumber, md5(this.device.name + this.model))
.setCharacteristic(this.api.hap.Characteristic.FirmwareRevision, this.platform.firmwareRevision);
+ this.services.push(this.service, this.information);
+
this.updateOnQueued = false;
this.updateInUseQueued = false;
@@ -71,6 +79,12 @@ export class OutletPlatformAccessory implements AccessoryPlugin {
}
if (this.logging) {
+
+ if (this.platform.loggerType == LoggerType.Fakegato) {
+ this.fakegatoService = new this.platform.FakeGatoHistoryService("custom", this, {storage: 'fs'});
+ this.services.push(this.fakegatoService);
+ }
+
setInterval(() => {
this.logAccessory();
}, this.platform.loggerInterval);
@@ -89,7 +103,7 @@ export class OutletPlatformAccessory implements AccessoryPlugin {
}
getServices(): Service[] {
- return [ this.information, this.service ];
+ return this.services;
}
async setOn(value: CharacteristicValue) {
@@ -198,7 +212,7 @@ export class OutletPlatformAccessory implements AccessoryPlugin {
if (this.platform.loggerType == LoggerType.Fakegato) {
- // this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), temp: this.sensStates.CurrentTemperature});
+ this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), status: this.accStates.On});
}
diff --git a/src/accessories/switchPlatformAccessory.ts b/src/accessories/switchPlatformAccessory.ts
index 0db2dd3..9c55ffb 100644
--- a/src/accessories/switchPlatformAccessory.ts
+++ b/src/accessories/switchPlatformAccessory.ts
@@ -16,6 +16,9 @@ export class SwitchPlatformAccessory implements AccessoryPlugin {
private service: Service;
private information: Service;
+ private fakegatoService: any;
+ public services: Service[];
+
private platform: any;
private device: any;
private pushButton: number;
@@ -37,6 +40,9 @@ export class SwitchPlatformAccessory implements AccessoryPlugin {
this.pushButton = this.device.pushButton || this.platform.pushButton;
this.logging = this.device.logging || 0;
+ this.fakegatoService = [];
+ this.services = [];
+
this.errorCheck();
this.service = new this.api.hap.Service.Switch(this.device.name);
@@ -51,6 +57,8 @@ export class SwitchPlatformAccessory implements AccessoryPlugin {
.setCharacteristic(this.api.hap.Characteristic.SerialNumber, md5(this.device.name + this.model))
.setCharacteristic(this.api.hap.Characteristic.FirmwareRevision, this.platform.firmwareRevision);
+ this.services.push(this.service, this.information);
+
this.updateOnQueued = false;
if (this.platform.config.updateInterval) {
@@ -68,13 +76,19 @@ export class SwitchPlatformAccessory implements AccessoryPlugin {
}
errorCheck() {
+
+ if (this.platform.loggerType == LoggerType.Fakegato) {
+ this.fakegatoService = new this.platform.FakeGatoHistoryService("switch", this, {storage: 'fs'});
+ this.services.push(this.fakegatoService);
+ }
+
if (!this.device.switchGet || !this.device.switchSetOn || !this.device.switchSetOff) {
this.platform.log.error('[%s] One or more LOGO! Addresses are not correct!', this.device.name);
}
}
getServices(): Service[] {
- return [ this.information, this.service ];
+ return this.services;
}
async setOn(value: CharacteristicValue) {
@@ -141,7 +155,7 @@ export class SwitchPlatformAccessory implements AccessoryPlugin {
if (this.platform.loggerType == LoggerType.Fakegato) {
- // this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), temp: this.sensStates.CurrentTemperature});
+ this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), status: this.accStates.On});
}
diff --git a/src/accessories/thermostatPlatformAccessory.ts b/src/accessories/thermostatPlatformAccessory.ts
index 83dbe71..5eb35af 100644
--- a/src/accessories/thermostatPlatformAccessory.ts
+++ b/src/accessories/thermostatPlatformAccessory.ts
@@ -13,6 +13,9 @@ export class ThermostatPlatformAccessory implements AccessoryPlugin {
private service: Service;
private information: Service;
+ private fakegatoService: any;
+ public services: Service[];
+
private platform: any;
private device: any;
private pushButton: number;
@@ -43,6 +46,9 @@ export class ThermostatPlatformAccessory implements AccessoryPlugin {
this.pushButton = this.device.pushButton || this.platform.pushButton;
this.logging = this.device.logging || 0;
+ this.fakegatoService = [];
+ this.services = [];
+
this.errorCheck();
this.service = new this.api.hap.Service.Thermostat(this.device.name);
@@ -70,6 +76,8 @@ export class ThermostatPlatformAccessory implements AccessoryPlugin {
.setCharacteristic(this.api.hap.Characteristic.SerialNumber, md5(this.device.name + this.model))
.setCharacteristic(this.api.hap.Characteristic.FirmwareRevision, this.platform.firmwareRevision);
+ this.services.push(this.service, this.information);
+
this.updateCurrentHeatingCoolingStateQueued = false;
this.updateTargetHeatingCoolingStateQueued = false;
this.updateCurrentTemperatureQueued = false;
@@ -85,6 +93,12 @@ export class ThermostatPlatformAccessory implements AccessoryPlugin {
}
if (this.logging) {
+
+ if (this.platform.loggerType == LoggerType.Fakegato) {
+ this.fakegatoService = new this.platform.FakeGatoHistoryService("custom", this, {storage: 'fs'});
+ this.services.push(this.fakegatoService);
+ }
+
setInterval(() => {
this.logAccessory();
}, this.platform.loggerInterval);
@@ -101,7 +115,7 @@ export class ThermostatPlatformAccessory implements AccessoryPlugin {
}
getServices(): Service[] {
- return [ this.information, this.service ];
+ return this.services;
}
async setTargetHeatingCoolingState(value: CharacteristicValue) {
@@ -320,7 +334,7 @@ export class ThermostatPlatformAccessory implements AccessoryPlugin {
if (this.platform.loggerType == LoggerType.Fakegato) {
- // this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), temp: this.sensStates.CurrentTemperature});
+ this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), temp: this.accStates.CurrentTemperature, setTemp: this.accStates.TargetTemperature});
}
diff --git a/src/sensors/carbonDioxideSensorPlatformAccessory.ts b/src/sensors/carbonDioxideSensorPlatformAccessory.ts
index cd88859..243210d 100644
--- a/src/sensors/carbonDioxideSensorPlatformAccessory.ts
+++ b/src/sensors/carbonDioxideSensorPlatformAccessory.ts
@@ -13,6 +13,9 @@ export class CarbonDioxideSensorPlatformAccessory implements AccessoryPlugin {
private service: Service;
private information: Service;
+ private fakegatoService: any;
+ public services: Service[];
+
private platform: any;
private device: any;
private logging: number;
@@ -36,6 +39,9 @@ export class CarbonDioxideSensorPlatformAccessory implements AccessoryPlugin {
this.device = device;
this.logging = this.device.logging || 0;
+ this.fakegatoService = [];
+ this.services = [];
+
this.errorCheck();
this.service = new this.api.hap.Service.CarbonDioxideSensor(this.device.name);
@@ -59,6 +65,8 @@ export class CarbonDioxideSensorPlatformAccessory implements AccessoryPlugin {
.setCharacteristic(this.api.hap.Characteristic.SerialNumber, md5(this.device.name + this.model))
.setCharacteristic(this.api.hap.Characteristic.FirmwareRevision, this.platform.firmwareRevision);
+ this.services.push(this.service, this.information);
+
this.updateCarbonDioxideDetectedQueued = false;
this.updateCarbonDioxideLevelQueued = false;
this.updateCarbonDioxidePeakLevelQueued = false;
@@ -72,6 +80,12 @@ export class CarbonDioxideSensorPlatformAccessory implements AccessoryPlugin {
}
if (this.logging) {
+
+ if (this.platform.loggerType == LoggerType.Fakegato) {
+ this.fakegatoService = new this.platform.FakeGatoHistoryService("custom", this, {storage: 'fs'});
+ this.services.push(this.fakegatoService);
+ }
+
setInterval(() => {
this.logAccessory();
}, this.platform.loggerInterval);
@@ -87,7 +101,7 @@ export class CarbonDioxideSensorPlatformAccessory implements AccessoryPlugin {
}
getServices(): Service[] {
- return [ this.information, this.service ];
+ return this.services;
}
async getCarbonDioxideDetected(): Promise {
@@ -217,7 +231,7 @@ export class CarbonDioxideSensorPlatformAccessory implements AccessoryPlugin {
if (this.platform.loggerType == LoggerType.Fakegato) {
- // this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), temp: this.sensStates.CurrentTemperature});
+ this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), ppm: this.sensStates.CarbonDioxideLevel});
}
diff --git a/src/sensors/contactSensorPlatformAccessory.ts b/src/sensors/contactSensorPlatformAccessory.ts
index 72f70a8..05cdf51 100644
--- a/src/sensors/contactSensorPlatformAccessory.ts
+++ b/src/sensors/contactSensorPlatformAccessory.ts
@@ -13,6 +13,9 @@ export class ContactSensorPlatformAccessory implements AccessoryPlugin {
private service: Service;
private information: Service;
+ private fakegatoService: any;
+ public services: Service[];
+
private platform: any;
private device: any;
private logging: number;
@@ -32,6 +35,9 @@ export class ContactSensorPlatformAccessory implements AccessoryPlugin {
this.device = device;
this.logging = this.device.logging || 0;
+ this.fakegatoService = [];
+ this.services = [];
+
this.errorCheck();
this.service = new this.api.hap.Service.ContactSensor(this.device.name);
@@ -45,6 +51,8 @@ export class ContactSensorPlatformAccessory implements AccessoryPlugin {
.setCharacteristic(this.api.hap.Characteristic.SerialNumber, md5(this.device.name + this.model))
.setCharacteristic(this.api.hap.Characteristic.FirmwareRevision, this.platform.firmwareRevision);
+ this.services.push(this.service, this.information);
+
this.updateContactSensorStateQueued = false;
if (this.platform.config.updateInterval) {
@@ -54,6 +62,12 @@ export class ContactSensorPlatformAccessory implements AccessoryPlugin {
}
if (this.logging) {
+
+ if (this.platform.loggerType == LoggerType.Fakegato) {
+ this.fakegatoService = new this.platform.FakeGatoHistoryService("custom", this, {storage: 'fs'});
+ this.services.push(this.fakegatoService);
+ }
+
setInterval(() => {
this.logAccessory();
}, this.platform.loggerInterval);
@@ -69,7 +83,7 @@ export class ContactSensorPlatformAccessory implements AccessoryPlugin {
}
getServices(): Service[] {
- return [ this.information, this.service ];
+ return this.services;
}
async getContactSensorState(): Promise {
@@ -117,7 +131,7 @@ export class ContactSensorPlatformAccessory implements AccessoryPlugin {
if (this.platform.loggerType == LoggerType.Fakegato) {
- // this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), temp: this.sensStates.CurrentTemperature});
+ this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), contact: this.sensStates.ContactSensorState});
}
diff --git a/src/sensors/humiditySensorPlatformAccessory.ts b/src/sensors/humiditySensorPlatformAccessory.ts
index 16ade69..73ac84c 100644
--- a/src/sensors/humiditySensorPlatformAccessory.ts
+++ b/src/sensors/humiditySensorPlatformAccessory.ts
@@ -13,6 +13,9 @@ export class HumiditySensorPlatformAccessory implements AccessoryPlugin {
private service: Service;
private information: Service;
+ private fakegatoService: any;
+ public services: Service[];
+
private platform: any;
private device: any;
private logging: number;
@@ -34,6 +37,9 @@ export class HumiditySensorPlatformAccessory implements AccessoryPlugin {
this.device = device;
this.logging = this.device.logging || 0;
+ this.fakegatoService = [];
+ this.services = [];
+
this.errorCheck();
this.service = new this.api.hap.Service.HumiditySensor(this.device.name);
@@ -41,12 +47,15 @@ export class HumiditySensorPlatformAccessory implements AccessoryPlugin {
this.service.getCharacteristic(this.api.hap.Characteristic.CurrentRelativeHumidity)
.onGet(this.getCurrentRelativeHumidity.bind(this));
+
this.information = new this.api.hap.Service.AccessoryInformation()
.setCharacteristic(this.api.hap.Characteristic.Manufacturer, this.platform.manufacturer)
.setCharacteristic(this.api.hap.Characteristic.Model, this.model + ' @ ' + this.platform.model)
.setCharacteristic(this.api.hap.Characteristic.SerialNumber, md5(this.device.name + this.model))
.setCharacteristic(this.api.hap.Characteristic.FirmwareRevision, this.platform.firmwareRevision);
+ this.services.push(this.service, this.information);
+
this.updateCurrentRelativeHumidityQueued = false;
if (this.platform.config.updateInterval) {
@@ -56,11 +65,16 @@ export class HumiditySensorPlatformAccessory implements AccessoryPlugin {
}
if (this.logging) {
+
+ if (this.platform.loggerType == LoggerType.Fakegato) {
+ this.fakegatoService = new this.platform.FakeGatoHistoryService("custom", this, {storage: 'fs'});
+ this.services.push(this.fakegatoService);
+ }
+
setInterval(() => {
this.logAccessory();
}, this.platform.loggerInterval);
}
-
}
@@ -71,7 +85,7 @@ export class HumiditySensorPlatformAccessory implements AccessoryPlugin {
}
getServices(): Service[] {
- return [ this.information, this.service ];
+ return this.services;
}
async getCurrentRelativeHumidity(): Promise {
@@ -128,7 +142,7 @@ export class HumiditySensorPlatformAccessory implements AccessoryPlugin {
if (this.platform.loggerType == LoggerType.Fakegato) {
- // this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), temp: this.sensStates.CurrentTemperature});
+ this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), humidity: this.sensStates.CurrentRelativeHumidity});
}
diff --git a/src/sensors/lightSensorPlatformAccessory.ts b/src/sensors/lightSensorPlatformAccessory.ts
index 0217b9d..e389a6d 100644
--- a/src/sensors/lightSensorPlatformAccessory.ts
+++ b/src/sensors/lightSensorPlatformAccessory.ts
@@ -13,6 +13,9 @@ export class LightSensorPlatformAccessory implements AccessoryPlugin {
private service: Service;
private information: Service;
+ private fakegatoService: any;
+ public services: Service[];
+
private platform: any;
private device: any;
private logging: number;
@@ -34,6 +37,9 @@ export class LightSensorPlatformAccessory implements AccessoryPlugin {
this.device = device;
this.logging = this.device.logging || 0;
+ this.fakegatoService = [];
+ this.services = [];
+
this.errorCheck();
this.service = new this.api.hap.Service.LightSensor(this.device.name);
@@ -47,6 +53,8 @@ export class LightSensorPlatformAccessory implements AccessoryPlugin {
.setCharacteristic(this.api.hap.Characteristic.SerialNumber, md5(this.device.name + this.model))
.setCharacteristic(this.api.hap.Characteristic.FirmwareRevision, this.platform.firmwareRevision);
+ this.services.push(this.service, this.information);
+
this.updateCurrentAmbientLightLevelQueued = false;
if (this.platform.config.updateInterval) {
@@ -56,6 +64,12 @@ export class LightSensorPlatformAccessory implements AccessoryPlugin {
}
if (this.logging) {
+
+ if (this.platform.loggerType == LoggerType.Fakegato) {
+ this.fakegatoService = new this.platform.FakeGatoHistoryService("custom", this, {storage: 'fs'});
+ this.services.push(this.fakegatoService);
+ }
+
setInterval(() => {
this.logAccessory();
}, this.platform.loggerInterval);
@@ -71,7 +85,7 @@ export class LightSensorPlatformAccessory implements AccessoryPlugin {
}
getServices(): Service[] {
- return [ this.information, this.service ];
+ return this.services;
}
async getCurrentAmbientLightLevel(): Promise {
@@ -125,7 +139,7 @@ export class LightSensorPlatformAccessory implements AccessoryPlugin {
if (this.platform.loggerType == LoggerType.Fakegato) {
- // this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), temp: this.sensStates.CurrentTemperature});
+ this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), lux: this.sensStates.CurrentAmbientLightLevel});
}
diff --git a/src/sensors/motionSensorPlatformAccessory.ts b/src/sensors/motionSensorPlatformAccessory.ts
index c6664ad..31b87dd 100644
--- a/src/sensors/motionSensorPlatformAccessory.ts
+++ b/src/sensors/motionSensorPlatformAccessory.ts
@@ -13,6 +13,9 @@ export class MotionSensorPlatformAccessory implements AccessoryPlugin {
private service: Service;
private information: Service;
+ private fakegatoService: any;
+ public services: Service[];
+
private platform: any;
private device: any;
private logging: number;
@@ -32,6 +35,9 @@ export class MotionSensorPlatformAccessory implements AccessoryPlugin {
this.device = device;
this.logging = this.device.logging || 0;
+ this.fakegatoService = [];
+ this.services = [];
+
this.errorCheck();
this.service = new this.api.hap.Service.MotionSensor(this.device.name);
@@ -45,6 +51,8 @@ export class MotionSensorPlatformAccessory implements AccessoryPlugin {
.setCharacteristic(this.api.hap.Characteristic.SerialNumber, md5(this.device.name + this.model))
.setCharacteristic(this.api.hap.Characteristic.FirmwareRevision, this.platform.firmwareRevision);
+ this.services.push(this.service, this.information);
+
this.updateMotionDetectedQueued = false;
if (this.platform.config.updateInterval) {
@@ -54,6 +62,12 @@ export class MotionSensorPlatformAccessory implements AccessoryPlugin {
}
if (this.logging) {
+
+ if (this.platform.loggerType == LoggerType.Fakegato) {
+ this.fakegatoService = new this.platform.FakeGatoHistoryService("custom", this, {storage: 'fs'});
+ this.services.push(this.fakegatoService);
+ }
+
setInterval(() => {
this.logAccessory();
}, this.platform.loggerInterval);
@@ -69,7 +83,7 @@ export class MotionSensorPlatformAccessory implements AccessoryPlugin {
}
getServices(): Service[] {
- return [ this.information, this.service ];
+ return this.services;
}
async getMotionDetected(): Promise {
@@ -117,7 +131,7 @@ export class MotionSensorPlatformAccessory implements AccessoryPlugin {
if (this.platform.loggerType == LoggerType.Fakegato) {
- // this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), temp: this.sensStates.CurrentTemperature});
+ this.fakegatoService.addEntry({time: Math.round(new Date().valueOf() / 1000), motion: this.sensStates.MotionDetected});
}