Working on getting the data to feed to my Github card

This commit is contained in:
2023-08-25 20:24:53 -04:00
parent ef5fbced4c
commit 4bc67a5f89

View File

@ -119,6 +119,14 @@
"info": "", "info": "",
"env": [] "env": []
}, },
{
"id": "873eb2575d6e9014",
"type": "tab",
"label": "Github",
"disabled": false,
"info": "",
"env": []
},
{ {
"id": "ebd5561c4f077718", "id": "ebd5561c4f077718",
"type": "tab", "type": "tab",
@ -754,9 +762,7 @@
"f1dbb3a206dba921" "f1dbb3a206dba921"
], ],
"x": 14, "x": 14,
"y": 839, "y": 839
"w": 1552,
"h": 642
}, },
{ {
"id": "e065b1ed4938b477", "id": "e065b1ed4938b477",
@ -806,9 +812,7 @@
"e914726b0364c6be" "e914726b0364c6be"
], ],
"x": 14, "x": 14,
"y": 11.5, "y": 11.5
"w": 1252,
"h": 809.5
}, },
{ {
"id": "5c50443a84910fb7", "id": "5c50443a84910fb7",
@ -848,7 +852,9 @@
"51b11f9d5b8bfbb0" "51b11f9d5b8bfbb0"
], ],
"x": 34, "x": 34,
"y": 179 "y": 179,
"w": 1292,
"h": 382
}, },
{ {
"id": "477e752fcd2e2a19", "id": "477e752fcd2e2a19",
@ -867,28 +873,9 @@
"f4bfbaca4d7fb1df" "f4bfbaca4d7fb1df"
], ],
"x": 14, "x": 14,
"y": 39 "y": 39,
}, "w": 1192,
{ "h": 82
"id": "50e4d951ee7b3e54",
"type": "group",
"z": "ee67610b4a0578d2",
"name": "Report System",
"style": {
"label": true
},
"nodes": [
"f803c6af3a30eb66",
"3bd7704103dbfc20",
"a6234b2047ba3116",
"603140fef1e2edaf",
"427cc2991454bbf0",
"7674185d1e5ee489",
"9e43408e18883dfe",
"0107164ee7ff63d6"
],
"x": 14,
"y": 139
}, },
{ {
"id": "fbbe69a14cbe0236", "id": "fbbe69a14cbe0236",
@ -1065,7 +1052,9 @@
"f44427c5a493c428" "f44427c5a493c428"
], ],
"x": 14, "x": 14,
"y": 299 "y": 139,
"w": 1152,
"h": 242
}, },
{ {
"id": "eeafd13be593ae69", "id": "eeafd13be593ae69",
@ -1330,7 +1319,9 @@
"a8d7f5e5d4f549b0" "a8d7f5e5d4f549b0"
], ],
"x": 34, "x": 34,
"y": 579 "y": 579,
"w": 732,
"h": 162
}, },
{ {
"id": "4886967d0f8c0156", "id": "4886967d0f8c0156",
@ -1390,7 +1381,9 @@
"f9bc4d36a0df7947" "f9bc4d36a0df7947"
], ],
"x": 34, "x": 34,
"y": 759 "y": 759,
"w": 672,
"h": 222
}, },
{ {
"id": "6e83103b5c5311e9", "id": "6e83103b5c5311e9",
@ -1408,7 +1401,9 @@
"a75651492e779bfc" "a75651492e779bfc"
], ],
"x": 34, "x": 34,
"y": 19 "y": 19,
"w": 912,
"h": 142
}, },
{ {
"id": "88f099618e56926d", "id": "88f099618e56926d",
@ -1490,7 +1485,9 @@
"15f7382daddb4b3e" "15f7382daddb4b3e"
], ],
"x": 34, "x": 34,
"y": 999 "y": 999,
"w": 632,
"h": 82
}, },
{ {
"id": "31767ffd6a647579", "id": "31767ffd6a647579",
@ -1675,6 +1672,29 @@
"w": 752, "w": 752,
"h": 682 "h": 682
}, },
{
"id": "50e4d951ee7b3e54",
"type": "group",
"z": "873eb2575d6e9014",
"name": "Report System",
"style": {
"label": true
},
"nodes": [
"f803c6af3a30eb66",
"3bd7704103dbfc20",
"a6234b2047ba3116",
"603140fef1e2edaf",
"427cc2991454bbf0",
"7674185d1e5ee489",
"9e43408e18883dfe",
"0107164ee7ff63d6"
],
"x": 34,
"y": 19,
"w": 1072,
"h": 142
},
{ {
"id": "fba69dfc80829db7", "id": "fba69dfc80829db7",
"type": "junction", "type": "junction",
@ -3628,6 +3648,97 @@
"resend": false, "resend": false,
"debugEnabled": false "debugEnabled": false
}, },
{
"id": "accdce4dc47fb84a",
"type": "ha-device-config",
"name": "Github",
"hwVersion": "",
"manufacturer": "Node-RED",
"model": "",
"swVersion": ""
},
{
"id": "cb877a8619b6d57e",
"type": "ha-entity-config",
"server": "9e87348d.9c1c48",
"deviceConfig": "accdce4dc47fb84a",
"name": "Github Main Repo - Issues",
"version": "6",
"entityType": "sensor",
"haConfig": [
{
"property": "name",
"value": "Github Main Repo - Issues"
},
{
"property": "icon",
"value": "mdi:github"
},
{
"property": "entity_category",
"value": ""
},
{
"property": "entity_picture",
"value": ""
},
{
"property": "device_class",
"value": ""
},
{
"property": "unit_of_measurement",
"value": ""
},
{
"property": "state_class",
"value": "measurement"
}
],
"resend": false,
"debugEnabled": false
},
{
"id": "17a841239bc49473",
"type": "ha-entity-config",
"server": "9e87348d.9c1c48",
"deviceConfig": "accdce4dc47fb84a",
"name": "Node Red Repo - Issues",
"version": "6",
"entityType": "sensor",
"haConfig": [
{
"property": "name",
"value": "Node Red Repo - Issues"
},
{
"property": "icon",
"value": "mdi:github"
},
{
"property": "entity_category",
"value": ""
},
{
"property": "entity_picture",
"value": ""
},
{
"property": "device_class",
"value": ""
},
{
"property": "unit_of_measurement",
"value": ""
},
{
"property": "state_class",
"value": "measurement"
}
],
"resend": false,
"debugEnabled": false
},
{ {
"id": "afead614fabc01bb", "id": "afead614fabc01bb",
"type": "function", "type": "function",
@ -23169,67 +23280,6 @@
[] []
] ]
}, },
{
"id": "f803c6af3a30eb66",
"type": "ha-button",
"z": "ee67610b4a0578d2",
"g": "50e4d951ee7b3e54",
"name": "Send Report",
"version": 0,
"debugenabled": false,
"outputs": 1,
"entityConfig": "675dd216a61c575b",
"outputProperties": [],
"x": 110,
"y": 180,
"wires": [
[
"a6234b2047ba3116"
]
]
},
{
"id": "3bd7704103dbfc20",
"type": "template",
"z": "ee67610b4a0578d2",
"g": "50e4d951ee7b3e54",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\n \"content\": \"{{text}}\",\n \"project_id\": 2285967948,\n \"section_id\": {{type}}\n}",
"output": "str",
"x": 820,
"y": 180,
"wires": [
[
"603140fef1e2edaf"
]
]
},
{
"id": "a6234b2047ba3116",
"type": "function",
"z": "ee67610b4a0578d2",
"g": "50e4d951ee7b3e54",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar text = states['input_text.report_system'].state\nvar type = states['input_select.report_type'].state\nvar resetText = 'Type your report here'\nvar resetType = 'Bug Report'\n\nmsg.text = text\nmsg.typename = type\n\nmsg.reset_text = resetText\nmsg.reset_type = resetType\n\nif (type === \"New Idea\") {\n node.status({fill:\"green\",shape:\"dot\",text:\"New Idea\"});\n msg.type = \"114199257\"\n} else if (type === \"Bug Report\") {\n node.status({fill:\"green\",shape:\"dot\",text:\"Bug Report\"});\n msg.type = \"94865633\"\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 290,
"y": 180,
"wires": [
[
"9e43408e18883dfe",
"7674185d1e5ee489"
]
],
"icon": "node-red-contrib-cpu/cpu.png"
},
{ {
"id": "98626a8f2b59bde3", "id": "98626a8f2b59bde3",
"type": "ha-button", "type": "ha-button",
@ -23249,7 +23299,7 @@
} }
], ],
"x": 120, "x": 120,
"y": 420, "y": 260,
"wires": [ "wires": [
[ [
"f44427c5a493c428" "f44427c5a493c428"
@ -23277,7 +23327,7 @@
"outputProperties": [], "outputProperties": [],
"queue": "none", "queue": "none",
"x": 490, "x": 490,
"y": 340, "y": 180,
"wires": [ "wires": [
[] []
] ]
@ -23305,7 +23355,7 @@
"outputProperties": [], "outputProperties": [],
"queue": "none", "queue": "none",
"x": 490, "x": 490,
"y": 500, "y": 340,
"wires": [ "wires": [
[ [
"0145961e8276c53e" "0145961e8276c53e"
@ -23335,7 +23385,7 @@
"outputProperties": [], "outputProperties": [],
"queue": "none", "queue": "none",
"x": 670, "x": 670,
"y": 500, "y": 340,
"wires": [ "wires": [
[ [
"fd623c46a558a01a" "fd623c46a558a01a"
@ -23366,7 +23416,7 @@
"outputProperties": [], "outputProperties": [],
"queue": "none", "queue": "none",
"x": 860, "x": 860,
"y": 500, "y": 340,
"wires": [ "wires": [
[ [
"6b039ef7895476e2" "6b039ef7895476e2"
@ -23394,7 +23444,7 @@
"outputProperties": [], "outputProperties": [],
"queue": "none", "queue": "none",
"x": 480, "x": 480,
"y": 420, "y": 260,
"wires": [ "wires": [
[] []
] ]
@ -23422,7 +23472,7 @@
"outputProperties": [], "outputProperties": [],
"queue": "none", "queue": "none",
"x": 1060, "x": 1060,
"y": 500, "y": 340,
"wires": [ "wires": [
[] []
] ]
@ -23461,7 +23511,7 @@
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 310, "x": 310,
"y": 420, "y": 260,
"wires": [ "wires": [
[ [
"db6d955c039873be" "db6d955c039873be"
@ -23480,54 +23530,85 @@
], ],
"icon": "node-red-contrib-cpu/cpu.png" "icon": "node-red-contrib-cpu/cpu.png"
}, },
{
"id": "f803c6af3a30eb66",
"type": "ha-button",
"z": "873eb2575d6e9014",
"g": "50e4d951ee7b3e54",
"name": "Send Report",
"version": 0,
"debugenabled": false,
"outputs": 1,
"entityConfig": "675dd216a61c575b",
"outputProperties": [],
"x": 130,
"y": 60,
"wires": [
[
"a6234b2047ba3116"
]
]
},
{
"id": "3bd7704103dbfc20",
"type": "template",
"z": "873eb2575d6e9014",
"g": "50e4d951ee7b3e54",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\n \"content\": \"{{text}}\",\n \"project_id\": 2285967948,\n \"section_id\": {{type}}\n}",
"output": "str",
"x": 840,
"y": 60,
"wires": [
[
"603140fef1e2edaf"
]
]
},
{
"id": "a6234b2047ba3116",
"type": "function",
"z": "873eb2575d6e9014",
"g": "50e4d951ee7b3e54",
"name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar text = states['input_text.report_system'].state\nvar type = states['input_select.report_type'].state\nvar resetText = 'Type your report here'\nvar resetType = 'Bug Report'\n\nmsg.text = text\nmsg.typename = type\n\nmsg.reset_text = resetText\nmsg.reset_type = resetType\n\nif (type === \"New Idea\") {\n node.status({fill:\"green\",shape:\"dot\",text:\"New Idea\"});\n msg.type = \"114199257\"\n} else if (type === \"Bug Report\") {\n node.status({fill:\"green\",shape:\"dot\",text:\"Bug Report\"});\n msg.type = \"94865633\"\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 310,
"y": 60,
"wires": [
[
"9e43408e18883dfe",
"7674185d1e5ee489"
]
],
"icon": "node-red-contrib-cpu/cpu.png"
},
{ {
"id": "603140fef1e2edaf", "id": "603140fef1e2edaf",
"type": "todoist-task-create", "type": "todoist-task-create",
"z": "ee67610b4a0578d2", "z": "873eb2575d6e9014",
"d": true, "d": true,
"g": "50e4d951ee7b3e54", "g": "50e4d951ee7b3e54",
"name": "", "name": "",
"token": "81cb9d95d14a3e5a", "token": "81cb9d95d14a3e5a",
"x": 990, "x": 1010,
"y": 180, "y": 60,
"wires": [ "wires": [
[] []
] ]
}, },
{
"id": "7674185d1e5ee489",
"type": "api-call-service",
"z": "ee67610b4a0578d2",
"g": "50e4d951ee7b3e54",
"name": "Reset Text",
"server": "9e87348d.9c1c48",
"version": 5,
"debugenabled": false,
"domain": "input_text",
"service": "set_value",
"areaId": [],
"deviceId": [],
"entityId": [
"input_text.report_system"
],
"data": "{\t \"value\": reset_text\t}",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 470,
"y": 180,
"wires": [
[
"427cc2991454bbf0"
]
]
},
{ {
"id": "427cc2991454bbf0", "id": "427cc2991454bbf0",
"type": "api-call-service", "type": "api-call-service",
"z": "ee67610b4a0578d2", "z": "873eb2575d6e9014",
"g": "50e4d951ee7b3e54", "g": "50e4d951ee7b3e54",
"name": "Reset Type", "name": "Reset Type",
"server": "9e87348d.9c1c48", "server": "9e87348d.9c1c48",
@ -23546,8 +23627,8 @@
"mustacheAltTags": false, "mustacheAltTags": false,
"outputProperties": [], "outputProperties": [],
"queue": "none", "queue": "none",
"x": 650, "x": 670,
"y": 180, "y": 60,
"wires": [ "wires": [
[ [
"3bd7704103dbfc20" "3bd7704103dbfc20"
@ -23555,24 +23636,39 @@
] ]
}, },
{ {
"id": "0107164ee7ff63d6", "id": "7674185d1e5ee489",
"type": "github-rest-api", "type": "api-call-service",
"z": "ee67610b4a0578d2", "z": "873eb2575d6e9014",
"g": "50e4d951ee7b3e54", "g": "50e4d951ee7b3e54",
"mediaType": "", "name": "Reset Text",
"endpoint": "POST /repos/tm24fan8/home-assistant-configs/issues", "server": "9e87348d.9c1c48",
"client": "060e39a6519a8c4a", "version": 5,
"name": "Post Issue", "debugenabled": false,
"x": 650, "domain": "input_text",
"y": 240, "service": "set_value",
"areaId": [],
"deviceId": [],
"entityId": [
"input_text.report_system"
],
"data": "{\t \"value\": reset_text\t}",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 490,
"y": 60,
"wires": [ "wires": [
[] [
"427cc2991454bbf0"
]
] ]
}, },
{ {
"id": "9e43408e18883dfe", "id": "9e43408e18883dfe",
"type": "function", "type": "function",
"z": "ee67610b4a0578d2", "z": "873eb2575d6e9014",
"g": "50e4d951ee7b3e54", "g": "50e4d951ee7b3e54",
"name": "Prep API data", "name": "Prep API data",
"func": "var title = msg.text\nvar type = msg.typename\n\nif (type === 'Bug Report') {\n var labels = [\"bug\",\"needs-response\"]\n} else if (type === 'New Idea') {\n var labels = [\"enhancement\",\"needs-response\"]\n}\n\nmsg.payload = {\n \"title\": title,\n \"assignees\":[\"tm24fan8\"],\n \"labels\":labels\n}\n\nreturn msg;", "func": "var title = msg.text\nvar type = msg.typename\n\nif (type === 'Bug Report') {\n var labels = [\"bug\",\"needs-response\"]\n} else if (type === 'New Idea') {\n var labels = [\"enhancement\",\"needs-response\"]\n}\n\nmsg.payload = {\n \"title\": title,\n \"assignees\":[\"tm24fan8\"],\n \"labels\":labels\n}\n\nreturn msg;",
@ -23581,14 +23677,283 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 480, "x": 500,
"y": 240, "y": 120,
"wires": [ "wires": [
[ [
"0107164ee7ff63d6" "0107164ee7ff63d6"
] ]
] ]
}, },
{
"id": "0107164ee7ff63d6",
"type": "github-rest-api",
"z": "873eb2575d6e9014",
"g": "50e4d951ee7b3e54",
"mediaType": "",
"endpoint": "POST /repos/tm24fan8/home-assistant-configs/issues",
"client": "060e39a6519a8c4a",
"name": "Post Issue",
"x": 670,
"y": 120,
"wires": [
[]
]
},
{
"id": "e87dcfb1c693cd8e",
"type": "github-rest-api",
"z": "873eb2575d6e9014",
"mediaType": "",
"endpoint": "GET /repos/tm24fan8/home-assistant-configs/issues",
"client": "060e39a6519a8c4a",
"name": "Get Issues",
"x": 550,
"y": 260,
"wires": [
[
"d83e7b89126fdda1"
]
]
},
{
"id": "10799a25d9271ce9",
"type": "function",
"z": "873eb2575d6e9014",
"name": "Prep API data",
"func": "let mainIssues = []\nlet nodeRedIssues = []\n\nflow.set(\"mainIssues\", mainIssues)\nflow.set(\"nodeRedIssues\", nodeRedIssues)\n\nmsg.payload = {\n \"state\":\"open\"\n}\n\nnode.status({fill:\"green\",shape:\"dot\",text:\"Sent\"})\nnode.send(msg)",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 340,
"y": 260,
"wires": [
[
"e87dcfb1c693cd8e"
]
]
},
{
"id": "e2feabccad273758",
"type": "inject",
"z": "873eb2575d6e9014",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 160,
"y": 260,
"wires": [
[
"10799a25d9271ce9"
]
]
},
{
"id": "c96fb11627e0443d",
"type": "debug",
"z": "873eb2575d6e9014",
"name": "debug 30",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1140,
"y": 260,
"wires": []
},
{
"id": "7d3d014112db6fc4",
"type": "github-rest-api",
"z": "873eb2575d6e9014",
"mediaType": "",
"endpoint": "GET /repos/tm24fan8/ha-nerdflows/issues",
"client": "060e39a6519a8c4a",
"name": "Get Issues",
"x": 550,
"y": 320,
"wires": [
[
"c7bca169476e414e"
]
]
},
{
"id": "d83e7b89126fdda1",
"type": "function",
"z": "873eb2575d6e9014",
"name": "function 2",
"func": "const payload = msg.payload\n\nlet mainIssues = []\n\nfor (let index = 0; index < payload.length; index++) {\n const element = payload[index];\n mainIssues.push(element.title)\n}\n\nmsg = {\n \"payload\": mainIssues.length,\n \"issues\": mainIssues.join(\", \")\n}\n\nnode.send(msg)",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 720,
"y": 260,
"wires": [
[
"076ecbfdb485ce9d"
]
]
},
{
"id": "c7bca169476e414e",
"type": "function",
"z": "873eb2575d6e9014",
"name": "function 3",
"func": "const payload = msg.payload\n\nlet nodeRedIssues = []\n\nfor (let index = 0; index < payload.length; index++) {\n const element = payload[index];\n nodeRedIssues.push(element.title)\n}\n\nmsg = {\n \"payload\": nodeRedIssues.length,\n \"issues\": nodeRedIssues.join(\", \")\n}\n\nnode.send(msg)",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 720,
"y": 320,
"wires": [
[
"48f048636995cd6d"
]
]
},
{
"id": "3a2dc7c13636cf4c",
"type": "function",
"z": "873eb2575d6e9014",
"name": "Prep API data",
"func": "let mainIssues = []\nlet nodeRedIssues = []\n\nflow.set(\"mainIssues\", mainIssues)\nflow.set(\"nodeRedIssues\", nodeRedIssues)\n\nmsg.payload = {\n \"state\":\"open\"\n}\n\nnode.status({fill:\"green\",shape:\"dot\",text:\"Sent\"})\nnode.send(msg)",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 340,
"y": 320,
"wires": [
[
"7d3d014112db6fc4"
]
]
},
{
"id": "e84f9fb1779bf3f3",
"type": "inject",
"z": "873eb2575d6e9014",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 160,
"y": 320,
"wires": [
[
"3a2dc7c13636cf4c"
]
]
},
{
"id": "61e2d25bbe5011c4",
"type": "debug",
"z": "873eb2575d6e9014",
"name": "debug 31",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1140,
"y": 320,
"wires": []
},
{
"id": "076ecbfdb485ce9d",
"type": "ha-sensor",
"z": "873eb2575d6e9014",
"name": "Main Repo Issues",
"entityConfig": "cb877a8619b6d57e",
"version": 0,
"state": "payload",
"stateType": "msg",
"attributes": [
{
"property": "issues",
"value": "issues",
"valueType": "msg"
}
],
"inputOverride": "allow",
"outputProperties": [],
"x": 930,
"y": 260,
"wires": [
[
"c96fb11627e0443d"
]
]
},
{
"id": "48f048636995cd6d",
"type": "ha-sensor",
"z": "873eb2575d6e9014",
"name": "Node Red Repo - Issues",
"entityConfig": "17a841239bc49473",
"version": 0,
"state": "payload",
"stateType": "msg",
"attributes": [
{
"property": "issues",
"value": "issues",
"valueType": "msg"
}
],
"inputOverride": "allow",
"outputProperties": [],
"x": 950,
"y": 320,
"wires": [
[
"61e2d25bbe5011c4"
]
]
},
{
"id": "f5d10b016afa6391",
"type": "comment",
"z": "873eb2575d6e9014",
"name": "Figure out how to get this data into a more presentable format",
"info": "",
"x": 640,
"y": 380,
"wires": []
},
{ {
"id": "5d7c63526234945e", "id": "5d7c63526234945e",
"type": "api-render-template", "type": "api-render-template",