question

mario1234 avatar image
mario1234 asked

How to create a watchdog or keep alive sequences between cerbo and EM24

every now and then the connection between EM24 and Cerbo (Modbus TCP) hangs up.

Then the grid values in the Cerbo freeze and under certain circumstances the battery is drained and iced into the grid unnecessarily.

Hence my question whether you can install a watchdog in the Cerbo that checks whether the value of the grid meter changes over time.

Or maybe the EM24 will even send a keep alive signal which can be used. thanks Mario

em24
1 comment
2 |3000

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

Tom Büschgens avatar image Tom Büschgens commented ·
Similar setup, same effect. Not an EM24, but using a Fronius Smartmeter as the grid meter.

I was experiencing the same issues, once draining the better part of my battery into the grid for no good reason but a stuck value.

I resolved to kill & restart the fronius-dbus script every 60 minutes. Works, no recognisable side effects so far.

As I am unsure how you configured the EM24 Modbus TCP connection, this might be a (ugly) hack to overcome the issue temporarily?

Keen to see a more elegant solution (and while writing, I think one could do with a bash script, checking the dbus values etc... need to think about that one).

0 Likes 0 ·
2 Answers
Tom Büschgens avatar image
Tom Büschgens answered ·

Followup with an answer.

Just used some free minutes to craft an ugly script which does the job for my setup (using the dbus-fronius-smartmeter) - should be self-explanatory:

#!/bin/bash

DBUS=/usr/bin/dbus
DBUS_BASE=com.victronenergy.grid.ttyUSB0
DBUS_PATH=/Ac/Power

# get first power value
OLD_VAL=`$DBUS -y $DBUS_BASE $DBUS_PATH GetValue`

# sleep for 10 seconds, then get next value
sleep 10
CUR_VAL=`$DBUS -y $DBUS_BASE $DBUS_PATH GetValue`

#check if both values are same - if so, kill/restart the service.
if [ "$OLD_VAL" = "$CUR_VAL" ]; then
   /data/dbus-fronius-smartmeter/kill_me.sh
fi


I run this script every minute from cron - easiest to have a semi-persistent setup for venus OS. Does the job - rather as a starting point, not as a ready to run solution.

Hope this helps

2 comments
2 |3000

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

sledgehoe avatar image sledgehoe commented ·
Hi Tom,

Nice and helpful little script.
I have found a little error on top of your script:
#!/bin/bash would be the correct path to bash.

Otherwise the cron daemon cannot find the correct interpreter.


kind regards
Sledgehoe

1 Like 1 ·
Tom Büschgens avatar image Tom Büschgens sledgehoe commented ·
Thanks, just corrected it for further use.
0 Likes 0 ·
mario1234 avatar image
mario1234 answered ·

@Tom Büschgens kann ich Dir hier auch irgendwie eine pers. Nachricht zukommen lassen? Ich habe keine Ahnung wo Du den Cronjob laufen hast? Ist das auch auch der Cerbo möglich? Gruß und Danke Mario

1 comment
2 |3000

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

Tom Büschgens avatar image Tom Büschgens commented ·
Hi Mario,

kein Problem: sledge@seconet.de

Aber als grundsätzliche Problemlösung:

  1. Script irgendwo unter /data/.... abspeichern, damit es updates / reboots überlebt
  2. Script mit chmod a+x ausführbar machen
  3. crontab -e und dort das Script dann alle Minute (oder vglbar) laufen lassen

Also 2. / 3. sind eher Linux-spezifische Fragen, 1. dann vielleicht noch Venus OS :-)

Für Dein setup noch unklar: Wie restarte ich den Modbus TCP-Teil, damit der EM24 wieder richtig ausgelesen wird.

0 Likes 0 ·

Related Resources

Additional resources still need to be added for this topic

Energy Meter Manual EM24 RS485