Posts: 2
Threads: 1
Joined: Oct 2024
Reputation:
0
2024-10-20, 09:04 PM
(This post was last modified: 2024-10-20, 09:40 PM by sisimonsen.)
Hi!
Have been running OP4 for a while and want to expand functionality to also include Digital switching. Starting with navigation, anchor and interior lights.
Initial plan is as follows:
1. Add a page in KIP using widget boolean Control Panel
2. Select a SignalK path for the usage. E.g. update a value to 1 or 0. (this is were my first problem is)
3. The path can also be used by e.g. scripts. E.g. turn off anchorlight at sunrise.
3. Configure "actions" in Notifications to listen for changes to the patchs for light
4. "Actions" in Notifications to control GPIO high/low
5. GPIO will control optocouplers
6. The other side of the octocouplers will have 12v and can control a normal 12v relay (when GPIO activates the optocoupler 12v will run through the OC and activate the relay)
7. Install the 12v relay to override the physical switch in the boat control panel (Bavaria 38AC with panel 201)
8. use the existing LED light next to switch (light up also when controlled from OpernPlotter even if physical switch is not used.)
My problems:
How to select a path in KIP? I cannot find documentation for how to publish paths that KIP will list ?
What is the best way to set up simple logical sentences as "if anchorlight "on" and sunrise = "now" then turn off anchorlight. nodeRed?
Have been testing different stuff this weekend, but I struggle to find an elegant way of doing it. Would like to use as most standard OpenPlotter functionality and awoid using PY scrips etc. I know there are N2K relays (rather expensive) on the marked but why not create them using inexpensive 12v relays and GPIO? Or - should I stop trying to do this in Openplotter, and simply go for HomeAssistant on the OpenPlotter raspberry instead?
Anyone want to point me in the right direction for my winterproject ?
Posts: 220
Threads: 46
Joined: Mar 2017
Reputation:
2
2024-10-20, 10:08 PM
(This post was last modified: 2024-10-20, 10:25 PM by Lazzz.)
(2024-10-20, 09:04 PM)sisimonsen Wrote: Hi!
Have been running OP4 for a while and want to expand functionality to also include Digital switching. Starting with navigation, anchor and interior lights.
Initial plan is as follows:
1. Add a page in KIP using widget boolean Control Panel
2. Select a SignalK path for the usage. E.g. update a value to 1 or 0. (this is were my first problem is)
3. The path can also be used by e.g. scripts. E.g. turn off anchorlight at sunrise.
3. Configure "actions" in Notifications to listen for changes to the patchs for light
4. "Actions" in Notifications to control GPIO high/low
5. GPIO will control optocouplers
6. The other side of the octocouplers will have 12v and can control a normal 12v relay (when GPIO activates the optocoupler 12v will run through the OC and activate the relay)
7. Install the 12v relay to override the physical switch in the boat control panel (Bavaria 38AC with panel 201)
8. use the existing LED light next to switch (light up also when controlled from OpernPlotter even if physical switch is not used.)
My problems:
How to select a path in KIP? I cannot find documentation for how to publish paths that KIP will list ?
What is the best way to set up simple logical sentences as "if anchorlight "on" and sunrise = "now" then turn off anchorlight. nodeRed?
Have been testing different stuff this weekend, but I struggle to find an elegant way of doing it. Would like to use as most standard OpenPlotter functionality and awoid using PY scrips etc. I know there are N2K relays (rather expensive) on the marked but why not create them using inexpensive 12v relays and GPIO? Or - should I stop trying to do this in Openplotter, and simply go for HomeAssistant on the OpenPlotter raspberry instead?
Anyone want to point me in the right direction for my winterproject ?
I use Node Red with 12v relays. Node red is pretty easy once you get the hang of it & it is very versatile.
I have a quad relay
Or there are single relays
I can turn "things" on or off automatically or from home via RealVNC
Pi5 8GB, NVME SSD 512GB, MacArthur hat, OP4,
Posts: 2
Threads: 1
Joined: Oct 2024
Reputation:
0
Many thanks for the tip! Quad relay really look like what I need. I also need to dive into the NodeRed world.
Btw, have you also managed to integrate these virtual switches into KIP?
Posts: 220
Threads: 46
Joined: Mar 2017
Reputation:
2
(2024-10-20, 10:48 PM)sisimonsen Wrote: Many thanks for the tip! Quad relay really look like what I need. I also need to dive into the NodeRed world.
Btw, have you also managed to integrate these virtual switches into KIP?
I haven't tried with KIP .......................yet!!
Pi5 8GB, NVME SSD 512GB, MacArthur hat, OP4,
Posts: 2
Threads: 0
Joined: Oct 2024
Reputation:
0
(2024-10-21, 12:47 AM)Lazzz Wrote: (2024-10-20, 10:48 PM)sisimonsen Wrote: Many thanks for the tip! Quad relay really look like what I need. I also need to dive into the NodeRed world.
Btw, have you also managed to integrate these virtual switches into KIP?
I haven't tried with KIP .......................yet!!
Working on a very similar project although somewhat new to Node-Red Ideally would like to turn my fridge on from a web app and tell it how many hours to stay on before I get to the boat.
Would you be willing to share a high level description of your programming flow and/or screenshots?
Posts: 220
Threads: 46
Joined: Mar 2017
Reputation:
2
Pi5 8GB, NVME SSD 512GB, MacArthur hat, OP4,
Posts: 1,270
Threads: 104
Joined: Mar 2016
Reputation:
77
(2024-10-30, 12:30 AM)ProdigalSun24 Wrote: Working on a very similar project although somewhat new to Node-Red Ideally would like to turn my fridge on from a web app and tell it how many hours to stay on before I get to the boat.
Would you be willing to share a high level description of your programming flow and/or screenshots?
node red would almost certainly work, here's a timer i use to turn off the music playing on clementine on the Pi
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
}
]
Paste & play
You'll likely need to add a few nodes like the timer & maybe dashboard.
flow -
and the dash
Many ways to control, you should be able to vnc straight into the Pi desktop with realvnc.
Or MQTT is another option, send a message to node red from the web.
Then some way to control the fridge on/off.
|