systemd configuration file for RFXcom to MQTT Perl script

First job of the evening (at least, first indoor job of the evening) was to come up with a unit file to start the Perl script that takes power consumption data from my RFXcom unit and publishes it to MQTT. Fortunately that wasn’t too taxing and the following looks to work first time.




I copied that to /etc/systemd/system/rfxcom.service at which point

sudo systemctl daemon-reload
sudo systemctl start rfxcom.service

was sufficient to get it running. Then

sudo systemctl enable rfxcom.service

should make sure it starts on a reboot.

There are a few things that would be neat to sort out at some point, such as the direct reference in the code to /dev/ttyUSB0. I guess the correct thing to do would probably be to arrange for a symlink to something like /dev/rfxcom to be created in the udev rules when the relevant device is plugged in, and also add


to the same rule. Then adding


to the unit file in the Unit section might do the trick. Need to research that last bit a little more though, as I’m not certain that’s correct.

This entry was posted in Computing and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *