mitchese / shm-et340

Sunny Home Manager emulator in a Victron ESS System (replaces ET340)
GNU General Public License v3.0
30 stars 9 forks source link

Update "Boot on Startup" manual for beginners #5

Closed TimBoWi closed 7 months ago

TimBoWi commented 2 years ago

Hey Mitchese you can Add this to your Description for "Starting at boot". Step by Step for Beginners. I think a lot of people who use your SHM Faker are quite new and maybe need some help.

First login onto your Venus to create the rc.local.

Use nano /data/rc.local to create the necessary file. Data is used because if you update your VenusOS, all other entrys will be deleted (as far as i know).

After you created the rc.local you have to tell the script, what it should to.

!#/bin/bash

sleep 15
setsid /data/home/root/shm-et340 > /dev/null 2>/dev/null &

image

Depending on your hadware setup you can change the seconds of the "sleep command". If your Systems is slow, you may have to increase the time (RaPi 4 2GB works fine with 15 seconds) Important: If you renamed shm-et340 you have to change the line accordingly. Save the Lines with ctrl+x and hit enter.

Now Check if the right permissions are set correctly with the following command. ls -l /data/rc.local

It should look like this. image

If permissions are missing use chmod to set them accordingly chmod u+x /data/rc.local

Now you are done, enter reboot and shm-et340 will start a few seconds after the boot is completed.

fishpepper commented 2 years ago

I would recommend running shm-et340 in a loop. My code crashed to some unknown reason after 20 days.

Save a file shm-et340-loop.sh in ~:

#!/bin/bash
LOG=/var/log/shm-et340

while true
do
  echo -ne "RESTART " >> $LOG
  date >> $LOG
  /data/home/root/shm-et340  2>&1 | tail -20 >> $LOG
  sleep 1
done

(don't forget to chmod +x shm-et340-loop.sh)

And then call shm-et340-loop.sh in the rc.local.

The last lines of debug info and reboot timestamps are stored in /var/log/shm-et340

christian1980nrw commented 1 year ago

I published an easy installation script with https://github.com/mitchese/shm-et340/pull/10/files . @fishpepper If there is a network problem, the driver will crash. I solved this problem too.

mitchese commented 7 months ago

I've updated the readme and included the install.sh which should take care of this