[Solved] Node-red to pyton Mega IO

i am tying to turn the relais on and off from my Mega IO raspberry

cant figure it out

my Node red Flow

[
{
"id": "e7f6ddc.067dca",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": ""
},
{
"id": "c29f52f4.17482",
"type": "ui_button",
"z": "e7f6ddc.067dca",
"name": "RELAY OFF",
"group": "b5d72511.6dc02",
"order": 0,
"width": 0,
"height": 0,
"passthru": false,
"label": "RELAY OFF",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "false",
"payloadType": "bool",
"topic": "",
"x": 326,
"y": 772,
"wires": [
[
"33c635cf.843692"
]
]
},
{
"id": "25c7d2fc.7a0ed6",
"type": "ui_button",
"z": "e7f6ddc.067dca",
"name": "RELAY ON",
"group": "b5d72511.6dc02",
"order": 0,
"width": 0,
"height": 0,
"passthru": false,
"label": "RELAY ON",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "true",
"payloadType": "bool",
"topic": "",
"x": 323,
"y": 706,
"wires": [
[
"d85d7ee6.4442a"
]
]
},
{
"id": "d85d7ee6.4442a",
"type": "function",
"z": "e7f6ddc.067dca",
"name": "Get Param",
"func": "set_relay(1, 1, 1)\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 560,
"y": 707,
"wires": [
[
"f00ed999.bffc18"
]
]
},
{
"id": "33c635cf.843692",
"type": "function",
"z": "e7f6ddc.067dca",
"name": "Get Params",
"func": "set_relay(1, 1, 0)\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 554,
"y": 771,
"wires": [
[
"f00ed999.bffc18"
]
]
},
{
"id": "f00ed999.bffc18",
"type": "exec",
"z": "e7f6ddc.067dca",
"command": "megaio 0 awrite",
"addpay": true,
"append": "",
"useSpawn": "false",
"timer": "1",
"oldrc": false,
"name": "MEGA-IO",
"x": 772,
"y": 737,
"wires": [
[],
[
"fd04ec53.e199b8"
],
[]
]
},
{
"id": "fd04ec53.e199b8",
"type": "debug",
"z": "e7f6ddc.067dca",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 969,
"y": 808,
"wires": []
},
{
"id": "b5d72511.6dc02",
"type": "ui_group",
"z": "e7f6ddc.067dca",
"name": "Mega-IO test",
"tab": "5548ac65.acf3ac",
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "5548ac65.acf3ac",
"type": "ui_tab",
"z": "e7f6ddc.067dca",
"name": "RELAY TEST",
"icon": "dashboard"
}
]

i got it working

when pasting flows, please gfollow the directions in How to import a flow into the editor

1 Like