Well right now its something like this, With the logics being that it looks for the Grid ok/lost,
But if the battery is low it should show amber , I wish I knew how to add the next level of logic
which is that if grid is lost and battery is low then send red . any ideas? The battery percentage
and the Grid state come from 2 separate function nodes at the moment
[
{
"id": "31643f00.8068a2",
"type": "ui_template",
"z": "3b34e0bec79715e3",
"group": "19d977f5.9091e",
"name": "Status",
"order": 4,
"width": 2,
"height": 1,
"format": "<style>\n.led-green {\nmargin: 0 auto;\nwidth: 24px;\nheight: 24px;\nbackground-color: #ABFF00;\nborder-radius: 50%;\n{\n</style>\n<table>\n<tr>\n<td><div class=\"led-green\" style=\"background-color:{{msg.payload}}\"></div></td>\n<td></td>\n</tr>\n</table>\n",
"storeOutMessages": true,
"fwdInMessages": true,
"resendOnRefresh": false,
"templateScope": "local",
"x": 1430,
"y": 220,
"wires": [
[]
]
},
{
"id": "7d926e81.1c9fb",
"type": "change",
"z": "3b34e0bec79715e3",
"name": "change to red",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "red",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1400,
"y": 180,
"wires": [
[
"31643f00.8068a2"
]
]
},
{
"id": "eba70a4.b228078",
"type": "switch",
"z": "3b34e0bec79715e3",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "cont",
"v": "Grid ok",
"vt": "str"
},
{
"t": "lt",
"v": "40",
"vt": "num"
},
{
"t": "cont",
"v": "Grid lost",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 1070,
"y": 140,
"wires": [
[
"e0c5f60a.79228"
],
[
"ab956068591ffd7b"
],
[
"7d926e81.1c9fb"
]
]
},
{
"id": "5c433262.392e74",
"type": "change",
"z": "3b34e0bec79715e3",
"name": "change to orange",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "orange",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1410,
"y": 140,
"wires": [
[
"31643f00.8068a2"
]
]
},
{
"id": "e0c5f60a.79228",
"type": "change",
"z": "3b34e0bec79715e3",
"name": "change to green",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "green",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1410,
"y": 100,
"wires": [
[
"31643f00.8068a2"
]
]
},
{
"id": "ab956068591ffd7b",
"type": "delay",
"z": "3b34e0bec79715e3",
"name": "",
"pauseType": "delay",
"timeout": "100",
"timeoutUnits": "milliseconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"x": 1210,
"y": 140,
"wires": [
[
"5c433262.392e74"
]
]
},
{
"id": "ddc48e96.3454c8",
"type": "function",
"z": "3b34e0bec79715e3",
"name": "",
"func": "let GrAlarmText = msg.payload.extended[19].textValue;\nmsg.payload = GrAlarmText;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 800,
"y": 120,
"wires": [
[
"9ca58e3e.16a668",
"eba70a4.b228078"
]
]
},
{
"id": "8e6ac797.8ce97",
"type": "function",
"z": "3b34e0bec79715e3",
"name": "",
"func": "let BChargSt = msg.payload.extended[3].rawValue;\nmsg.payload = BChargSt;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 800,
"y": 160,
"wires": [
[
"1d6fb8b3.ce6dc7",
"eba70a4.b228078"
]
]
},
{
"id": "19d977f5.9091e",
"type": "ui_group",
"name": "CC-Oakhurst-Rondebosch",
"tab": "3ceee6af.390d22",
"order": 1,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "3ceee6af.390d22",
"type": "ui_tab",
"name": "Cash Crusaders Overview",
"icon": "business",
"order": 2,
"disabled": false,
"hidden": false
}
]