Skip to content

Commit 1ff98ad

Browse files
committed
New readme, and a version bump, and improvements to the package and upload script.
1 parent 0618908 commit 1ff98ad

4 files changed

Lines changed: 20 additions & 8 deletions

File tree

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,22 @@ be a complete solution.
2626

2727
## Installation
2828

29+
### Python module
30+
2931
```bash
3032
$ pip3 install --user modbus4mqtt
3133
$ modbus4mqtt --help
3234
```
3335

36+
### Docker container
37+
3438
Alternatively you can run Modbus4MQTT in a Docker container. A [Dockerfile](./Dockerfile) example is provided.
3539

36-
You will need to provide the credentials to connect to your MQTT broker, as well as a path to a YAML file that defines the memory map of your Modbus device. You can download these YAML files from this project's github repo.
40+
```bash
41+
$ docker pull tjhowse/modbus4mqtt:latest
42+
$ docker run modbus4mqtt --help
43+
```
44+
When launching inside the docker container you will either need to use one of the built-in YAMLs like `/modbus4mqtt/modbus4mqtt/Sungrow_SH5k_20.yaml`, or map your custom YAML into the container in a volume.
3745

3846
## YAML definition
3947

modbus4mqtt/modbus4mqtt.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,12 @@ def loop_forever(self):
229229
sleep(self.config['update_rate'])
230230

231231
@click.command()
232-
@click.option('--hostname', default='localhost', help='The hostname or IP address of the MQTT server.')
233-
@click.option('--port', default=1883, help='The hostname or IP address of the MQTT server.')
234-
@click.option('--username', default='username', help='The hostname or IP address of the MQTT server.')
235-
@click.option('--password', default='password', help='The hostname or IP address of the MQTT server.')
236-
@click.option('--config', default='./Sungrow_SH5k_20.yaml', help='The YAML config file for your modbus device.')
237-
@click.option('--mqtt_topic_prefix', default='modbus4mqtt', help='Prefixed to everything this publishes')
232+
@click.option('--hostname', default='localhost', help='The hostname or IP address of the MQTT server.', show_default=True)
233+
@click.option('--port', default=1883, help='The port of the MQTT server.', show_default=True)
234+
@click.option('--username', default='username', help='The username to authenticate to the MQTT server.', show_default=True)
235+
@click.option('--password', default='password', help='The password to authenticate to the MQTT server.', show_default=True)
236+
@click.option('--config', default='./Sungrow_SH5k_20.yaml', help='The YAML config file for your modbus device.', show_default=True)
237+
@click.option('--mqtt_topic_prefix', default='modbus4mqtt', help='A prefix for published MQTT topics.', show_default=True)
238238
def main(hostname, port, username, password, config, mqtt_topic_prefix):
239239
logging.basicConfig(
240240
format='%(asctime)s %(levelname)-8s %(message)s',

modbus4mqtt/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version="0.4.1"
1+
version="0.4.2"

package_and_upload.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash
2+
version=v`cat ./modbus4mqtt/version.py | cut -d\" -f2`
23
rm ./dist/modbus4mqtt*.whl
34
rm ./dist/modbus4mqtt*.tar.gz
45
python3 setup.py sdist bdist_wheel
56
python3 -m twine upload dist/*
7+
docker build -t tjhowse/modbus4mqtt:latest -t tjhowse/modbus4mqtt:"$version" .
8+
docker push tjhowse/modbus4mqtt:latest
9+
docker push tjhowse/modbus4mqtt:"$version"

0 commit comments

Comments
 (0)