Skip to content
Richard Pearce edited this page Jan 26, 2024 · 1 revision
# Run once and quit
python3 sofar2mqtt-v2.py --broker localhost --device /dev/ttyUSB0
Usage: sofar2mqtt-v2.py [OPTIONS]

  Main

Options:
  --config-file TEXT          Configuration file to use  [default: sofar-hyd-
                              ep.json]
  --daemon                    Run as a daemon
  --retry INTEGER             Number of read retries per register before
                              giving up  [default: 2]
  --retry-delay FLOAT         Delay before retrying read  [default: 0.1]
  --write-retry INTEGER       Number of write retries per register before
                              giving up  [default: 5]
  --write-retry-delay FLOAT   Delay before retrying write  [default: 2]
  --refresh-interval INTEGER  Refresh data every n seconds  [default: 5]
  --broker TEXT               MQTT broker address  [default: localhost]
  --port INTEGER              MQTT broker port  [default: 1883]
  --username TEXT             MQTT username
  --password TEXT             MQTT password
  --topic TEXT                MQTT topic for reading  [default: sofar/]
  --write-topic TEXT          MQTT topic for writing  [default: sofar/rw]
  --log-level [INFO|DEBUG]    Log Level  [default: INFO]
  --device TEXT               RS485/USB Device  [default: /dev/ttyUSB0]
  --help                      Show this message and exit.

To avoid passing sensitive data on the command line you can also set the username and password using enviroment variables: MQTT_USERNAME and MQTT_PASSWORD

Clone this wiki locally