node-red-contrib-blynk-ws
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -25,3 +25,3 @@ /** | ||
var cmd = decodeCommand(bufArray); | ||
if (cmd.type === MsgType.HW || cmd.type === MsgType.INTERNAL) { | ||
if (cmd.type !== MsgType.RSP) { | ||
return "Cmd: " + cmd.typeString + ", Id: " + cmd.msgId + ", len: " + cmd.len + ", data: " + printData(cmd.body); | ||
@@ -42,3 +42,4 @@ } | ||
if (cmd.type === MsgType.HW) { | ||
switch(cmd.type) { | ||
case MsgType.HW: | ||
cmd.len = dataview.getUint16(3); | ||
@@ -62,4 +63,11 @@ | ||
} | ||
else if (values.length == 1) { ///handle "pm" single message | ||
cmd.operation = values[0]; | ||
} | ||
} | ||
} else if (cmd.type === MsgType.INTERNAL) { | ||
break; | ||
case MsgType.RSP: | ||
cmd.status = dataview.getUint16(3); | ||
break; | ||
default: | ||
cmd.body = ''; | ||
@@ -69,4 +77,3 @@ for (var i = 0, offset = 5; i < cmd.len; i++, offset++) { | ||
} | ||
} else { | ||
cmd.status = dataview.getUint16(3); | ||
break; | ||
} | ||
@@ -320,2 +327,17 @@ | ||
} | ||
if(cmd.type === MsgType.CONNECT_REDIRECT) { | ||
//handle server redirect | ||
var schema = "ws://"; | ||
var port = 80; | ||
if (node.path.startsWith("wss://")) { | ||
schema = "wss://"; | ||
port = 443; | ||
} | ||
var values = cmd.body.split('\0'); | ||
var serverip = values[0]; | ||
if(values[1]>0) port = values[1]; | ||
var newpath = schema + serverip + ':' + port + '/websockets'; | ||
node.path = newpath; | ||
node.warn(RED._("Connection redirecting to: ") + newpath); | ||
} | ||
} else { | ||
@@ -333,2 +355,5 @@ switch (cmd.type) { | ||
break; | ||
case 'pm': | ||
// skip message "pin mode" | ||
break; | ||
default: | ||
@@ -335,0 +360,0 @@ node.warn(RED._("Invalid HW cmd: ") + messageToDebugString(data)); |
@@ -9,2 +9,13 @@ # Changelog | ||
## [0.4.0] - 2018-03-09 | ||
### Added | ||
- Handle CONNECT_REDIRECT command see [iusse #5](https://github.com/gablau/node-red-contrib-blynk-ws/issues/5) and [this](https://community.blynk.cc/t/correct-websocket-address-for-blynk-server/22496) | ||
### Changed | ||
- Server port configuration and help message see [Blynk Library 0.5.1](https://community.blynk.cc/t/new-blynk-library-v0-5-1-is-released-important-for-local-server-owners/22449) | ||
### Fixed | ||
- Invalid HW cmd: "pm" see [iusse #3](https://github.com/gablau/node-red-contrib-blynk-ws/issues/3) | ||
- Protocol Log on message received and retrive right command body | ||
## [0.3.0] - 2017-12-12 | ||
@@ -47,5 +58,6 @@ ### Added | ||
[Unreleased]: https://github.com/gablau/node-red-contrib-blynk-ws/compare/0.3.0...HEAD | ||
[Unreleased]: https://github.com/gablau/node-red-contrib-blynk-ws/compare/0.4.0...HEAD | ||
[0.4.0]: https://github.com/gablau/node-red-contrib-blynk-ws/compare/0.3.0...0.4.0 | ||
[0.3.0]: https://github.com/gablau/node-red-contrib-blynk-ws/compare/0.2.0...0.3.0 | ||
[0.2.0]: https://github.com/gablau/node-red-contrib-blynk-ws/compare/0.1.0...0.2.0 | ||
{ | ||
"name": "node-red-contrib-blynk-ws", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Node Red integration with Blynk App and Server through websockets", | ||
@@ -5,0 +5,0 @@ "main": "blynk-ws.js", |
@@ -9,4 +9,4 @@ # node-red-contrib-blynk-ws | ||
This works for both local and cloud Blynk servers. | ||
For local, wss:// works if you ve got a certificate installed on Blynk cloud server. | ||
For Blynk cloud server, you can use **ws://blynk-cloud.com:8080/websockets** or with SSL **wss://blynk-cloud.com:9443/websockets** as the server url. | ||
For local server, wss:// works only if you ve got a certificate installed. | ||
For Blynk cloud server, you can use **ws://blynk-cloud.com/websockets** or with SSL **wss://blynk-cloud.com/websockets** as the server url. | ||
@@ -13,0 +13,0 @@ If you installed Node Red globally use this command to install |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
89441
1166