Skip to content

Commit fc70b6a

Browse files
reformatted README to be complient to style guide
1 parent ae84c5f commit fc70b6a

File tree

1 file changed

+46
-39
lines changed

1 file changed

+46
-39
lines changed

README.md

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,53 @@
11
# MMM-CommandToNotification
2+
23
MagicMirror² module which periodically calls configured scripts and sends the output as value of configurable notifications. The values can be displayed in modules like [MMM-ValuesByNotification](https://github.com/Tom-Hirschberger/MMM-ValuesByNotification).
34

45
Example scripts to read the temperature values of DHT11, DHT22, DS18B20, HTU21 or BME280 connected to the raspbarry or Miraflor sensor in reach of bluetooth are included in the scripts directory.
56

67
## Basic installation
7-
```
8+
9+
```bash
810
cd ~/MagicMirror/modules
911
git clone https://github.com/Tom-Hirschberger/MMM-CommandToNotification
1012
cd MMM-CommandToNotification
1113
npm install
1214
```
15+
1316
## Basic configuration
17+
1418
Add the following code to your ~/MagicMirror/config/config.js:
1519

16-
```
17-
{
18-
module: "MMM-CommandToNotification",
19-
disabled: false,
20-
config: {
21-
commands: [
22-
]
23-
},
24-
},
20+
```json5
21+
{
22+
module: "MMM-CommandToNotification",
23+
disabled: false,
24+
config: {
25+
commands: [
26+
]
27+
},
28+
},
2529
```
2630

2731
### General
32+
2833
| Option | Description | Type | Default |
2934
| ------- | --- | --- | --- |
3035
| updateInterval | How often should the scripts be iterated (in seconds) | Integer | 30 |
3136
| commands | A array containing the command definition objects | Array | [] |
3237

3338
### Commands
39+
3440
| Option | Description | Mandatory | Type | Default |
3541
| ------- | --- | --- | --- | --- |
3642
| script | Either a absolute path or the path of a script within "scripts" directory | true | String | null |
3743
| args | Arguments which should be passed to the script | false | String | "" |
3844
| timeout | Should the script be killed if it does not return within a specific amount of sedonds? | false | Integer | infinity |
3945
| 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 | [] |
4046

41-
4247
### Example
48+
4349
Add the following example to produce the following result:
50+
4451
* the scripts will be iterated every 10 seconds cause no skips option is configured
4552
* the script "scripts/randomInteger.js" gets called every iteration
4653
* a random number between -10 and 10 is produced
@@ -51,32 +58,32 @@ Add the following example to produce the following result:
5158
* the timeout of the script is set to 10 seconds
5259
* the result of the script (JSON object as string) will be send as payload of notification TEST3
5360

61+
```json5
62+
{
63+
module: "MMM-CommandToNotification",
64+
disabled: false,
65+
config: {
66+
updateInterval: 10,
67+
commands: [
68+
{
69+
script: "randomInteger.js",
70+
args: "-10 10",
71+
timeout: 5,
72+
notifications: [
73+
"TEST1",
74+
"TEST2",
75+
],
76+
},
77+
{
78+
script: "randomNumberJson.js",
79+
args: "-50 20",
80+
skips: 3,
81+
timeout: 10,
82+
notifications: [
83+
"TEST3",
84+
],
85+
}
86+
]
87+
},
88+
},
5489
```
55-
{
56-
module: "MMM-CommandToNotification",
57-
disabled: false,
58-
config: {
59-
updateInterval: 10,
60-
commands: [
61-
{
62-
script: "randomInteger.js",
63-
args: "-10 10",
64-
timeout: 5,
65-
notifications: [
66-
"TEST1",
67-
"TEST2",
68-
],
69-
},
70-
{
71-
script: "randomNumberJson.js",
72-
args: "-50 20",
73-
skips: 3,
74-
timeout: 10,
75-
notifications: [
76-
"TEST3",
77-
],
78-
}
79-
]
80-
},
81-
},
82-
```

0 commit comments

Comments
 (0)