smart-bus 0.7.0 → 0.9.0
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/CHANGELOG.md +21 -0
- package/README.md +1 -1
- package/lib/bus.js +5 -5
- package/lib/command.js +1 -1
- package/lib/commands.js +198 -70
- package/package.json +7 -8
- package/test/bus.js +24 -24
- package/test/command.js +5 -5
- package/test/device.js +1 -1
- package/test/fixtures/commands.js +199 -106
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## 0.9.0
|
|
2
|
+
|
|
3
|
+
* Add Get Curtain Duration commands (`0xE800`, `0xE801`)
|
|
4
|
+
* Add Dry Contact Multi-Channel Status command (`0x6F00`)
|
|
5
|
+
* Add Dry Contact broadcast status commands (`0x15D0`, `0x15D1`)
|
|
6
|
+
* Fix `0xE3E3` Curtain Status to support optional duration field
|
|
7
|
+
* Add comprehensive test coverage for new commands
|
|
8
|
+
* Maintain 100% backward compatibility with existing implementations
|
|
9
|
+
|
|
10
|
+
## 0.8.0
|
|
11
|
+
|
|
12
|
+
* Update for Node.js v22 compatibility
|
|
13
|
+
* Replace deprecated `new Buffer()` constructors with modern APIs
|
|
14
|
+
* Update minimum Node.js version from >=0.12 to >=12.0.0
|
|
15
|
+
* Update development dependencies (mocha, eslint, should, simple-mock)
|
|
16
|
+
* Replace istanbul with nyc for test coverage
|
|
17
|
+
|
|
18
|
+
**BREAKING:**
|
|
19
|
+
|
|
20
|
+
- Node.js version requirement increased from >=0.12 to >=12.0.0
|
|
21
|
+
|
|
1
22
|
## 0.7.0
|
|
2
23
|
|
|
3
24
|
* Add Read Dry Contact Status commaands (`0x15CE`, `0x15CF`)
|
package/README.md
CHANGED
package/lib/bus.js
CHANGED
|
@@ -9,16 +9,16 @@ var EventEmitter = require('events');
|
|
|
9
9
|
|
|
10
10
|
module.exports = Bus;
|
|
11
11
|
|
|
12
|
-
var Constants =
|
|
12
|
+
var Constants = Buffer.allocUnsafe(12);
|
|
13
13
|
|
|
14
|
-
Constants.write('HDLMIRACLE');
|
|
14
|
+
Constants.write('HDLMIRACLE', 0, 'ascii');
|
|
15
15
|
Constants.writeUInt16BE(0xAAAA, 10);
|
|
16
16
|
|
|
17
17
|
function Bus(resource) {
|
|
18
18
|
var config = parse(resource);
|
|
19
19
|
var port = config.port;
|
|
20
20
|
|
|
21
|
-
this.address =
|
|
21
|
+
this.address = Buffer.from([0, 0, 0, 0]);
|
|
22
22
|
|
|
23
23
|
this.port = port ? parseInt(port) : 6000;
|
|
24
24
|
this.gateway = config.gateway;
|
|
@@ -113,7 +113,7 @@ Bus.prototype.send = function(options, callback) {
|
|
|
113
113
|
return callback(err);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
var checksum =
|
|
116
|
+
var checksum = Buffer.allocUnsafe(2);
|
|
117
117
|
|
|
118
118
|
checksum.writeUInt16BE(crc(content), 0);
|
|
119
119
|
|
|
@@ -227,7 +227,7 @@ function createSocket(bus) {
|
|
|
227
227
|
socket.on('listening', function() {
|
|
228
228
|
var address = socket.address();
|
|
229
229
|
|
|
230
|
-
bus.address =
|
|
230
|
+
bus.address = Buffer.from(address.address.split('.'));
|
|
231
231
|
|
|
232
232
|
debug('UDP Server is listening on ' + address.address + ':' + address.port);
|
|
233
233
|
|
package/lib/command.js
CHANGED