Skip to content

Commit

Permalink
💩Hack to show some high level of charging in node_red instead of the …
Browse files Browse the repository at this point in the history
…simulator

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.
  • Loading branch information
shankari committed May 16, 2024
1 parent 33767cc commit cdb18c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions nodered/config/config-sil-dc-flow.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}",
Expand Down Expand Up @@ -2003,4 +2003,4 @@
"y": 500,
"wires": []
}
]
]
2 changes: 1 addition & 1 deletion nodered/config/config-sil-two-evse-flow.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}",
Expand Down

0 comments on commit cdb18c3

Please sign in to comment.