[
{
"id": "70c7ec66.31e354",
"type": "tab",
"label": "Electricity",
"disabled": false,
"info": ""
},
{
"id": "190dc64a.a1249a",
"type": "ui_led",
"z": "70c7ec66.31e354",
"order": 1,
"group": "ca9031ed.6508",
"width": "0",
"height": "0",
"label": "LEC",
"labelPlacement": "left",
"labelAlignment": "left",
"colorForValue": [
{
"color": "#ff0000",
"value": "false",
"valueType": "bool"
},
{
"color": "#008000",
"value": "true",
"valueType": "bool"
}
],
"allowColorForValueInMessage": false,
"shape": "circle",
"showGlow": true,
"name": "",
"x": 710,
"y": 120,
"wires": []
},
{
"id": "dc628a10.7e8588",
"type": "change",
"z": "70c7ec66.31e354",
"name": "",
"rules": [
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "1",
"fromt": "num",
"to": "false",
"tot": "bool"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "0",
"fromt": "num",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 480,
"y": 120,
"wires": [
[
"190dc64a.a1249a"
]
]
},
{
"id": "b9ac64f9.cce7d8",
"type": "rpi-gpio in",
"z": "70c7ec66.31e354",
"name": "LEC",
"pin": "5",
"intype": "tri",
"debounce": "25",
"read": true,
"bcm": true,
"x": 270,
"y": 120,
"wires": [
[
"dc628a10.7e8588"
]
]
},
{
"id": "9ea94c27.24e7d",
"type": "ui_led",
"z": "70c7ec66.31e354",
"order": 1,
"group": "ca9031ed.6508",
"width": 0,
"height": 0,
"label": "Generator 30Kva",
"labelPlacement": "left",
"labelAlignment": "left",
"colorForValue": [
{
"color": "#ff0000",
"value": "false",
"valueType": "str"
},
{
"color": "#008000",
"value": "true",
"valueType": "str"
}
],
"allowColorForValueInMessage": false,
"shape": "circle",
"showGlow": true,
"name": "",
"x": 710,
"y": 180,
"wires": []
},
{
"id": "1de9d56f.2aeb7b",
"type": "change",
"z": "70c7ec66.31e354",
"name": "",
"rules": [
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "1",
"fromt": "num",
"to": "false",
"tot": "bool"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "0",
"fromt": "num",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 480,
"y": 180,
"wires": [
[
"9ea94c27.24e7d"
]
]
},
{
"id": "4e327b9b.971464",
"type": "rpi-gpio in",
"z": "70c7ec66.31e354",
"name": "",
"pin": "6",
"intype": "up",
"debounce": "25",
"read": true,
"bcm": true,
"x": 280,
"y": 180,
"wires": [
[
"1de9d56f.2aeb7b"
]
]
},
{
"id": "d98fe3e107e2879b",
"type": "ui_led",
"z": "70c7ec66.31e354",
"order": 1,
"group": "ca9031ed.6508",
"width": 0,
"height": 0,
"label": "Generator 100Kva",
"labelPlacement": "left",
"labelAlignment": "left",
"colorForValue": [
{
"color": "#ff0000",
"value": "false",
"valueType": "str"
},
{
"color": "#008000",
"value": "true",
"valueType": "str"
}
],
"allowColorForValueInMessage": false,
"shape": "circle",
"showGlow": true,
"name": "",
"x": 710,
"y": 240,
"wires": []
},
{
"id": "cb54b3d5f07c254b",
"type": "change",
"z": "70c7ec66.31e354",
"name": "",
"rules": [
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "1",
"fromt": "num",
"to": "false",
"tot": "bool"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "0",
"fromt": "num",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 480,
"y": 240,
"wires": [
[
"d98fe3e107e2879b"
]
]
},
{
"id": "6659825d16a45def",
"type": "rpi-gpio in",
"z": "70c7ec66.31e354",
"name": "",
"pin": "13",
"intype": "up",
"debounce": "25",
"read": true,
"bcm": true,
"x": 280,
"y": 240,
"wires": [
[
"cb54b3d5f07c254b"
]
]
},
{
"id": "3b506a80a3120bc7",
"type": "ui_led",
"z": "70c7ec66.31e354",
"order": 1,
"group": "ca9031ed.6508",
"width": 0,
"height": 0,
"label": "Generator 150Kva",
"labelPlacement": "left",
"labelAlignment": "left",
"colorForValue": [
{
"color": "#ff0000",
"value": "false",
"valueType": "str"
},
{
"color": "#008000",
"value": "true",
"valueType": "str"
}
],
"allowColorForValueInMessage": false,
"shape": "circle",
"showGlow": true,
"name": "",
"x": 710,
"y": 300,
"wires": []
},
{
"id": "c3ea82460537377a",
"type": "change",
"z": "70c7ec66.31e354",
"name": "",
"rules": [
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "1",
"fromt": "num",
"to": "false",
"tot": "bool"
},
{
"t": "change",
"p": "payload",
"pt": "msg",
"from": "0",
"fromt": "num",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 480,
"y": 300,
"wires": [
[
"3b506a80a3120bc7"
]
]
},
{
"id": "03d9a3e67fd73930",
"type": "rpi-gpio in",
"z": "70c7ec66.31e354",
"name": "",
"pin": "19",
"intype": "up",
"debounce": "25",
"read": true,
"bcm": true,
"x": 280,
"y": 300,
"wires": [
[
"c3ea82460537377a"
]
]
},
{
"id": "41f146119cbcf39f",
"type": "rpi-gpio out",
"z": "70c7ec66.31e354",
"name": "gen1",
"pin": "18",
"set": "",
"level": "0",
"freq": "",
"out": "out",
"bcm": true,
"x": 750,
"y": 400,
"wires": []
},
{
"id": "dfc5f88f4dd54dcf",
"type": "rpi-gpio out",
"z": "70c7ec66.31e354",
"name": "gen2",
"pin": "23",
"set": "",
"level": "0",
"freq": "",
"out": "out",
"bcm": true,
"x": 750,
"y": 480,
"wires": []
},
{
"id": "37b2b3f5d5d6106b",
"type": "rpi-gpio out",
"z": "70c7ec66.31e354",
"name": "gen3",
"pin": "24",
"set": "",
"level": "0",
"freq": "",
"out": "out",
"bcm": true,
"x": 750,
"y": 560,
"wires": []
},
{
"id": "9b4134fa5a0293bb",
"type": "inject",
"z": "70c7ec66.31e354",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "2",
"payloadType": "num",
"x": 230,
"y": 500,
"wires": [
[
"fbbee97f43cf6037"
]
]
},
{
"id": "121db839a3fa1bfd",
"type": "inject",
"z": "70c7ec66.31e354",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "1",
"payloadType": "num",
"x": 230,
"y": 460,
"wires": [
[
"fbbee97f43cf6037"
]
]
},
{
"id": "11ad600b9f5ab6d1",
"type": "inject",
"z": "70c7ec66.31e354",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"v": "",
"vt": "num"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "0",
"payloadType": "num",
"x": 230,
"y": 420,
"wires": [
[
"fbbee97f43cf6037"
]
]
},
{
"id": "fbbee97f43cf6037",
"type": "function",
"z": "70c7ec66.31e354",
"name": "Determine relay states",
"func": "\nlet msgs = [{ payload: 0 }, { payload: 0 }, { payload: 0 }]\n\nif (msg.payload > 0 && msg.payload <= 3) {\n \n msgs[msg.payload - 1].payload = 1\n}\nreturn msgs;",
"outputs": 3,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 440,
"y": 480,
"wires": [
[
"93ae482345d5d61e"
],
[
"3095e251a52004f4"
],
[
"1ad2302b94027a93"
]
]
},
{
"id": "93ae482345d5d61e",
"type": "function",
"z": "70c7ec66.31e354",
"name": "function 1",
"func": "if (msg.payload == 0) {\n msg.payload.gpio18 = 0\n }\n\nelse if (msg.payload == 1) {\n msg.payload.gpio18 = 1\n }\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 620,
"y": 400,
"wires": [
[
"41f146119cbcf39f"
]
]
},
{
"id": "c7b05837cf50f1f7",
"type": "inject",
"z": "70c7ec66.31e354",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "3",
"payloadType": "num",
"x": 230,
"y": 540,
"wires": [
[
"fbbee97f43cf6037"
]
]
},
{
"id": "3095e251a52004f4",
"type": "function",
"z": "70c7ec66.31e354",
"name": "function 2",
"func": "if (msg.payload == 0) {\n msg.payload.gpio23 = 0\n }\n\nelse if (msg.payload == 1) {\n msg.payload.gpio23 = 1\n }\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 620,
"y": 480,
"wires": [
[
"dfc5f88f4dd54dcf"
]
]
},
{
"id": "1ad2302b94027a93",
"type": "function",
"z": "70c7ec66.31e354",
"name": "function 3",
"func": "if (msg.payload == 0) {\n msg.payload.gpio24 = 0\n }\n\nelse if (msg.payload == 1) {\n msg.payload.gpio24 = 1\n }\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 620,
"y": 560,
"wires": [
[
"37b2b3f5d5d6106b"
]
]
},
{
"id": "ca9031ed.6508",
"type": "ui_group",
"name": "Electricity",
"tab": "91457eaf.c4e2c",
"order": 1,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "91457eaf.c4e2c",
"type": "ui_tab",
"name": "Electricity",
"icon": "dashboard",
"order": 16,
"disabled": false,
"hidden": false
}
]
new flow
still there is one thing. when LEC pin is high . all gen should be 0 values