iobroker.openknx 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -7
- package/lib/knx/.gitignore +2 -0
- package/lib/knx/README-API.md +18 -0
- package/lib/knx/index.d.ts +27 -5
- package/lib/knx/package-lock.json +236 -341
- package/lib/knx/package.json +38 -57
- package/lib/knx/src/Connection.js +41 -1
- package/lib/knx/src/Datapoint.js +4 -11
- package/lib/knx/src/FSM.js +2 -2
- package/lib/knx/test/dptlib/test-dpt.js +23 -1
- package/lib/knx/typescript-sample/.gitignore +1 -0
- package/main.js +12 -8
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -31,10 +31,6 @@ IP of your KNX IP gateway.
|
|
|
31
31
|
### Port
|
|
32
32
|
this is normally port 3671 of the KNX IP gateway.
|
|
33
33
|
|
|
34
|
-
### phys. KNX Adress
|
|
35
|
-
Fill in physical address of the KNX IP gateway in the format 1/1/1.
|
|
36
|
-
Two level group addresses can be transformed manually if needed.
|
|
37
|
-
|
|
38
34
|
### Local IPv4 network interface
|
|
39
35
|
The interface that is connected to the KNX IP gateway.
|
|
40
36
|
|
|
@@ -42,7 +38,9 @@ The interface that is connected to the KNX IP gateway.
|
|
|
42
38
|
Searches via a standardized protocol all available KNX IP Gateways on the given network interface.
|
|
43
39
|
|
|
44
40
|
### Frames delay [ms]
|
|
45
|
-
This settings protects the KNX bus from data flooding by limiting data frames to a certain rate.
|
|
41
|
+
This settings protects the KNX bus from data flooding by limiting data frames to a certain rate.
|
|
42
|
+
Not sent frames are delay until the delay time since last send on bus is elapsed. If more send requests are waiting, send order is random.
|
|
43
|
+
If you experience disconnects from your KNX IP Gateway in the log then increase this number.
|
|
46
44
|
|
|
47
45
|
### Add only new Objects
|
|
48
46
|
If checked, the import will skip overwriting existing communication objects.
|
|
@@ -306,8 +304,11 @@ Data is sent to Iobroker Sentry server hosted in Germany. If you have allowed io
|
|
|
306
304
|
- only IPv4 supported
|
|
307
305
|
|
|
308
306
|
## Changelog
|
|
309
|
-
|
|
310
|
-
* feature:
|
|
307
|
+
## 0.2.4 (2022-05-27)
|
|
308
|
+
* feature: cleanly disconnect on shutdown, upgrade to knx lib 2.5.2
|
|
309
|
+
|
|
310
|
+
### 0.2.2 (2022-05-26)
|
|
311
|
+
* feature: writing to bus l_data.con creates a ack on the iobroker object if successful (the knx conf flag unset) #133
|
|
311
312
|
* bugfix: remove manual Physical KNX address dialog, use 0.0.0 instead
|
|
312
313
|
* bugfix: remove error log when answering to GroupValueRead: #183
|
|
313
314
|
* bugfix: improve warning logs on intended and unintended disconnects
|
package/lib/knx/README-API.md
CHANGED
|
@@ -136,3 +136,21 @@ connection.writeRaw('1/0/0', Buffer.from('01', 'hex'), 1)
|
|
|
136
136
|
// Write raw buffer to a groupaddress with dpt 9 (e.g temperature 18.4 °C = Buffer<0730>) without bitlength
|
|
137
137
|
connection.writeRaw('1/0/0', Buffer.from('0730', 'hex'))
|
|
138
138
|
```
|
|
139
|
+
|
|
140
|
+
### Disconnect
|
|
141
|
+
|
|
142
|
+
In order to cleanly disconnect, you must send the Disconnect-Request and give the KNX-IP-Stack enough time to receive the Disconnect-Response back from the IP Gateway. Most IP-Gateways will have a timeout and clean stale connection up, even if you do not disconect cleanly, but depending on the limits on the number of parallel active connections, this will limit your ability to re-connect until the timeout has passed.
|
|
143
|
+
|
|
144
|
+
For NodeJS cleaning up when the script exits, this requires something like [async-exit-hook](https://www.npmjs.com/package/async-exit-hook):
|
|
145
|
+
|
|
146
|
+
```js
|
|
147
|
+
const exitHook = require('async-exit-hook');
|
|
148
|
+
|
|
149
|
+
exitHook(cb => {
|
|
150
|
+
console.log('Disconnecting from KNX…');
|
|
151
|
+
connection.Disconnect(() => {
|
|
152
|
+
console.log('Disconnected from KNX');
|
|
153
|
+
cb();
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
```
|
package/lib/knx/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ type ConnectionSpec = {
|
|
|
17
17
|
debug?: boolean,
|
|
18
18
|
manualConnect?: true,
|
|
19
19
|
minimumDelay?: number,
|
|
20
|
-
handlers
|
|
20
|
+
handlers?: HandlersSpec,
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
type KnxDeviceAddress = string
|
|
@@ -42,17 +42,39 @@ interface DatapointEvent {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
declare module 'knx' {
|
|
45
|
-
|
|
45
|
+
type MachinaEventsCallback = (...args: any[]) => void
|
|
46
|
+
|
|
47
|
+
interface MachinaEventsReturn {
|
|
48
|
+
eventName: string
|
|
49
|
+
callback: MachinaEventsCallback
|
|
50
|
+
off: () => void
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
class MachinaEvents {
|
|
54
|
+
emit(eventName: string): void
|
|
55
|
+
on(eventName: string, callback: MachinaEventsCallback): MachinaEventsReturn
|
|
56
|
+
off(eventName?: string, callback?: MachinaEventsCallback): void
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface MachinaEventsReturn {
|
|
60
|
+
eventName: string
|
|
61
|
+
callback: MachinaEventsCallback
|
|
62
|
+
off: () => void
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface IConnection extends MachinaEvents {
|
|
46
66
|
debug: boolean
|
|
47
|
-
|
|
67
|
+
Connect(): void
|
|
68
|
+
Disconnect(cb?: Function): void
|
|
48
69
|
read( ga: KnxGroupAddress, cb?: (value: Buffer) => void ): void
|
|
49
70
|
write( ga: KnxGroupAddress, value: Buffer, dpt: DPT, cb?: () => void): void
|
|
50
71
|
}
|
|
51
72
|
|
|
52
|
-
export class Connection extends
|
|
73
|
+
export class Connection extends MachinaEvents implements IConnection {
|
|
53
74
|
public debug: boolean
|
|
54
75
|
constructor( conf: ConnectionSpec )
|
|
55
|
-
|
|
76
|
+
Connect(): void
|
|
77
|
+
Disconnect(cb?: Function): void
|
|
56
78
|
read( ga: KnxGroupAddress, cb?: (value: Buffer) => void ): void
|
|
57
79
|
write( ga: KnxGroupAddress, value: Buffer, dpt: DPT, cb?: () => void): void
|
|
58
80
|
writeRaw( ga: KnxGroupAddress, value: Buffer, bitlength?: number, cb?: () => void): void
|