Display Power Schedule
Node-RED

Display Power Schedule

This flow turns display on/off in desired time.
A flow by stanoba

Download flow

Flow Details

This flow turns display on/off in desired time.

Setup

Step 1: Install node-red-contrib-chronos

Instructions are here https://flows.nodered.org/node/node-red-contrib-chronos

Step 2: Configure Scheduler node

Set your location (latitude and longitude) and ON/OFF time in Scheduler node.

Step 3: Set vars

Set MQTT topic prefix in SET vars node

Step 4: Set MQTT connection

Set MQTT connection in MQTT node

[ { "id": "5a03cbe9a6459077", "type": "tab", "label": "LED Matrix display schedule", "disabled": false, "info": "", "env": [] }, { "id": "f242dc6511e99976", "type": "chronos-scheduler", "z": "5a03cbe9a6459077", "name": "Schedule power", "config": "db14326cf702f85d", "schedule": [ { "trigger": { "type": "time", "value": "1:00", "offset": 0, "random": false }, "output": { "type": "msg", "property": { "name": "power", "type": "str", "value": "OFF" } } }, { "trigger": { "type": "time", "value": "6:00", "offset": 0, "random": false }, "output": { "type": "msg", "property": { "name": "power", "type": "str", "value": "ON" } } } ], "multiPort": false, "nextEventPort": false, "disabled": false, "outputs": 1, "x": 240, "y": 340, "wires": [ [ "771866a7baea7fb5" ] ] }, { "id": "771866a7baea7fb5", "type": "function", "z": "5a03cbe9a6459077", "name": "Dispaly ON/OFF function", "func": "var prefix = flow.get(\"prefix\");\nmsg.topic = prefix+ \"/power\";\nvar value = '';\n\nif (msg.power === \"ON\"){\nvalue = 1;\n}else if (msg.power === \"OFF\"){\nvalue = 0;\n}\n\nmsg.payload = { \"power\": value };\n\nnode.status({ fill: 'green', shape: 'ring', text: msg.power});\n\nreturn msg;\n\n\n\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 550, "y": 260, "wires": [ [ "1460c777a74257e0" ] ] }, { "id": "ba9e45f34b558fb1", "type": "inject", "z": "5a03cbe9a6459077", "name": "Display ON", "props": [ { "p": "power", "v": "ON", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": "1", "topic": "", "x": 250, "y": 220, "wires": [ [ "771866a7baea7fb5" ] ] }, { "id": "59258bca80221ddf", "type": "inject", "z": "5a03cbe9a6459077", "name": "Display OFF", "props": [ { "p": "power", "v": "OFF", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": "1", "topic": "", "x": 250, "y": 280, "wires": [ [ "771866a7baea7fb5" ] ] }, { "id": "1460c777a74257e0", "type": "mqtt out", "z": "5a03cbe9a6459077", "name": "", "topic": "", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "7ab578ded1bbee4f", "x": 770, "y": 260, "wires": [] }, { "id": "11459bd9b3dd2d37", "type": "change", "z": "5a03cbe9a6459077", "name": "SET vars", "rules": [ { "t": "set", "p": "prefix", "pt": "flow", "to": "awtrix", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 400, "y": 120, "wires": [ [] ] }, { "id": "b47441db0275aa0d", "type": "inject", "z": "5a03cbe9a6459077", "name": "Start", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": true, "onceDelay": "1", "topic": "", "payload": "", "payloadType": "date", "x": 230, "y": 120, "wires": [ [ "11459bd9b3dd2d37" ] ] }, { "id": "db14326cf702f85d", "type": "chronos-config", "name": "local", "timezone": "", "sunPositions": [] }, { "id": "7ab578ded1bbee4f", "type": "mqtt-broker", "name": "localhost", "broker": "localhost", "port": "1883", "clientid": "", "autoConnect": true, "usetls": false, "protocolVersion": "4", "keepalive": "60", "cleansession": true, "birthTopic": "", "birthQos": "0", "birthPayload": "", "birthMsg": {}, "closeTopic": "", "closeQos": "0", "closePayload": "", "closeMsg": {}, "willTopic": "", "willQos": "0", "willPayload": "", "willMsg": {}, "sessionExpiry": "" } ]
-- Flow first published on August 31, 2023, last updated on August 31, 2023 at 11:25.