From 65217584c886e9892a655d6b76f6be17546148bc Mon Sep 17 00:00:00 2001 From: hidetak Date: Tue, 18 Jun 2024 03:27:47 +0900 Subject: [PATCH 1/4] fix read property node setting observe bug --- node-red-node-wot/src/wot-property.html | 26 +++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/node-red-node-wot/src/wot-property.html b/node-red-node-wot/src/wot-property.html index 10ac7a0..d6cb3b2 100644 --- a/node-red-node-wot/src/wot-property.html +++ b/node-red-node-wot/src/wot-property.html @@ -37,7 +37,19 @@ $("div#property-row").hide() $("#node-input-property").change(function () { - let property = this.value + showOrHideObserveCheckbox() + }) + + $("select#node-input-thing").change(function () { + if (this.value !== "_ADD_") { + showOptions() + } else { + hideOptions() + } + }) + + function showOrHideObserveCheckbox() { + let property = $("#node-input-property").val() let thingID = $("select#node-input-thing").val() if (thingID) { RED.nodes.eachConfig((config) => { @@ -46,20 +58,13 @@ if (properties[property] && properties[property].observable) { $("div#property-observe").show() } else { + $("#node-input-observe").removeAttr("checked").prop("checked", false).change() $("div#property-observe").hide() } } }) } - }) - - $("select#node-input-thing").change(function () { - if (this.value !== "_ADD_") { - showOptions() - } else { - hideOptions() - } - }) + } function showOptions() { let thingID = $("select#node-input-thing").val() @@ -86,6 +91,7 @@ }) // Show containing div $("div#property-row").show() + showOrHideObserveCheckbox() } }) } From a58e6f241c26226e8d84ad0390344cd013a182da Mon Sep 17 00:00:00 2001 From: hidetak Date: Tue, 18 Jun 2024 03:29:54 +0900 Subject: [PATCH 2/4] update package version --- node-red-node-wot/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-red-node-wot/package.json b/node-red-node-wot/package.json index 50e1d95..9987ae9 100644 --- a/node-red-node-wot/package.json +++ b/node-red-node-wot/package.json @@ -1,6 +1,6 @@ { "name": "@thingweb/node-red-node-wot", - "version": "1.2.1", + "version": "1.2.2", "description": "Web of Things nodes for Node-RED using node-wot", "author": "Eclipse Thingweb (https://thingweb.io/)", "license": "MIT", From 95102530f175f486d22888f5ccac78c6d7d383a3 Mon Sep 17 00:00:00 2001 From: hidetak Date: Tue, 18 Jun 2024 18:13:27 +0900 Subject: [PATCH 3/4] fix create wot consumer plugin bug for observe property --- node-red-node-wot/plugin-resources-src/node-wot-plugin-lib.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/node-red-node-wot/plugin-resources-src/node-wot-plugin-lib.ts b/node-red-node-wot/plugin-resources-src/node-wot-plugin-lib.ts index 6d53720..dc3c2ab 100644 --- a/node-red-node-wot/plugin-resources-src/node-wot-plugin-lib.ts +++ b/node-red-node-wot/plugin-resources-src/node-wot-plugin-lib.ts @@ -88,6 +88,7 @@ export const createClientFlowUsingDashboard = (tdString: string, existedNodes: a ...commonParams, propertyName, propertyDescription: tdProperty.description, + propertyObserve: tdProperty.observable, inputMode: DATATYPES[tdProperty.type || "propertyTypeNull"].inputMode, convert: DATATYPES[tdProperty.type || "propertyTypeNull"].typeConvert, } @@ -595,7 +596,7 @@ const PROPERTY_READ_TEMP = `[ "thing": "<%common-genid(1)%>", "property": "<%propertyName%>", "uriVariables": "{}", - "observe": true, + "observe": <%propertyObserve%>, "x": 480, "y": <%y1%>, "wires": [ From 68b2f020989a852fb8267d555db5990cf2343db1 Mon Sep 17 00:00:00 2001 From: hidetak Date: Tue, 18 Jun 2024 19:28:58 +0900 Subject: [PATCH 4/4] fix converting boolean value bug of create wot consumer plugin --- node-red-node-wot/plugin-resources-src/node-wot-plugin-lib.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-red-node-wot/plugin-resources-src/node-wot-plugin-lib.ts b/node-red-node-wot/plugin-resources-src/node-wot-plugin-lib.ts index dc3c2ab..0ce0992 100644 --- a/node-red-node-wot/plugin-resources-src/node-wot-plugin-lib.ts +++ b/node-red-node-wot/plugin-resources-src/node-wot-plugin-lib.ts @@ -14,7 +14,7 @@ const DATATYPES = { }, boolean: { inputMode: "text", - typeConvert: "String", + typeConvert: "JSON.parse", }, object: { inputMode: "textarea",