Skip to content

Commit dbe24a8

Browse files
committed
update readme
1 parent 0aef2a3 commit dbe24a8

File tree

1 file changed

+57
-15
lines changed

1 file changed

+57
-15
lines changed

README.md

Lines changed: 57 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,30 +46,72 @@ echo "log.info 'get ma a coffee' > /opt/mqtt-smarthome/scripts/test1.coffee
4646
```mqtt-scripts -d /opt/mqtt-smarthome/scripts```
4747

4848

49+
### Run with Docker
50+
51+
To run with Docker, use either a [pre-build image](https://hub.docker.com/r/dersimn/mqtt-scripts) or build one your own. Either way, just substitude the node-command you would have used by the Docker command, for e.g.:
52+
53+
```mqtt-scripts --help```
54+
55+
becomes
56+
57+
```docker run dersimn/mqtt-scripts --help```
58+
59+
An example for a productive configuration would be:
60+
61+
```
62+
docker run -d --restart=always --name=logic \
63+
-e "TZ=Europe/Berlin" \
64+
-v /opt/hma/etc/scripts:/scripts:ro \
65+
dersimn/mqtt-scripts \
66+
--url mqtt://10.1.1.50 \
67+
--dir /scripts
68+
```
69+
70+
Configure via `MQTTSCRIPTS_` env variables when using Docker Compose.
71+
72+
73+
#### Build
74+
75+
To build a Docker image yourself use the following workflow:
76+
77+
```
78+
git clone https://github.com/hobbyquaker/mqtt-scripts.git
79+
cd mqtt-scripts
80+
docker build -t mqtt-scripts .
81+
```
82+
83+
To build for the Raspberry Pi, run:
84+
85+
```
86+
docker build -t mqtt-scripts:armhf -f Dockerfile.armhf .
87+
```
88+
89+
4990
# Command Line Options
5091

5192
<pre>
5293
Usage: mqtt-scripts [options]
5394

5495
Options:
55-
-v, --verbosity possible values: "error", "warn", "info", "debug"
56-
[default: "info"]
57-
-n, --name instance name. used as mqtt client id and as prefix
58-
for connected topic [default: "logic"]
59-
-s, --variable-prefix topic prefix for $ substitution (shorthand for
60-
variables, see docs) [default: "var"]
61-
-t, --disable-variables disable variable feedback (see docs)
62-
[default: false]
63-
-u, --url mqtt broker url. See https://github.com/mqttjs/MQTT.
64-
js#connect-using-a-url [default: "mqtt://127.0.0.1"]
65-
-h, --help Show help
96+
--version Show version number [boolean]
97+
-c, --config Path to JSON config file
6698
-d, --dir directory to scan for .js and .coffee files. can be
6799
used multiple times.
100+
-h, --help Show help [boolean]
101+
-s, --variable-prefix topic prefix for $ substitution (shorthand for
102+
variables, see docs) [default: "var"]
103+
-t, --disable-variables disable variable feedback (see docs) [default: false]
104+
-n, --name instance name. used as mqtt client id and as prefix
105+
for connected topic [default: "logic"]
106+
-u, --url mqtt broker url. See
107+
https://github.com/mqttjs/MQTT.js#connect-using-a-url
108+
[default: "mqtt://127.0.0.1"]
109+
-v, --verbosity possible values: "error", "warn", "info", "debug"
110+
[default: "info"]
68111
-w, --disable-watch disable file watching (don't exit process on file
69-
changes)
70-
--version Show version number
71-
-l, --latitude Coordinates are needed for the sunSchedule method
72-
-m, --longitude
112+
changes) [default: false]
113+
-l, --latitude [default: 48.7408]
114+
-m, --longitude [default: 9.1778]
73115
</pre>
74116

75117
If you're running multiple instances of mqtt-scripts you have to decide which one should handle variables and disable

0 commit comments

Comments
 (0)