From ed996921e1f4c7ecef64f231655c5acf78439f15 Mon Sep 17 00:00:00 2001 From: Patrik Mayer Date: Mon, 17 Apr 2017 22:23:14 +0200 Subject: [PATCH] webservice-node: added optional appending of msg.payload to uri --- CHANGELOG.md | 3 ++ README.md | 3 ++ loxone/loxone.html | 56 ++++++++++++++++++++----- loxone/loxone.js | 7 ++-- node-red-contrib-loxone-webservice.png | Bin 38131 -> 34770 bytes package.json | 2 +- 6 files changed, 57 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aeddb38..ff4fc83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### 0.4.0 +* webservice-node: added checkbox for appending `msg.payload` to the URI of the webservice node + ### 0.3.1 * review readme * fixed image display from readme on flows.nodered.org diff --git a/README.md b/README.md index 9b06f04..18a4a69 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,9 @@ The flow itself could be found here: http://flows.nodered.org/flow/0b3c81b336102 The webservice node, added in version `0.1.0`, allows you to directly call webservice URI's through the already established websocket connection. +Beginning with version `0.4.0` you can choose to automaticly append the incoming `msg.payload` to the set URI. +This is handy to add dynamic content to the webservice call, for example `DownOn` or `DownOff`. + As the `UpDownDigital` (etc.) virtual input has no state where the control-in node can listen to, I've switched it as an example via the webservice-node. See a short video here: https://cloud.codm.de/nextcloud/index.php/s/IttSURIGl8OkUBf diff --git a/loxone/loxone.html b/loxone/loxone.html index b7aba63..8a50448 100644 --- a/loxone/loxone.html +++ b/loxone/loxone.html @@ -18,17 +18,17 @@ if (node) { var url = './loxone-miniserver/struct?id=' + node.id; - if (node.credentials || node.changed){ + if (node.credentials || node.changed) { url = './loxone-miniserver/struct-changed' + '?id=' + node.id + '&host=' + encodeURIComponent(node.host) + '&port=' + encodeURIComponent(node.port); - if (node.credentials){ - if (node.credentials.username){ + if (node.credentials) { + if (node.credentials.username) { url += '&username=' + encodeURIComponent(node.credentials.username); } - if (node.credentials.password){ + if (node.credentials.password) { url += '&password=' + encodeURIComponent(node.credentials.password); } } @@ -200,6 +200,8 @@ .

+ + @@ -381,6 +387,8 @@ + + - @@ -494,6 +503,8 @@ + + - @@ -562,6 +577,13 @@ +
+ + + +
+ +
@@ -569,13 +591,19 @@
The URI has to start with jdev/ as dev/ is deprecated!
- Simply add use 'jdev' instead of 'dev' according to the documenation. + Simply add use 'jdev' instead of 'dev' according to the documenation.
+
+ Checking the 'append payload' checkbox will append msg.payload to the set URI + either if it is set in the node or supplied via msg.uri.
+ (jdev/sps/foo/{msg.payload})
+ + - @@ -628,6 +658,8 @@
+ +