question

manje avatar image
manje asked

Getting a daemon running for activating Sailor hat from hatlab on a RPI 4

Hi,

I'm trying to use a Sailor hat from hat lab what has a good guide for setting it up here. However, it's not written for Venus OS. I have got some support in the hat lab discussion forum here but don't manage to understand how to replace the systemd and what to use instead.

I have tried this.

1. Added the https://github.com/hatlabs/SH-RPi-daemon into /data/
2. Install python 3

# opkg update
~# opkg list | grep pip
~# opkg install python3-pip

3.I have copied the sharp.service to /opt/victronenergy/service4. I tried both with and without modifying the
sharp.service

with original and with

#!/bin/sh
exec 2>&1
exec /data/SH-RPi-daemon-main/src/shrpi/daemon.py


Note:I have not been able to run/use fromt he hatlab installation guides

sudo install -o root shrpid.service /lib/systemd/system
sudo systemctl daemon-reload
sudo systemctl enable shrpid

However I don't get the service to run and don't respond to the commands like shrpi -help. Anyone else have done something similar and have ideas or recommendations?

Venus OS
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

2 Answers
matt1309 avatar image
matt1309 answered ·

Hi @manje

Im not familiar with the specific program you mention however i can help with the service part. Venus os doesnt use systemd but does use daemontools.

There's a guide for what you're looking to do. It's written for developers who have made their own custom driver (to integrate a new device like an energy meter/tank etc) however it is what you're looking to do (but you're obvious using the program you've mentioned above rather than one you've built to add a device into venus os)

Hope this helps:

howto add a driver to Venus · victronenergy/venus Wiki · GitHub

Skip to the section "Installing a driver that doesn't depend on serial port"


2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

bathnm avatar image
bathnm answered ·

@manje I did get this working. I can't remember how I got the capability installed. but installed it into /data/local/bin then I created a startup service in /opt/victronenergy/service/shrpi with a file called run, which contained

#!/bin/sh
echo "*** starting shrpi ***"
exec 2>&1

# Check if i2c-dev module is loaded
# Note check for i2c-3 due to this in config.txt
## #Use one of the other i2c busses so as not hit some
## #hardware bug with the main bus, something to do with
## #bitbang....
## dtoverlay=i2c3,pins_2_3
if [ ! -e /dev/i2c-3 ]; then
   echo "loading i2c_dev module to access i2c device"
   modprobe i2c_dev
fi

export PYTHONUSERBASE=/data/local
exec /data/local/bin/shrpid -s /run/shrpid.sock --i2c-bus 3

This will then start the Damon on boot. Just remember to make a backup of that file, as following a reboot the file and directory will need to be recreated.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Related Resources