Today I finally found a moment to make pilight2mqtt a bit more usable and also add some infrastructure.

I basically refactored the code a little and added a launcher script. Installing is now as easy as executing setup.py and running the pilight2mqtt executable afterwards.

python setup.py install
pilight2mqtt --help

Parameters for pilight2mqtt are really not that many

> python -m pilight2mqtt --help
usage: __main__.py [-h] [--version] [--mqtt-server MQTT_SERVER]
                   [--mqtt-port MQTT_PORT] [--mqtt-topic MQTT_TOPIC]
                   [--pilight-server PILIGHT_SERVER]
                   [--pilight-port PILIGHT_PORT] [--debug] [--verbose]
                   [--pid-file path_to_pid_file]

pilight2mqtt: Translate pilight events to MQTT.

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --mqtt-server MQTT_SERVER
                        Address of the MQTT server to talk to.
  --mqtt-port MQTT_PORT
                        Port of the MQTT server to talk to.
  --mqtt-topic MQTT_TOPIC
                        MQTT topic to use.
  --pilight-server PILIGHT_SERVER
                        Set the address of the pilight server to use. If not
                        specified will try to auto discover
  --pilight-port PILIGHT_PORT
                        Port of the pilight server. Only used when pilight-
                        server is also specified
  --debug               Start pilight2mqtt in debug mode
  --verbose             Start pilight2mqtt in verbose mode
  --pid-file path_to_pid_file
                        Path to PID file useful for running as daemon

You can find the updated code on GitHub. There is now also a Travis-CI project that builds automatically. I will cover how to setup Home Assistant and connect it to pilight2mqtt in a future article.

Stuff still on my to do list:

  • improve build & test infrastructure
  • write tests
  • support for DHT11 sensor
  • support for other stuff I missed in the initial version

Leave a comment