Skip to content

Commit 411a26c

Browse files
committed
improved docu
1 parent cc422a1 commit 411a26c

4 files changed

Lines changed: 100 additions & 7 deletions

File tree

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,80 @@ From KNX point of view:
2626
* Services are usually devices providing multiple functions (e.g. on/off, dimm).
2727
* Characteristics are the smallest unit und realsied by one or few group addresses (e.g. on/off with get GA and set GA)
2828

29+
# Available Servies and Characteristics Configuration
30+
Check [Homebridge.io docuemntation](https://developers.homebridge.io/#/service) for descriptions of Homebridge _Services_ and **required** or **optional** _Characteristics_. The following services and characteristics are implemented in this plug-in.
31+
32+
## Services
33+
### Garage Door Opener
34+
#### Characteristics
35+
- [Current Door State](#current-door-state)
36+
- [Target Door State](#target-door-state)
37+
- [Obstruction Detection](#obstruction-detected)
38+
39+
### Lightbulb
40+
#### Characteristics
41+
- [On](#on)
42+
- [Brightness](#brightness)
43+
44+
### Outlet
45+
#### Characteristics
46+
- [On](#on)
47+
48+
### Switch
49+
#### Characteristics
50+
- [On](#on)
51+
52+
### Temperature Sensor
53+
#### Characterisitcs
54+
- [Current Temperature](#current-temperature)
55+
56+
### Window
57+
#### Characterisitcs
58+
- [Current Door State](#current-door-state)
59+
- [Target Door State](#target-door-state)
60+
- [Obstruction Detected](#obstruction-detected)
61+
62+
63+
## Characteristics
64+
65+
### Brightness
66+
- Endpoint 1: Set URL Endpoint
67+
- Endpoint 2: Get URL Endpoint
68+
69+
### Current Door State
70+
- Endpoint 1: Get URL endpoint
71+
72+
### Current Position
73+
- Endpoint 1: Get URL Endpoint
74+
75+
### Current Temperature
76+
- Endpoint 1: Get URL endpoint
77+
78+
### Lock Current State
79+
- Endpoint 1: Set URL Endpoint
80+
- Endpoint 2: Get URL Endpoint
81+
82+
### Lock Target State
83+
- Endpoint 1: Set URL Endpoint
84+
- Endpoint 2: Get URL Endpoint
85+
86+
### Obstruction Detected
87+
- Endpoint 1: Get URL endpoint
88+
89+
### On
90+
- Endpoint 1: Set URL Endpoint
91+
- Endpoint 2: Get URL Endpoint
92+
93+
### Position State
94+
- Endpoint 1: Get URL endpoint
95+
96+
### Target Door State
97+
- Endpoint 1: Set URL endpoint
98+
- Endpoint 2: Get URL endpoint
99+
100+
### Target Position
101+
- Endpoint 1: Set URL endpoint
102+
- Endpoint 2: Get URL endpoint
29103

30104
# Background
31105

package.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"private": true,
33
"displayName": "Homebridge Gira Homeserver URL-Endpoint",
44
"name": "homebridge-hsd",
5-
"version": "1.0.8",
5+
"version": "1.1.0",
66
"description": "Plugin to access KNX bus via Gira Homeserver",
77
"license": "MIT",
88
"repository": {
@@ -12,6 +12,16 @@
1212
"bugs": {
1313
"url": "https://github.com/En3rGy/homebridge-hsd/issues"
1414
},
15+
"funding": [
16+
{
17+
"type": "github",
18+
"url": "https://github.com/En3rGy/homebridge-hsd"
19+
},
20+
{
21+
"type": "buymeacoffee",
22+
"url": "https://www.buymeacoffee.com/en3rgy"
23+
}
24+
],
1525
"engines": {
1626
"node": ">=18.17.0",
1727
"homebridge": ">=1.6.0"
@@ -24,7 +34,9 @@
2434
"prepublishOnly": "npm run lint && npm run build"
2535
},
2636
"keywords": [
27-
"homebridge-plugin"
37+
"homebridge-plugin",
38+
"KNX",
39+
"Gira Homeserver"
2840
],
2941
"devDependencies": {
3042
"@types/jest": "^29.5.6",

src/hs.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ export class HomeServerConnector {
2828
private requestPromiseRejecter: Map<string, (reason?: any) => void> = new Map();
2929
private lastSet: Map<string, string> = new Map();
3030

31+
private _hsIp = '';
32+
private _hsPort = 0;
33+
private _user = '';
34+
private _pw = '';
35+
3136
/**
3237
*
3338
*/
@@ -51,10 +56,12 @@ export class HomeServerConnector {
5156
* @param pw
5257
*/
5358
connect(hsIp: string, hsPort: number, user: string, pw: string) {
54-
const hostname = hsIp;
55-
const port = hsPort;
59+
this._hsIp = hsIp;
60+
this._hsPort = hsPort;
61+
this._user = user;
62+
this._pw = pw;
5663
const prot = 'wss';
57-
const url = prot + '://' + hostname + ':' + port + '/endpoints/ws?authorization=' + encodeURIComponent(btoa(user + ':' + pw));
64+
const url = prot + '://' + this._hsIp + ':' + this._hsPort + '/endpoints/ws?authorization=' + encodeURIComponent(btoa(user + ':' + pw));
5865
this._ws = new WebSocket.WebSocket(url, { rejectUnauthorized: false });
5966
this._connState = CONNECTION_STATE.CONNECTING;
6067

@@ -205,6 +212,7 @@ export class HomeServerConnector {
205212
// Create a promise to wait for the response
206213

207214
if (this.getConnState() !== CONNECTION_STATE.OPEN) {
215+
this.connect(this._hsIp, this._hsPort, this._user, this._pw);
208216
if (retries > 0) {
209217
setTimeout(() => {
210218
this.sendJson(msg, retries - 1);
@@ -239,7 +247,7 @@ export class HomeServerConnector {
239247
}
240248

241249
const smsg = JSON.stringify(msg);
242-
this.logger.info('hs.ts | Send message: ' + smsg);
250+
this.logger.debug('hs.ts | Send message: ' + smsg);
243251
this._ws.send(smsg);
244252

245253
}

src/service/characteristic/TargetDoorState.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export const addTargetDoorStateCharacteristic = (api: API,
1616

1717
targetDoorState.onGet(async () => {
1818
const ret = hsd.getCo(getEndpoint);
19-
console.log('"%s"', ret);
2019
if (typeof(ret) === 'object') {
2120
return 99;
2221
}

0 commit comments

Comments
 (0)