Yeah made it work
created a url named “disable” on nodered installation. Which in response tells how long the pihole is disabled. I’ve set it to 10 minutes. Tweak it if you like. One tweak I will do is add another pihole install so I can get redundant pihole established and also disable both installs at the same time
Below the export of the flow:
[
{
"id": "e05bef77a0d32682",
"type": "tab",
"label": "Disable pihole",
"disabled": false,
"info": "",
"env": []
},
{
"id": "5a7c93e546f768ac",
"type": "http request",
"z": "e05bef77a0d32682",
"name": "",
"method": "POST",
"ret": "txt",
"paytoqs": "ignore",
"url": "http://pi.hole:8080/api/dns/blocking",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 1010,
"y": 400,
"wires": [
[]
]
},
{
"id": "21739583887237d4",
"type": "json",
"z": "e05bef77a0d32682",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 810,
"y": 400,
"wires": [
[
"5a7c93e546f768ac"
]
]
},
{
"id": "de1762d74105c86e",
"type": "function",
"z": "e05bef77a0d32682",
"name": "JSON for blocking",
"func": "msg.payload = \"{\\\"blocking\\\":false,\\\"timer\\\": 600}\";\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 610,
"y": 400,
"wires": [
[
"21739583887237d4"
]
]
},
{
"id": "fc0eede929621a33",
"type": "http in",
"z": "e05bef77a0d32682",
"name": "",
"url": "/disable",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 290,
"y": 400,
"wires": [
[
"de1762d74105c86e",
"d3122bb0cf9ca780"
]
]
},
{
"id": "d3122bb0cf9ca780",
"type": "template",
"z": "e05bef77a0d32682",
"name": "Webpagina response",
"field": "payload",
"fieldType": "msg",
"format": "html",
"syntax": "mustache",
"template": "<!DOCTYPE html>\n<html>\n<head>\n\t<title>Pihole turned off for 10 minutes</title>\n\n\t<h1>Pihole is disabled for 10 minutes</h1>\n</head>\n<body>\n\n<p>Pihole is disabled for 10 minutes</p>\n</body>\n</html>",
"output": "str",
"x": 620,
"y": 320,
"wires": [
[
"7fda1b66e45479d4"
]
]
},
{
"id": "7fda1b66e45479d4",
"type": "http response",
"z": "e05bef77a0d32682",
"name": "",
"statusCode": "",
"headers": {},
"x": 790,
"y": 320,
"wires": []
}
]