Compare commits

...

18 Commits

Author SHA1 Message Date
Serge Wagener
61dd132fad
Merge pull request #21 from Foxi352/dependabot/npm_and_yarn/ws-8.17.1
Bump ws from 8.12.1 to 8.17.1
2024-06-18 07:43:46 +02:00
Serge Wagener
a13242328e
Merge pull request #20 from Foxi352/dependabot/npm_and_yarn/braces-3.0.3
Bump braces from 3.0.2 to 3.0.3
2024-06-18 07:43:28 +02:00
dependabot[bot]
03618c6362
Bump ws from 8.12.1 to 8.17.1
Bumps [ws](https://github.com/websockets/ws) from 8.12.1 to 8.17.1.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/8.12.1...8.17.1)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-18 05:34:44 +00:00
dependabot[bot]
867a1ebbe3
Bump braces from 3.0.2 to 3.0.3
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-18 04:53:12 +00:00
Serge Wagener
6cb8f72028
Merge pull request #19 from Foxi352/dependabot/npm_and_yarn/ip-1.1.9
Bump ip from 1.1.8 to 1.1.9
2024-02-22 08:26:18 +01:00
dependabot[bot]
4eba434852
Bump ip from 1.1.8 to 1.1.9
Bumps [ip](https://github.com/indutny/node-ip) from 1.1.8 to 1.1.9.
- [Commits](https://github.com/indutny/node-ip/compare/v1.1.8...v1.1.9)

---
updated-dependencies:
- dependency-name: ip
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-22 02:09:05 +00:00
Serge Wagener
568cc551fb
Merge pull request #18 from Foxi352/dependabot/npm_and_yarn/xml2js-and-homebridge/dbus-native-0.5.0
Bump xml2js and @homebridge/dbus-native
2023-11-02 11:22:54 +01:00
dependabot[bot]
89edac94e0
Bump xml2js and @homebridge/dbus-native
Bumps [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) and [@homebridge/dbus-native](https://github.com/homebridge/dbus-native). These dependencies needed to be updated together.

Updates `xml2js` from 0.4.23 to 0.5.0
- [Commits](https://github.com/Leonidas-from-XIV/node-xml2js/commits/0.5.0)

Updates `@homebridge/dbus-native` from 0.5.0 to 0.5.1
- [Release notes](https://github.com/homebridge/dbus-native/releases)
- [Commits](https://github.com/homebridge/dbus-native/compare/v0.5.0...v0.5.1)

---
updated-dependencies:
- dependency-name: xml2js
  dependency-type: indirect
- dependency-name: "@homebridge/dbus-native"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-02 09:38:01 +00:00
Serge Wagener
a8e1812d9f
Merge pull request #17 from Foxi352/dependabot/npm_and_yarn/word-wrap-1.2.4
Bump word-wrap from 1.2.3 to 1.2.4
2023-11-02 10:37:34 +01:00
dependabot[bot]
3ac1dbf683
Bump word-wrap from 1.2.3 to 1.2.4
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-19 09:53:09 +00:00
Serge Wagener
4971bf389a Updated packages 2023-02-14 17:39:03 +01:00
Serge Wagener
d3e9629ec0
Merge pull request #16 from Foxi352/dependabot/npm_and_yarn/http-cache-semantics-4.1.1
Bump http-cache-semantics from 4.1.0 to 4.1.1
2023-02-14 17:21:42 +01:00
dependabot[bot]
f49839b39f
Bump http-cache-semantics from 4.1.0 to 4.1.1
Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](https://github.com/kornelski/http-cache-semantics/compare/v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-04 06:47:54 +00:00
Serge Wagener
64e65d16ae Downgraded homebridge to 1.3.9 because of vuln. 2022-05-16 18:44:57 +02:00
Serge Wagener
d3a5407f29 Merge 2022-05-16 18:37:32 +02:00
Serge Wagener
d56a3a98e9 Added decimals to WindowCov., Plugin now verified 2022-05-16 18:35:15 +02:00
Serge Wagener
ed016e28c6
Merge pull request #15 from Foxi352/dependabot/npm_and_yarn/minimist-1.2.6
Bump minimist from 1.2.5 to 1.2.6
2022-05-16 16:51:37 +02:00
dependabot[bot]
0a6eb90eb7
Bump minimist from 1.2.5 to 1.2.6
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-01 21:16:05 +00:00
4 changed files with 1505 additions and 2601 deletions

View File

@ -1,14 +1,12 @@
# homebridge-smarthomeng # homebridge-smarthomeng
[![npm](https://badgen.net/npm/v/homebridge-smarthomeng)](https://www.npmjs.com/package/homebridge-smarthomeng) [![npm](https://badgen.net/npm/v/homebridge-smarthomeng)](https://www.npmjs.com/package/homebridge-smarthomeng)
[![verified-by-homebridge](https://badgen.net/badge/homebridge/verified/purple)](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
[![npm](https://badgen.net/badge/homebridge/>=1.3.5/green)](https://www.npmjs.com/package/homebridge-smarthomeng) [![npm](https://badgen.net/badge/homebridge/>=1.3.5/green)](https://www.npmjs.com/package/homebridge-smarthomeng)
[![npm](https://badgen.net/npm/node/homebridge-smarthomeng)](https://www.npmjs.com/package/homebridge-smarthomeng) [![npm](https://badgen.net/npm/node/homebridge-smarthomeng)](https://www.npmjs.com/package/homebridge-smarthomeng)
[![npm](https://badgen.net/npm/dt/homebridge-smarthomeng)](https://www.npmjs.com/package/homebridge-smarthomeng) [![npm](https://badgen.net/npm/dt/homebridge-smarthomeng)](https://www.npmjs.com/package/homebridge-smarthomeng)
[![npm](https://badgen.net/npm/dm/homebridge-smarthomeng)](https://www.npmjs.com/package/homebridge-smarthomeng) [![npm](https://badgen.net/npm/dm/homebridge-smarthomeng)](https://www.npmjs.com/package/homebridge-smarthomeng)
**Version v2 is a complete rewrite from scratch and a breaking update.**
You need to adapt your [`config.json`](#example-configuration-file) !
## Currently supported accessories ## Currently supported accessories
This plugin currently supports the following services (and characteristics): This plugin currently supports the following services (and characteristics):
@ -406,9 +404,11 @@ This accessory type can be used for shutters or blinds. Because the differnce be
| TargetPosition | \<item> | Yes | | SHNG item to monitor and set the target position | | TargetPosition | \<item> | Yes | | SHNG item to monitor and set the target position |
| CurrentPositionMin | \<number> | No | 0 | Your device's minimum value for current position | | CurrentPositionMin | \<number> | No | 0 | Your device's minimum value for current position |
| CurrentPositionMax | \<number> | No | 100 | Your device's maximum value for current position | | CurrentPositionMax | \<number> | No | 100 | Your device's maximum value for current position |
| CurrentPositionDecimals | \<number> | No | 0 | Number of decimals to round to |
| CurrentPositionInverted | \<boolean> | No | false | Should the values be inverted, ex: 0 for Homekit = 100 for device | | CurrentPositionInverted | \<boolean> | No | false | Should the values be inverted, ex: 0 for Homekit = 100 for device |
| TargetPositionMin | \<number> | No | 0 | Your device's minimum value for target position | | TargetPositionMin | \<number> | No | 0 | Your device's minimum value for target position |
| TargetPositionMax | \<number> | No | 100 | Your device's maximum value for target position | | TargetPositionMax | \<number> | No | 100 | Your device's maximum value for target position |
| TargetPositionDecimals | \<number> | No | 0 | Number of decimals to round to |
| TargetPositionInverted | \<boolean> | No | false | Should the values be inverted, ex: 0 for Homekit = 100 for device | | TargetPositionInverted | \<boolean> | No | false | Should the values be inverted, ex: 0 for Homekit = 100 for device |
| CurrentHorizontalTiltAngle | \<item> | No | | SHNG item to monitor current horizontal tilt angle | | CurrentHorizontalTiltAngle | \<item> | No | | SHNG item to monitor current horizontal tilt angle |
| TargetHorizontalTiltAngle | \<item> | No | | SHNG item to monitor and set the target horizontal tilt angle | | TargetHorizontalTiltAngle | \<item> | No | | SHNG item to monitor and set the target horizontal tilt angle |

4054
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
"private": false, "private": false,
"displayName": "SmartHomeNG", "displayName": "SmartHomeNG",
"name": "homebridge-smarthomeng", "name": "homebridge-smarthomeng",
"version": "2.0.6", "version": "2.0.8",
"description": "SmartHomeNG plugin for Homebridge", "description": "SmartHomeNG plugin for Homebridge",
"license": "Apache-2.0", "license": "Apache-2.0",
"repository": { "repository": {
@ -27,17 +27,17 @@
"homebridge-plugin" "homebridge-plugin"
], ],
"dependencies": { "dependencies": {
"ws": "^8.4.2" "ws": "^8.12.1"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^16.10.9", "@types/node": "^18.13.0",
"@typescript-eslint/eslint-plugin": "^5.0.0", "@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/parser": "^5.0.0", "@typescript-eslint/parser": "^5.52.0",
"eslint": "^8.0.1", "eslint": "^8.34.0",
"homebridge": "^1.3.5", "homebridge": "^1.6.0",
"nodemon": "^2.0.13", "nodemon": "^2.0.20",
"rimraf": "^3.0.2", "rimraf": "^4.1.2",
"ts-node": "^10.3.0", "ts-node": "^10.9.1",
"typescript": "^4.4.4" "typescript": "^4.9.5"
} }
} }

View File

@ -12,8 +12,10 @@ export class WindowCovering implements AccessoryPlugin {
private readonly informationService: Service; private readonly informationService: Service;
public name: string; public name: string;
private currentPosition = 0; private currentPositionMin = 0; private currentPositionMax = 100; private currentPositionInverted = false; private currentPosition = 0; private currentPositionMin = 0; private currentPositionMax = 100;
private targetPosition = 0; private targetPositionMin = 0; private targetPositionMax = 100; private targetPositionInverted = false; private currentPositionDecimals = 0; private currentPositionInverted = false;
private targetPosition = 0; private targetPositionMin = 0; private targetPositionMax = 100;
private targetPositionDecimals = 0; private targetPositionInverted = false;
private positionState = this.platform.Characteristic.PositionState.STOPPED; private positionState = this.platform.Characteristic.PositionState.STOPPED;
private currentHorizontalTiltAngle = 0; private targetHorizontalTiltAngle = 0; private currentHorizontalTiltAngle = 0; private targetHorizontalTiltAngle = 0;
private currentVerticalTiltAngle = 0; private targetVerticalTiltAngle = 0; private currentVerticalTiltAngle = 0; private targetVerticalTiltAngle = 0;
@ -70,9 +72,11 @@ export class WindowCovering implements AccessoryPlugin {
this.currentPositionMax = accessory.currentpositionmax ? accessory.currentpositionmax : this.currentPositionMax; this.currentPositionMax = accessory.currentpositionmax ? accessory.currentpositionmax : this.currentPositionMax;
this.currentPositionMin = accessory.currentpositionmin ? accessory.currentpositionmin : this.currentPositionMin; this.currentPositionMin = accessory.currentpositionmin ? accessory.currentpositionmin : this.currentPositionMin;
this.currentPositionDecimals = accessory.currentpositiondecimals ? accessory.currentpositiondecimals : this.currentPositionDecimals;
this.currentPositionInverted = accessory.currentpositioninverted ? accessory.currentpositioninverted : this.currentPositionInverted; this.currentPositionInverted = accessory.currentpositioninverted ? accessory.currentpositioninverted : this.currentPositionInverted;
this.targetPositionMax = accessory.targetpositionmax ? accessory.targetpositionmax : this.targetPositionMax; this.targetPositionMax = accessory.targetpositionmax ? accessory.targetpositionmax : this.targetPositionMax;
this.targetPositionMin = accessory.targetpositionmin ? accessory.targetpositionmin : this.targetPositionMin; this.targetPositionMin = accessory.targetpositionmin ? accessory.targetpositionmin : this.targetPositionMin;
this.targetPositionDecimals = accessory.targetpositiondecimals ? accessory.targetpositiondecimals : this.targetPositionDecimals;
this.targetPositionInverted = accessory.targetpositioninverted ? accessory.targetpositioninverted : this.targetPositionInverted; this.targetPositionInverted = accessory.targetpositioninverted ? accessory.targetpositioninverted : this.targetPositionInverted;
this.platform.log.info("WindowCovering '%s' created!", accessory.name); this.platform.log.info("WindowCovering '%s' created!", accessory.name);
} }
@ -107,7 +111,7 @@ export class WindowCovering implements AccessoryPlugin {
value as number, value as number,
0, 100, 0, 100,
this.targetPositionMin, this.targetPositionMax, this.targetPositionMin, this.targetPositionMax,
this.targetPositionInverted, this.targetPositionDecimals, this.targetPositionInverted,
); );
this.platform.shng.setItem(this.accessory.targetposition, transposedTarget); this.platform.shng.setItem(this.accessory.targetposition, transposedTarget);
} }
@ -152,7 +156,7 @@ export class WindowCovering implements AccessoryPlugin {
value as number, value as number,
this.currentPositionMin, this.currentPositionMax, this.currentPositionMin, this.currentPositionMax,
0, 100, 0, 100,
this.currentPositionInverted, 0, this.currentPositionInverted,
); );
this.deviceService.updateCharacteristic(this.platform.Characteristic.CurrentPosition, this.currentPosition); this.deviceService.updateCharacteristic(this.platform.Characteristic.CurrentPosition, this.currentPosition);
} else { } else {
@ -169,7 +173,7 @@ export class WindowCovering implements AccessoryPlugin {
value as number, value as number,
this.targetPositionMin, this.targetPositionMax, this.targetPositionMin, this.targetPositionMax,
0, 100, 0, 100,
this.targetPositionInverted, 0, this.targetPositionInverted,
); );
this.deviceService.updateCharacteristic(this.platform.Characteristic.TargetPosition, this.targetPosition); this.deviceService.updateCharacteristic(this.platform.Characteristic.TargetPosition, this.targetPosition);
} else { } else {
@ -235,9 +239,14 @@ export class WindowCovering implements AccessoryPlugin {
); );
} }
convertRange(value: number, oldmin: number, oldmax: number, newmin: number, newmax: number, inverted: boolean): number { // eslint-disable-next-line max-len
convertRange(value: number, oldmin: number, oldmax: number, newmin: number, newmax: number, decimals: number, inverted: boolean): number {
let result = (((value - oldmin) * (newmax - newmin)) / (oldmax - oldmin)) + newmin; let result = (((value - oldmin) * (newmax - newmin)) / (oldmax - oldmin)) + newmin;
result = Math.round(result); if(decimals > 0) {
result = parseFloat(result.toFixed(decimals));
} else {
result = Math.round(result);
}
if (inverted) { if (inverted) {
result = newmax - result; result = newmax - result;
} }
@ -246,6 +255,7 @@ export class WindowCovering implements AccessoryPlugin {
'from range', oldmin, '-', oldmax, 'from range', oldmin, '-', oldmax,
'to', newmin, '-', newmax, 'to', newmin, '-', newmax,
'with inverted', inverted, 'with inverted', inverted,
'and', decimals, 'decimals',
'=', result, '=', result,
); );
return result; return result;