@thingwala/node-red-contrib-geyserwala-connect 0.0.8 ā 0.0.10
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 +10 -0
- package/Makefile +6 -6
- package/README.md +14 -1
- package/package.json +1 -1
- package/src/nodes/geyserwala-api-mqtt.js +4 -2
- package/src/nodes/geyserwala-api-rest.js +1 -1
- package/src/nodes/geyserwala-nodes.html +10 -6
- package/src/nodes/geyserwala-nodes.js +9 -4
- package/tools/geyserwala-scan.js +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Change Log - Geyserwala Connect - Node-RED Plugin
|
|
2
2
|
|
|
3
|
+
## [0.0.10] - 2026-03-14
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
REST connector full topic handling
|
|
8
|
+
|
|
9
|
+
## [0.0.9] - 2026-02-15
|
|
10
|
+
|
|
11
|
+
Add 'Full Topic' node option
|
|
12
|
+
|
|
3
13
|
## [0.0.8] - 2025-02-23
|
|
4
14
|
|
|
5
15
|
Fix multiple API Connector handling
|
package/Makefile
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
setup:
|
|
2
2
|
node -v
|
|
3
3
|
npm -v
|
|
4
|
-
mkdir -p
|
|
5
|
-
cd
|
|
4
|
+
mkdir -p _node_red && \
|
|
5
|
+
cd _node_red && \
|
|
6
6
|
npm init -y && \
|
|
7
7
|
npm install node-red && \
|
|
8
8
|
npm install mqtt
|
|
9
9
|
|
|
10
10
|
link:
|
|
11
|
-
cd
|
|
11
|
+
cd _node_red/node_modules && \
|
|
12
12
|
ln -sf ../.. node-red-contrib-geyserwala-connect
|
|
13
13
|
|
|
14
14
|
unlink:
|
|
15
|
-
rm -f
|
|
15
|
+
rm -f _node_red/node_modules/node-red-contrib-geyserwala-connect
|
|
16
16
|
|
|
17
17
|
clean:
|
|
18
|
-
rm -rf
|
|
18
|
+
rm -rf _node_red
|
|
19
19
|
|
|
20
20
|
run:
|
|
21
|
-
cd
|
|
21
|
+
cd _node_red && \
|
|
22
22
|
npx node-red -u .
|
|
23
23
|
|
|
24
24
|
login:
|
package/README.md
CHANGED
|
@@ -5,9 +5,22 @@ Geyserwala Connect - Node-RED Integration <!-- omit in toc -->
|
|
|
5
5
|
|
|
6
6
|
## Usage
|
|
7
7
|
|
|
8
|
-
Use these nodes to integrate with your Geyserwala Connect to automate your
|
|
8
|
+
Use these nodes to integrate with your Geyserwala Connect to automate your geyser controller from Node-RED. For more detail see the [Integration](https://www.thingwala.com/geyserwala/connect/integration) section in the manual.
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
# Tools
|
|
12
|
+
|
|
13
|
+
## Device Discovery using mDNS
|
|
14
|
+
|
|
15
|
+
The Geyserwala Connect advertises its presence on the network using mDNS, allowing its IP address to be resolved via `<hostname>.local`. Additionally, you can scan for all devices advertising the `_geyserwala._tcp` service.
|
|
16
|
+
|
|
17
|
+
This [geyserwala-scan.js](./tools/geyserwala-scan.js) script lists all Geyserwala Connect devices found on your network. To run it:
|
|
18
|
+
```
|
|
19
|
+
wget https://raw.githubusercontent.com/thingwala/node-red-contrib-geyserwala-connect/refs/heads/main/tools/geyserwala-scan.js
|
|
20
|
+
npm install dnssd
|
|
21
|
+
node ./geyserwala-scan.js
|
|
22
|
+
```
|
|
23
|
+
|
|
11
24
|
# Contribution
|
|
12
25
|
|
|
13
26
|
Yes please! We want our Geyserwala integration with Node-RED to be the best it can be for everyone. If you have Node-RED development experience or have just noticed a niggly bug, feel free to fork this repo and submit a pull request. Here are the [Node-RED docs](https://nodered.org/docs/).
|
package/package.json
CHANGED
|
@@ -39,14 +39,16 @@ class GeyserwalaConnectorMqtt {
|
|
|
39
39
|
for (const node of this.subscriptions[topic]) {
|
|
40
40
|
try {
|
|
41
41
|
let value
|
|
42
|
-
if (node.valueType
|
|
42
|
+
if (node.valueType == 'JSON') {
|
|
43
|
+
value = JSON.parse(msg)
|
|
44
|
+
} else if (node.valueType === Number) {
|
|
43
45
|
value = parseInt(msg)
|
|
44
46
|
} else if (node.valueType === Boolean) {
|
|
45
47
|
value = msg == 'ON'
|
|
46
48
|
} else {
|
|
47
49
|
value = String(msg)
|
|
48
50
|
}
|
|
49
|
-
node.onValue(value)
|
|
51
|
+
node.onValue(topic, value)
|
|
50
52
|
} catch (error) {
|
|
51
53
|
this.RED.log.error(`{Geyserwala Connect} Handling messsage: ${error.message} [${topic}] "${msg}"`);
|
|
52
54
|
}
|
|
@@ -60,7 +60,7 @@ class GeyserwalaConnectorRest {
|
|
|
60
60
|
}
|
|
61
61
|
for (const node of this.subscriptions[key]) {
|
|
62
62
|
try {
|
|
63
|
-
node.onValue(blob[key])
|
|
63
|
+
node.onValue(`${this.host}:${this.port}/${key}`, blob[key])
|
|
64
64
|
} catch (error) {
|
|
65
65
|
this.RED.log.error(`{Geyserwala Connect} Handling messsage: ${error.message} [${key}] "${blob[key]}"`);
|
|
66
66
|
}
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
<label for="node-input-geyserwalaApi"><i class="fa fa-link"></i> Geyserwala</label>
|
|
11
11
|
<input type="text" id="node-input-geyserwalaApi">
|
|
12
12
|
</div>
|
|
13
|
+
<div class="form-row">
|
|
14
|
+
<label for="node-input-fullTopic"><i class="fa fa-hashtag"></i> Full Topic</label>
|
|
15
|
+
<input type="checkbox" id="node-input-fullTopic" style="width:auto; margin-left:6px;">
|
|
16
|
+
</div>
|
|
13
17
|
</script>
|
|
14
18
|
|
|
15
19
|
<script type="text/template" id="node-input-value-template">
|
|
@@ -18,7 +22,7 @@
|
|
|
18
22
|
<div class="form-row">
|
|
19
23
|
<label for="node-input-valueType"><i class="fa fa-cube"></i> Type</label>
|
|
20
24
|
<select id="node-input-valueType" style="width:25%;">
|
|
21
|
-
<option value="">
|
|
25
|
+
<option value="JSON">JSON</option>
|
|
22
26
|
<option value="Boolean">Boolean</option>
|
|
23
27
|
<option value="Number">Number</option>
|
|
24
28
|
<option value="String">String</option>
|
|
@@ -33,15 +37,14 @@
|
|
|
33
37
|
|
|
34
38
|
<script type="text/javascript">
|
|
35
39
|
function addInputDialog(node) {
|
|
36
|
-
var nodeInput = $("#node-input-template").clone()
|
|
40
|
+
var nodeInput = $("#node-input-template").clone();
|
|
37
41
|
|
|
38
42
|
if (node.type === null) {
|
|
39
|
-
var nodeInputValue = $("#node-input-value-template").clone()
|
|
40
|
-
|
|
41
|
-
nodeInput += nodeInputValue
|
|
43
|
+
var nodeInputValue = $("#node-input-value-template").clone();
|
|
44
|
+
nodeInput.append(nodeInputValue.html());
|
|
42
45
|
}
|
|
43
46
|
|
|
44
|
-
var scriptTag = $("<script>").attr("type", "text/x-red").attr("data-template-name", `geyserwala-connect-${node.key}`).append(nodeInput);
|
|
47
|
+
var scriptTag = $("<script>").attr("type", "text/x-red").attr("data-template-name", `geyserwala-connect-${node.key}`).append(nodeInput.html());
|
|
45
48
|
scriptTag.find('#title').text(`Geyserwala Connect : ${node.name}`);
|
|
46
49
|
$('body').append(scriptTag.prop('outerHTML'));
|
|
47
50
|
}
|
|
@@ -57,6 +60,7 @@
|
|
|
57
60
|
geyserwalaApi: { type: "geyserwala-connect-api", required: true },
|
|
58
61
|
valueKey: { value: undefined },
|
|
59
62
|
valueType: { value: undefined },
|
|
63
|
+
fullTopic: { value: false },
|
|
60
64
|
},
|
|
61
65
|
inputs: node.input ? 1 : 0,
|
|
62
66
|
outputs: 1,
|
|
@@ -4,13 +4,14 @@ module.exports = function (RED) {
|
|
|
4
4
|
constructor (config) {
|
|
5
5
|
RED.nodes.createNode(this, config);
|
|
6
6
|
|
|
7
|
-
this.valueKey = node.type ? node.key :
|
|
7
|
+
this.valueKey = node.type ? node.key : config.valueKey
|
|
8
8
|
this.valueType = node.type ? node.type : {
|
|
9
|
-
"":
|
|
9
|
+
"JSON": "JSON",
|
|
10
10
|
"Boolean": Boolean,
|
|
11
11
|
"Number": Number,
|
|
12
12
|
"String": String,
|
|
13
13
|
}[config.valueType]
|
|
14
|
+
this.fullTopic = !!config.fullTopic
|
|
14
15
|
|
|
15
16
|
this.status({fill:"grey", shape:"ring", text:"initialising ..."});
|
|
16
17
|
|
|
@@ -46,9 +47,13 @@ module.exports = function (RED) {
|
|
|
46
47
|
|
|
47
48
|
this.api.hookNode(this)
|
|
48
49
|
}
|
|
49
|
-
onValue(payload) {
|
|
50
|
+
onValue(topic, payload) {
|
|
50
51
|
try {
|
|
51
|
-
|
|
52
|
+
if (this.fullTopic) {
|
|
53
|
+
this.send({ topic, payload })
|
|
54
|
+
} else {
|
|
55
|
+
this.send({ topic: this.valueKey, payload })
|
|
56
|
+
}
|
|
52
57
|
} catch (error) {
|
|
53
58
|
this.error(`Receiving "${valueKey}": ${error.message}`);
|
|
54
59
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
const dnssd = require('dnssd');
|
|
4
|
+
|
|
5
|
+
console.log('š Scanning for _geyserwala._tcp services...');
|
|
6
|
+
|
|
7
|
+
const browser = new dnssd.Browser(dnssd.tcp('geyserwala'));
|
|
8
|
+
|
|
9
|
+
browser.on('serviceUp', service => {
|
|
10
|
+
console.log(`\nš” Service: ${service.name}`);
|
|
11
|
+
console.log(` Host : ${service.host}`);
|
|
12
|
+
console.log(` Port : ${service.port}`);
|
|
13
|
+
console.log(` IPs : ${service.addresses.join(', ')}`);
|
|
14
|
+
console.log(` TXT :`, service.txt || {});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
browser.on('error', err => {
|
|
18
|
+
console.error('ā Error:', err);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
browser.start();
|