Felix Wirth's helpfull page at:
https://github.com/victronenergy/venus/wiki/howto-add-a-driver-to-Venus
runs a little short no examples in places.
Installing a driver that doesn't depend on a serial port
You may wish to add a driver that doesn't connect to a serial port and, thus, is not something that would be invoked by serial-starter
as described above. For example, like the dummy dbus service example, you may wish to publish a set of objects to the D-Bus that are writeable by an external service, to surface data onto Venus from somewhere else. Another example might be a driver that filters or re-processes some of the existing sensor data on the D-Bus into a new service, e.g., smoothing the data coming from a tank level sender.
For these situations, follow these steps:
- Set up your new driver under the
/data
disk so that it will survive software updates. - Add a
run
script in your service's directory that daemontools can use to invoke your service. - Optionally, add a
log/run
script that daemontools can use to turn on log management for your service. See the daemontools FAQ or another Venus service for an example of how to do this. - Symlink your service directory to
/service
so that it will be invoked automatically at startup.
At this point, it is assumed that the reader knows what is needed. Whilst the command to create a symlink is easy to look up, the target directory is not explained in detail. Looking through the Venus directory, there are system folders everywhere!. most of these are over-written at system boot. An example run file would also help - there are some differences between what is needed here and the equivalent shell file that systemctl uses.
If anyone can help by pointing out the right directory path for the symlink this would be appreciated. ( @Kevin Windrem ?)
- Optionally, add some shell script logic to
/data/rc.local
to re-symlink your service if the symlink goes missing.rc.local
is invoked at system startup and survives new Venus updates, whereas your symlink will not survive. By adding a check inrc.local
you can ensure your service will be scheduled to start again after upgrade.