1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2024-11-26 13:19:15 +01:00

Add Node-RED pictures and change ntfy URL to ntfy.sh

This commit is contained in:
Niclas Andersson 2022-03-19 01:16:02 +01:00
parent 23547f4504
commit 2511ba7627
3 changed files with 190 additions and 162 deletions

View file

@ -132,181 +132,209 @@ Some simple bash scripts to achieve this are kindly provided in [nickexyz's repo
## Node-RED ## Node-RED
You can use the HTTP request node to send messages with [Node-RED](https://nodered.org), some examples: You can use the HTTP request node to send messages with [Node-RED](https://nodered.org), some examples:
Example: Send a message
![Node red message flow](static/img/nodered-message.png)
<details> <details>
<summary>Example: Send a message</summary> <summary>Expand</summary>
``` ```
[ [
{ {
"id": "8f09d37dd5773f88", "id": "c956e688cc74ad8e",
"type": "http request", "type": "http request",
"z": "ff3ad4e1.d3415", "z": "fabdd7a3.4045a",
"name": "ntfy", "name": "ntfy.sh",
"method": "POST", "method": "POST",
"ret": "txt", "ret": "txt",
"paytoqs": "ignore", "paytoqs": "ignore",
"url": "https://example.com/topic", "url": "https://ntfy.sh/mytopic",
"tls": "", "tls": "",
"persist": false, "persist": false,
"proxy": "", "proxy": "",
"authType": "", "authType": "",
"senderr": false, "senderr": false,
"credentials": {}, "credentials":
"x": 1410, {
"y": 740, "user": "",
"wires": [ "password": ""
[] },
] "x": 590,
}, "y": 3160,
{ "wires":
"id": "2603f296b25fe351", [
"type": "function", []
"z": "ff3ad4e1.d3415", ]
"name": "data", },
"func": "msg.payload = \"Something happened\";\nmsg.headers = {};\nmsg.headers['tags'] = 'house';\nmsg.headers['X-Title'] = 'Home Assistant';\n\nreturn msg;", {
"outputs": 1, "id": "32ee1eade51fae50",
"noerr": 0, "type": "function",
"initialize": "", "z": "fabdd7a3.4045a",
"finalize": "", "name": "data",
"libs": [], "func": "msg.payload = \"Something happened\";\nmsg.headers = {};\nmsg.headers['tags'] = 'house';\nmsg.headers['X-Title'] = 'Home Assistant';\n\nreturn msg;",
"x": 1290, "outputs": 1,
"y": 740, "noerr": 0,
"wires": [ "initialize": "",
[ "finalize": "",
"8f09d37dd5773f88" "libs": [],
] "x": 470,
] "y": 3160,
}, "wires":
{ [
"id": "d2351ed0720a239f", [
"type": "inject", "c956e688cc74ad8e"
"z": "ff3ad4e1.d3415", ]
"name": "Manual start", ]
"props": [ },
{ {
"p": "payload" "id": "b287e59cd2311815",
}, "type": "inject",
{ "z": "fabdd7a3.4045a",
"p": "topic", "name": "Manual start",
"vt": "str" "props":
} [
], {
"repeat": "", "p": "payload"
"crontab": "", },
"once": false, {
"onceDelay": "20", "p": "topic",
"topic": "", "vt": "str"
"payload": "", }
"payloadType": "date", ],
"x": 1150, "repeat": "",
"y": 740, "crontab": "",
"wires": [ "once": false,
[ "onceDelay": "20",
"2603f296b25fe351" "topic": "",
] "payload": "",
] "payloadType": "date",
} "x": 330,
"y": 3160,
"wires":
[
[
"32ee1eade51fae50"
]
]
}
] ]
``` ```
</details> </details>
Example: Send a picture
![Node red picture flow](static/img/nodered-picture.png)
<details> <details>
<summary>Example: Send a picture</summary> <summary>Expand</summary>
``` ```
[ [
{ {
"id": "726d0d75d6c0f70e", "id": "d135a13eadeb9d6d",
"type": "http request", "type": "http request",
"z": "ff3ad4e1.d3415", "z": "fabdd7a3.4045a",
"name": "Download jpeg", "name": "Download image",
"method": "GET", "method": "GET",
"ret": "bin", "ret": "bin",
"paytoqs": "ignore", "paytoqs": "ignore",
"url": "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png", "url": "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png",
"tls": "", "tls": "",
"persist": false, "persist": false,
"proxy": "", "proxy": "",
"authType": "", "authType": "",
"senderr": false, "senderr": false,
"credentials": {}, "credentials":
"x": 1320, {
"y": 780, "user": "",
"wires": [ "password": ""
[ },
"730dbbc9dbf1ed8a" "x": 490,
] "y": 3320,
] "wires":
}, [
{ [
"id": "730dbbc9dbf1ed8a", "6e75bc41d2ec4a03"
"type": "function", ]
"z": "ff3ad4e1.d3415", ]
"name": "data", },
"func": "msg.payload = msg.payload;\nmsg.headers = {};\nmsg.headers['tags'] = 'house';\nmsg.headers['X-Title'] = 'Home Assistant - Picture';\n\nreturn msg;", {
"outputs": 1, "id": "6e75bc41d2ec4a03",
"noerr": 0, "type": "function",
"initialize": "", "z": "fabdd7a3.4045a",
"finalize": "", "name": "data",
"libs": [], "func": "msg.payload = msg.payload;\nmsg.headers = {};\nmsg.headers['tags'] = 'house';\nmsg.headers['X-Title'] = 'Home Assistant - Picture';\n\nreturn msg;",
"x": 1470, "outputs": 1,
"y": 780, "noerr": 0,
"wires": [ "initialize": "",
[ "finalize": "",
"592f424b37f76f5c" "libs": [],
] "x": 650,
] "y": 3320,
}, "wires":
{ [
"id": "592f424b37f76f5c", [
"type": "http request", "eb160615b6ceda98"
"z": "ff3ad4e1.d3415", ]
"name": "ntfy", ]
"method": "PUT", },
"ret": "bin", {
"paytoqs": "ignore", "id": "eb160615b6ceda98",
"url": "https://example.com/topic", "type": "http request",
"tls": "", "z": "fabdd7a3.4045a",
"persist": false, "name": "ntfy.sh",
"proxy": "", "method": "PUT",
"authType": "", "ret": "bin",
"senderr": false, "paytoqs": "ignore",
"x": 1590, "url": "https://ntfy.sh/mytopic",
"y": 780, "tls": "",
"wires": [ "persist": false,
[] "proxy": "",
] "authType": "",
}, "senderr": false,
{ "credentials":
"id": "8aa06dda3c902f6a", {
"type": "inject", "user": "",
"z": "ff3ad4e1.d3415", "password": ""
"name": "Manual start", },
"props": [ "x": 770,
{ "y": 3320,
"p": "payload" "wires":
}, [
{ []
"p": "topic", ]
"vt": "str" },
} {
], "id": "5b8dbf15c8a7a3a5",
"repeat": "", "type": "inject",
"crontab": "", "z": "fabdd7a3.4045a",
"once": false, "name": "Manual start",
"onceDelay": "20", "props":
"topic": "", [
"payload": "", {
"payloadType": "date", "p": "payload"
"x": 1150, },
"y": 780, {
"wires": [ "p": "topic",
[ "vt": "str"
"726d0d75d6c0f70e" }
] ],
] "repeat": "",
} "crontab": "",
"once": false,
"onceDelay": "20",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 310,
"y": 3320,
"wires":
[
[
"d135a13eadeb9d6d"
]
]
}
] ]
``` ```

BIN
docs/static/img/nodered-message.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

BIN
docs/static/img/nodered-picture.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB