Skip to content

Commit

Permalink
Merge pull request #35 from Sinclair81/dev-1.4.1
Browse files Browse the repository at this point in the history
v1.4.1
  • Loading branch information
Sinclair81 committed Nov 18, 2023
2 parents 5851b3b + 2b9a46a commit 8be4cbd
Show file tree
Hide file tree
Showing 13 changed files with 187 additions and 47 deletions.
43 changes: 27 additions & 16 deletions 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</br>
Sensors: motion, contact, CO2, humidity</br>
More information about this in the README on GitHub.</br>

# 1.4.0 #

Change from node-snap7 to napi-snap7.</br>
## 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.</br>
## Adding logging of all values to an InfluxDB ##

And as a test, log a temperature using Fakegato in the Eve app.</br>
More information about this in the README on GitHub.</br>

Expand All @@ -14,40 +25,40 @@ Added logging for all accessories and sensors.</br>
For [Homebridge-Logging](https://github.com/Sinclair81/Homebridge-Logging) or any other freely configurable udp server for logging.</br>

# 1.3.6 #

Integrated valve as sub-accessory of IrrigationSystem.</br>
Fix pushButton in all Accessories.</br>

# 1.3.5 #

Hotfix for no Snap7 in Node.js versions 19.x and 20.x!</br>

# 1.3.4 #

Add Outlet Accessory.</br>

# 1.3.3 #

Bugfix to avoid memory leak.</br>

# 1.3.2 #

Reading of negative numbers and error handling improved, in Modbus and Snap7.</br>

# 1.3.1 #

Removed unnecessary debug messages.</br>

# 1.3.0 #

## Snap7 Support ##

From now on, the S7 protocol via Snap7 is also supported in this plug-in.</br>

# 1.2.0 #

## Improvements in Garagedoor Accessory ##

Add functionality to read digital state values for CurrentDoorState and TargetDoorState.</br>
The digital status for open and closed is on purpose reversed.</br>
Analog - 0 = Open; 1 = Closed; 2 = Opening; 3 = Closing; 4 = Stopped;</br>
Expand Down
21 changes: 12 additions & 9 deletions README.md
Expand Up @@ -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 ##

Expand Down Expand Up @@ -615,24 +618,24 @@ Name | Value | Required | Option for | Notes

| Type | Characteristic | InfluxDB | Eve App |
|-----------------------|----------------------------------------------------------------------------------------------------|---------------------------------|----------------------------|
| Switch | On | yes | no |
| Lightbulb | On<br>Brightness | yes<br>yes | no<br>no |
| Switch | On | yes | yes |
| Lightbulb | On<br>Brightness | yes<br>yes | yes<br>no |
| Blind | CurrentPosition<br>PositionState<br>TargetPosition | yes<br>yes<br>yes | no<br>no<br>no |
| Window | CurrentPosition<br>PositionState<br>TargetPosition | yes<br>yes<br>yes | no<br>no<br>no |
| Garage Door | CurrentDoorState<br>TargetDoorState<br>ObstructionDetected | yes<br>yes<br>yes | no<br>no<br>no |
| Thermostat | CurrentHeatingCoolingState<br>TargetHeatingCoolingState<br>CurrentTemperature<br>TargetTemperature | yes<br>yes<br>yes<br>yes | no<br>no<br>no<br>no |
| Thermostat | CurrentHeatingCoolingState<br>TargetHeatingCoolingState<br>CurrentTemperature<br>TargetTemperature | yes<br>yes<br>yes<br>yes | no<br>no<br>yes<br>yes |
| Irrigation System | Active<br>ProgramMode<br>InUse<br>RemainingDuration<br>WaterLevel | yes<br>yes<br>yes<br>yes<br>yes | no<br>no<br>no<br>no<br>no |
| Valve | Active<br>InUse<br>RemainingDuration<br>SetDuration<br>IsConfigured | yes<br>yes<br>yes<br>yes<br>yes | no<br>no<br>no<br>no<br>no |
| Fan | On<br>RotationDirection<br>RotationSpeed | yes<br>yes<br>yes | no<br>no<br>no |
| Filter Maintenance | FilterChangeIndication<br>FilterLifeLevel<br>ResetFilterIndication | yes<br>yes<br>yes | no<br>no<br>no |
| Outlet | On<br>InUse | yes<br>yes | no<br>no |
| Outlet | On<br>InUse | yes<br>yes | yes<br>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<br>CarbonDioxideLevel<br>CarbonDioxidePeakLevel | yes<br>yes<br>yes | no<br>no<br>no |
| Humidity Sensor | CurrentRelativeHumidity | yes | yes |
| Carbon Dioxide Sensor | CarbonDioxideDetected<br>CarbonDioxideLevel<br>CarbonDioxidePeakLevel | yes<br>yes<br>yes | no<br>yes<br>no |
| Air Quality Sensor | AirQuality | yes | no |
| Leak Sensor | LeakDetected<br>WaterLevel | yes<br>yes | no<br>no |

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion 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": "---",
Expand Down
18 changes: 16 additions & 2 deletions src/accessories/lightbulbPlatformAccessory.ts
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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;

Expand All @@ -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);
Expand All @@ -80,7 +94,7 @@ export class LightbulbPlatformAccessory implements AccessoryPlugin {
}

getServices(): Service[] {
return [ this.information, this.service ];
return this.services;
}

async setOn(value: CharacteristicValue) {
Expand Down Expand Up @@ -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});

}

Expand Down
18 changes: 16 additions & 2 deletions src/accessories/outletPlatformAccessory.ts
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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;

Expand All @@ -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);
Expand All @@ -89,7 +103,7 @@ export class OutletPlatformAccessory implements AccessoryPlugin {
}

getServices(): Service[] {
return [ this.information, this.service ];
return this.services;
}

async setOn(value: CharacteristicValue) {
Expand Down Expand Up @@ -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});

}

Expand Down
18 changes: 16 additions & 2 deletions src/accessories/switchPlatformAccessory.ts
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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});

}

Expand Down
18 changes: 16 additions & 2 deletions src/accessories/thermostatPlatformAccessory.ts
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -101,7 +115,7 @@ export class ThermostatPlatformAccessory implements AccessoryPlugin {
}

getServices(): Service[] {
return [ this.information, this.service ];
return this.services;
}

async setTargetHeatingCoolingState(value: CharacteristicValue) {
Expand Down Expand Up @@ -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});

}

Expand Down

0 comments on commit 8be4cbd

Please sign in to comment.