Created
August 3, 2024 18:01
-
-
Save sebastianrothbucher/87cf4f9b72dbe91b4745ebd1c9a2c8e7 to your computer and use it in GitHub Desktop.
Simulating a sine curve and sudden drop via Node-Red
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "id": "91450f41b1eae9c6", | |
| "type": "inject", | |
| "z": "426169ba36026cef", | |
| "name": "on", | |
| "props": [ | |
| { | |
| "p": "payload" | |
| }, | |
| { | |
| "p": "topic", | |
| "vt": "str" | |
| } | |
| ], | |
| "repeat": "", | |
| "crontab": "", | |
| "once": false, | |
| "onceDelay": 0.1, | |
| "topic": "", | |
| "payload": "1", | |
| "payloadType": "num", | |
| "x": 130, | |
| "y": 600, | |
| "wires": [ | |
| [ | |
| "9f364e25524fc4d9" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "3ace76a582a9fba2", | |
| "type": "function", | |
| "z": "426169ba36026cef", | |
| "name": "function 1", | |
| "func": "\nreturn {\n payload: {\n temperature: flow.get(\"drop\") ? -120 : (100 * Math.sin((Date.now() % 10000) * 2 * Math.PI / 10000)),\n },\n};", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 460, | |
| "y": 740, | |
| "wires": [ | |
| [ | |
| "6cb7057e0d3f84af", | |
| "877a2581f427714a" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "9f364e25524fc4d9", | |
| "type": "trigger", | |
| "z": "426169ba36026cef", | |
| "name": "", | |
| "op1": "1", | |
| "op2": "0", | |
| "op1type": "str", | |
| "op2type": "flow", | |
| "duration": "-500", | |
| "extend": false, | |
| "overrideDelay": false, | |
| "units": "ms", | |
| "reset": "0", | |
| "bytopic": "all", | |
| "topic": "topic", | |
| "outputs": 1, | |
| "x": 390, | |
| "y": 620, | |
| "wires": [ | |
| [ | |
| "3ace76a582a9fba2" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "72d5b0fa0e39dfd4", | |
| "type": "inject", | |
| "z": "426169ba36026cef", | |
| "name": "off", | |
| "props": [ | |
| { | |
| "p": "payload" | |
| }, | |
| { | |
| "p": "topic", | |
| "vt": "str" | |
| } | |
| ], | |
| "repeat": "", | |
| "crontab": "", | |
| "once": false, | |
| "onceDelay": 0.1, | |
| "topic": "", | |
| "payload": "0", | |
| "payloadType": "num", | |
| "x": 130, | |
| "y": 640, | |
| "wires": [ | |
| [ | |
| "9f364e25524fc4d9" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "6cb7057e0d3f84af", | |
| "type": "debug", | |
| "z": "426169ba36026cef", | |
| "name": "debug 4", | |
| "active": true, | |
| "tosidebar": true, | |
| "console": false, | |
| "tostatus": false, | |
| "complete": "payload", | |
| "targetType": "msg", | |
| "statusVal": "", | |
| "statusType": "auto", | |
| "x": 660, | |
| "y": 740, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "877a2581f427714a", | |
| "type": "mqtt out", | |
| "z": "426169ba36026cef", | |
| "name": "", | |
| "topic": "v1/devices/me/telemetry", | |
| "qos": "1", | |
| "retain": "", | |
| "respTopic": "", | |
| "contentType": "", | |
| "userProps": "", | |
| "correl": "", | |
| "expiry": "", | |
| "broker": "105d442571249980", | |
| "x": 710, | |
| "y": 800, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "2957d10212db27b1", | |
| "type": "change", | |
| "z": "426169ba36026cef", | |
| "name": "drop on", | |
| "rules": [ | |
| { | |
| "t": "set", | |
| "p": "drop", | |
| "pt": "flow", | |
| "to": "1", | |
| "tot": "num" | |
| } | |
| ], | |
| "action": "", | |
| "property": "", | |
| "from": "", | |
| "to": "", | |
| "reg": false, | |
| "x": 300, | |
| "y": 920, | |
| "wires": [ | |
| [] | |
| ] | |
| }, | |
| { | |
| "id": "24d030a66817176d", | |
| "type": "change", | |
| "z": "426169ba36026cef", | |
| "name": "drop off", | |
| "rules": [ | |
| { | |
| "t": "set", | |
| "p": "drop", | |
| "pt": "flow", | |
| "to": "0", | |
| "tot": "num" | |
| } | |
| ], | |
| "action": "", | |
| "property": "", | |
| "from": "", | |
| "to": "", | |
| "reg": false, | |
| "x": 300, | |
| "y": 960, | |
| "wires": [ | |
| [] | |
| ] | |
| }, | |
| { | |
| "id": "61ff5b48f066e1d5", | |
| "type": "inject", | |
| "z": "426169ba36026cef", | |
| "name": "on", | |
| "props": [], | |
| "repeat": "", | |
| "crontab": "", | |
| "once": false, | |
| "onceDelay": 0.1, | |
| "topic": "", | |
| "x": 130, | |
| "y": 920, | |
| "wires": [ | |
| [ | |
| "2957d10212db27b1" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "8184cafe6c49c30e", | |
| "type": "inject", | |
| "z": "426169ba36026cef", | |
| "name": "off", | |
| "props": [], | |
| "repeat": "", | |
| "crontab": "", | |
| "once": false, | |
| "onceDelay": 0.1, | |
| "topic": "", | |
| "x": 130, | |
| "y": 960, | |
| "wires": [ | |
| [ | |
| "24d030a66817176d" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "105d442571249980", | |
| "type": "mqtt-broker", | |
| "name": "thinbsboard", | |
| "broker": "localhost", | |
| "port": "1883", | |
| "clientid": "", | |
| "autoConnect": true, | |
| "usetls": false, | |
| "protocolVersion": "4", | |
| "keepalive": "60", | |
| "cleansession": true, | |
| "autoUnsubscribe": true, | |
| "birthTopic": "", | |
| "birthQos": "0", | |
| "birthRetain": "false", | |
| "birthPayload": "", | |
| "birthMsg": {}, | |
| "closeTopic": "", | |
| "closeQos": "0", | |
| "closeRetain": "false", | |
| "closePayload": "", | |
| "closeMsg": {}, | |
| "willTopic": "", | |
| "willQos": "0", | |
| "willRetain": "false", | |
| "willPayload": "", | |
| "willMsg": {}, | |
| "userProps": "", | |
| "sessionExpiry": "" | |
| } | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment