Display Power Schedule
This flow turns display on/off in desired time.
About this flow
| System | Node-RED |
|---|---|
| AWTRIX version | AWTRIX 3 |
| Topic | Miscellaneous |
| Built by | stanoba |
| File | GYpgOwl65ZE0.json · 5.8 KB |
| Icons | — |
| Published | 31 Aug 2023 · updated 31 Aug 2023 |
| Downloads | 35 |
Is this your flow?
If you created this flow, open your saved edit link to add it to your account. You can then manage it whenever you sign in. Adding it to your account replaces the edit link.
Flow description
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
GYpgOwl65ZE0.json
[
{
"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": ""
}
]
Discussion 0
Ask a question, suggest a change or share how you use it.
No comments yet. Start the conversation.
More flows for Node-RED or Miscellaneous
Something wrong with this flow? Report it.
Have an idea?
Sign in to ask questions and join the conversation.