Posts: 189
Threads: 16
Joined: Nov 2020
Reputation:
18
I've recently started to use Node-Red for some LED Lighting controls. I've also had a look at switching relays for use as Digital Switching. As I'm still new to this I would appreciate any feedback on the setup or the approach.
Posts: 230
Threads: 49
Joined: Mar 2017
Reputation:
4
2025-01-02, 10:06 PM
(This post was last modified: 2025-01-02, 10:07 PM by Lazzz.)
(2025-01-02, 01:31 PM)Boatingbaileys Wrote: I've recently started to use Node-Red for some LED Lighting controls. I've also had a look at switching relays for use as Digital Switching. As I'm still new to this I would appreciate any feedback on the setup or the approach.
G'day Mat,
I have attached a copy of my flows - 6 different that I've built on over the years. The "Gauges" one being the most extensive.
In there is a flow for switching relays - I have a 4ch relay.
Once you import them most should make sense but I do have switch for an electric valve which is on the engine coolant to the hot water tank used for heating the hot water. I have the switch setup so that the valve will only open when the engine coolant temp is hotter that the hot water system.
You may get some use from this or not. I have certainly gained knowledge from your videos.
Cheers,
Larry
My Flows 030125.txt (Size: 105.19 KB / Downloads: 19)
Pi5 8GB, NVME SSD 512GB, MacArthur hat, OP4,
Posts: 189
Threads: 16
Joined: Nov 2020
Reputation:
18
Morning Larry,
Many thanks for your response and comments on the videos. I'll take a look at the flows you've attached - Thanks.
Mat
Posts: 1,291
Threads: 107
Joined: Mar 2016
Reputation:
81
not sure if this is any use, but here's a timer I use for turning off the music player, used it for timed switches as well.
Cos forgetting to turn off the pump to the heater daytank really makes a mess.. ?
Code: [
{
"id": "b40aa325e1421527",
"type": "inject",
"z": "926cc4b9fdf71654",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "0.2",
"payloadType": "num",
"x": 110,
"y": 620,
"wires": [
[
"f811bdc1ac3ce2e9"
]
]
},
{
"id": "f811bdc1ac3ce2e9",
"type": "function",
"z": "926cc4b9fdf71654",
"name": "timeout in minutes",
"func": "msg.timeout = msg.payload * 60;\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 310,
"y": 620,
"wires": [
[
"cd5544f11bce38f7"
]
]
},
{
"id": "b2297ed54a6ba7b8",
"type": "ui_numeric",
"z": "926cc4b9fdf71654",
"name": "",
"label": "Sleep time, minutes.",
"tooltip": "",
"group": "d4a061b3.6ae9d",
"order": 2,
"width": 0,
"height": 0,
"wrap": false,
"passthru": true,
"topic": "topic",
"topicType": "msg",
"format": "{{value}}",
"min": 0,
"max": "60",
"step": 1,
"className": "",
"x": 140,
"y": 660,
"wires": [
[
"f811bdc1ac3ce2e9"
]
]
},
{
"id": "fb66b363b8c6b6bf",
"type": "ui_button",
"z": "926cc4b9fdf71654",
"name": "",
"group": "d4a061b3.6ae9d",
"order": 4,
"width": "2",
"height": "1",
"passthru": false,
"label": "Off",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "off",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 290,
"y": 720,
"wires": [
[
"cd5544f11bce38f7"
]
]
},
{
"id": "394562b3f17398c3",
"type": "ui_text",
"z": "926cc4b9fdf71654",
"group": "d4a061b3.6ae9d",
"order": 1,
"width": 0,
"height": 0,
"name": "",
"label": "Time til turn off",
"format": "{{msg.payload}}",
"layout": "row-spread",
"className": "",
"x": 560,
"y": 680,
"wires": []
},
{
"id": "87ecd52b8e335ce1",
"type": "function",
"z": "926cc4b9fdf71654",
"name": "minutesCountdown",
"func": "var temp = msg.payload;\nvar minutes = parseInt(temp/60);\nvar seconds = temp - minutes*60;\nsecondszero = \"\";\nif (seconds<10){\n secondszero = \"0\";\n}\n\nmsg.payload = minutes.toString() + \":\" + secondszero + seconds.toString();\nvar newMsg = { payload: minutes};\nnewMsg.topic = \"countdown\";\nreturn [msg, newMsg];",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 490,
"y": 720,
"wires": [
[
"394562b3f17398c3"
],
[]
]
},
{
"id": "0d946ebebad153f2",
"type": "exec",
"z": "926cc4b9fdf71654",
"command": " clementine --stop",
"addpay": false,
"append": "",
"useSpawn": "false",
"timer": "",
"winHide": false,
"oldrc": false,
"name": "",
"x": 550,
"y": 620,
"wires": [
[],
[],
[]
]
},
{
"id": "3b7e514dc144c9b0",
"type": "ui_slider",
"z": "926cc4b9fdf71654",
"name": "",
"label": "Sleep time",
"tooltip": "",
"group": "d4a061b3.6ae9d",
"order": 3,
"width": 0,
"height": 0,
"passthru": true,
"outs": "end",
"topic": "topic",
"topicType": "msg",
"min": 0,
"max": "60",
"step": 1,
"className": "",
"x": 130,
"y": 700,
"wires": [
[
"b2297ed54a6ba7b8"
]
]
},
{
"id": "9f4419c9990cfc4a",
"type": "comment",
"z": "926cc4b9fdf71654",
"name": "Sleep Timer",
"info": "",
"x": 110,
"y": 580,
"wires": []
},
{
"id": "cd5544f11bce38f7",
"type": "mytimeout",
"z": "926cc4b9fdf71654",
"name": "",
"outtopic": "",
"outsafe": "",
"outwarning": "",
"outunsafe": "off",
"warning": "1",
"timer": "3",
"debug": false,
"ndebug": false,
"ignoreCase": false,
"repeat": false,
"again": false,
"x": 350,
"y": 660,
"wires": [
[
"0d946ebebad153f2"
],
[
"87ecd52b8e335ce1"
]
]
},
{
"id": "d4a061b3.6ae9d",
"type": "ui_group",
"name": "Auto Off",
"tab": "e93ef2b0.f7b94",
"order": 1,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "e93ef2b0.f7b94",
"type": "ui_tab",
"name": "Web Radio",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]
Posts: 189
Threads: 16
Joined: Nov 2020
Reputation:
18
Thanks - I'll take a look.
|