We adapted the original modbus library and created a lightweight version of it. Ours is also more flexible, but only offers support for the RTU configuration, and only for the modbus_read_input_registers
call.
-
Make sure you have git, make and gcc.
-
Install paho.mqtt.c:
git clone git@github.com:eclipse/paho.mqtt.c.git
cd paho.mqtt.c
make install
-
Install libsystemd-dev:
sudo apt install libsystemd-dev
-
Build the software:
make
-
Run it:
build/emi-read mqtt://<mqtt-host> <mqtt-user> <mqtt-pwd>
- Code cleanup.
- Add support for write (so that EMI address can be changed. Might be useful for residential buildings).
- Allow further customisation via args:
- Serial device file name
- Interval for instant values polling
- Values to poll
- We may consider going next level with a yaml config file instead.
- Contrib flow and guidelines
- install signal handlers for mqtt logoff and signaling.