You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fixed additional parameters like timeout beeing ignored during call of the scripts;
the commands now will be called with working dir set to the "MMM-CommandToNotification/scripts";
added a option to send a custom payload instead of the output of the script;
changed version to 0.0.3
Copy file name to clipboardexpand all lines: README.md
+17-2
Original file line number
Diff line number
Diff line change
@@ -42,9 +42,23 @@ Add the following code to your ~/MagicMirror/config/config.js:
42
42
| script | Either a absolute path or the path of a script within "scripts" directory | true | String | null |
43
43
| args | Arguments which should be passed to the script | false | String | "" |
44
44
| timeout | Should the script be killed if it does not return within a specific amount of sedonds? | false | Integer | infinity |
45
-
| notifications | A array containing names of the notifications to send if script returns output. If not present the script gets called but no notification will be send | false | Array |[]|
45
+
| notifications | A array containing names of the notifications to send if script returns output. If not present the script gets called but no notification will be send. If you want to override the payload instead of using the output please look at the notification section.| false | Array |[]|
46
46
| conditions | A map containing conditions that need to match to send the notifications | false | Map | null |
47
47
48
+
### Notifications
49
+
50
+
The notifications array contains all notifications that should be send if a command is called (and the conditions matched).
51
+
There may be situations where you want send a notification with a specific payload instead of the output of the script. You can do so if you specify a array instead of the string identifiying the notification.
52
+
Lets see the following example:
53
+
54
+
```json
55
+
notifications: [
56
+
["TEST1","MY_NEW_PAYLOAD"],
57
+
"TEST2",
58
+
],
59
+
```
60
+
61
+
In this example the notification "TEST1" will have "MY_NEW_PAYLOAD" as output while "TEST2" contains the output of the command.
48
62
49
63
### Conditions
50
64
@@ -67,7 +81,7 @@ Add the following example to produce the following result:
67
81
* the script "scripts/randomNumberJson.js" will be called every fourth iteration because a three skips are configured
68
82
* the script calculates a random number between -50 and 20 and produces a json object containing two values ("integer" and "float"). The float value is the random number the integer value the random number rounded as integer.
69
83
* the timeout of the script is set to 10 seconds
70
-
* the result of the script (JSON object as string) will be send as payload of notification TEST3
84
+
* the result of the script (JSON object as string) will be send as payload of notification TEST3 while TEST4 will be send with payload "true"
71
85
72
86
```json5
73
87
{
@@ -92,6 +106,7 @@ Add the following example to produce the following result:
0 commit comments