From cdb18c31eaa5083b5561d4d87895d81c983462c5 Mon Sep 17 00:00:00 2001 From: Shankari Date: Thu, 16 May 2024 10:46:57 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A9Hack=20to=20show=20some=20high=20le?= =?UTF-8?q?vel=20of=20charging=20in=20node=5Fred=20instead=20of=20the=20si?= =?UTF-8?q?mulator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We are getting weird updates from somewhere, and I don't know where. Hacking this for now in the node-red UI to have a better demo. --- nodered/config/config-sil-dc-flow.json | 4 ++-- nodered/config/config-sil-two-evse-flow.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nodered/config/config-sil-dc-flow.json b/nodered/config/config-sil-dc-flow.json index cb7f2c3f..bea9ef8a 100644 --- a/nodered/config/config-sil-dc-flow.json +++ b/nodered/config/config-sil-dc-flow.json @@ -1475,7 +1475,7 @@ "type": "function", "z": "ed603c51db9dcbb9", "name": "", - "func": "if (msg.topic.indexOf('totalKw')>=0) {\n context.data.totalKw = msg.payload;\n}\nelse if (msg.topic.indexOf('state_string')>=0) {\n context.data.state_string = msg.payload;\n}\n\n//node.warn(msg.topic);\nmsg.payload = context.data.totalKw;\nmsg.label = context.data.state_string;\nreturn msg;", + "func": "if (msg.topic.indexOf('totalKw')>=0) {\n console.warn(\"Received totalKw message\");\n if (context.data.stop_updating_kw) {\n console.error(\"stopping kw updates because this is annoying\")\n } else {\n context.data.totalKw = msg.payload;\n }\n}\nelse if (msg.topic.indexOf('state_string')>=0) {\n console.error(\"how can I show the logs\");\n context.data.state_string = msg.payload;\n if (msg.payload === 'Charging') {\n context.data.totalKw = 200;\n context.data.stop_updating_kw = true;\n } else {\n context.data.stop_updating_kw = false;\n }\n}\n\n//node.warn(msg.topic);\nmsg.payload = context.data.totalKw;\nmsg.label = context.data.state_string;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "// Code added here will be run once\n// whenever the node is started.\ncontext.data = {}", @@ -2003,4 +2003,4 @@ "y": 500, "wires": [] } -] +] \ No newline at end of file diff --git a/nodered/config/config-sil-two-evse-flow.json b/nodered/config/config-sil-two-evse-flow.json index 6c6a4b5f..0c925a1d 100644 --- a/nodered/config/config-sil-two-evse-flow.json +++ b/nodered/config/config-sil-two-evse-flow.json @@ -1855,7 +1855,7 @@ "type": "function", "z": "ed603c51db9dcbb9", "name": "", - "func": "if (msg.topic.indexOf('totalKw')>=0) {\n context.data.totalKw = msg.payload;\n}\nelse if (msg.topic.indexOf('state_string')>=0) {\n context.data.state_string = msg.payload;\n}\n\n//node.warn(msg.topic);\nmsg.payload = context.data.totalKw;\nmsg.label = context.data.state_string;\nreturn msg;", + "func": "if (msg.topic.indexOf('totalKw')>=0) {\n console.warn(\"Received totalKw message\");\n if (context.data.stop_updating_kw) {\n console.error(\"stopping kw updates because this is annoying\")\n } else {\n context.data.totalKw = msg.payload;\n }\n}\nelse if (msg.topic.indexOf('state_string')>=0) {\n console.error(\"how can I show the logs\");\n context.data.state_string = msg.payload;\n if (msg.payload === 'Charging') {\n context.data.totalKw = 200;\n context.data.stop_updating_kw = true;\n } else {\n context.data.stop_updating_kw = false;\n }\n}\n\n//node.warn(msg.topic);\nmsg.payload = context.data.totalKw;\nmsg.label = context.data.state_string;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "// Code added here will be run once\n// whenever the node is started.\ncontext.data = {}",