Display unread mail
Node-RED

Display unread mail

Checks for unread mail and sends a custom app to the Awtrix Clock
A flow by Dennis de K.

Download flow Download assets

Flow Details

Checks for unread mail by a trigger and sends a custom app to the Awtrix Clock. It cllears the custom app when there is no unread mail.

[ { "id": "f3eb030e2163a727", "type": "tab", "label": "Check Gmail", "disabled": false, "info": "", "env": [] }, { "id": "8e9d1a723bfcda4d", "type": "e-mail in", "z": "f3eb030e2163a727", "name": "Gmail", "protocol": "IMAP", "server": "imap.gmail.com", "useSSL": true, "autotls": "never", "port": "993", "authtype": "BASIC", "saslformat": true, "token": "oauth2Response.access_token", "box": "INBOX", "disposition": "None", "criteria": "UNSEEN", "repeat": "300", "fetch": "trigger", "inputs": 1, "x": 310, "y": 140, "wires": [ [ "b593e2fe99e3014b" ] ] }, { "id": "b10fe46569d9897d", "type": "function", "z": "f3eb030e2163a727", "name": "Awtrix message", "func": "var number = msg.count\nif (number > 0){\n msg.payload = {\n \"text\": number + \" new mail\",\n \"textOffset\": 0,\n \"icon\": 43,\n \"repeat\": 2\n };\n}\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 900, "y": 140, "wires": [ [ "bbe13ce911fad862" ] ] }, { "id": "bbe13ce911fad862", "type": "http request", "z": "f3eb030e2163a727", "name": "Awtrix custom app New mail", "method": "POST", "ret": "obj", "paytoqs": "ignore", "url": "http://<AWTRIX IP>/api/custom?name=newmail", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [ { "keyType": "Content-Type", "keyValue": "", "valueType": "other", "valueValue": "application/json" } ], "x": 940, "y": 200, "wires": [ [] ], "icon": "font-awesome/fa-align-left" }, { "id": "b593e2fe99e3014b", "type": "msg-counter", "z": "f3eb030e2163a727", "name": "Msg counter", "x": 630, "y": 80, "wires": [ [ "cad23108cc3ca69d", "f32dbab05a94989f" ] ] }, { "id": "3a1a8118a0d6c48c", "type": "function", "z": "f3eb030e2163a727", "name": "Reset counter", "func": "msg.topic = \"resetCounter\";\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 340, "y": 80, "wires": [ [ "b593e2fe99e3014b" ] ] }, { "id": "c1dae3927e08946d", "type": "inject", "z": "f3eb030e2163a727", "name": "Trigger", "props": [ { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "*/4 7-21 * * *", "once": false, "onceDelay": 0.1, "topic": "", "x": 120, "y": 140, "wires": [ [ "3a1a8118a0d6c48c", "8e9d1a723bfcda4d", "6a8a137b3244d56c" ] ] }, { "id": "f86f8dd43fa53ba4", "type": "function", "z": "f3eb030e2163a727", "name": "Clear Awtrix app", "func": "msg.payload = {}\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 630, "y": 200, "wires": [ [ "cad23108cc3ca69d" ] ] }, { "id": "cad23108cc3ca69d", "type": "trigger", "z": "f3eb030e2163a727", "name": "Block for 5s", "op1": "", "op2": "", "op1type": "nul", "op2type": "payl", "duration": "5", "extend": true, "overrideDelay": false, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 890, "y": 80, "wires": [ [ "b10fe46569d9897d" ] ] }, { "id": "6a8a137b3244d56c", "type": "trigger", "z": "f3eb030e2163a727", "name": "Block on trigger", "op1": "", "op2": "0", "op1type": "pay", "op2type": "str", "duration": "0", "extend": false, "overrideDelay": false, "units": "ms", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 340, "y": 200, "wires": [ [ "f86f8dd43fa53ba4" ] ] }, { "id": "f32dbab05a94989f", "type": "function", "z": "f3eb030e2163a727", "name": "Unblock", "func": "msg.reset = {};\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 640, "y": 140, "wires": [ [ "6a8a137b3244d56c" ] ] } ]
/flows/XRKWORneOrP4/43.jpg
-- Flow first published on September 26, 2023, last updated on September 26, 2023 at 19:46.