question

rmaddy avatar image
rmaddy asked

How to run a command from custom Venus Settings menu?

I just setup an RPi running Venus OS 2.66. As an experiment I am trying to add a custom menu item to Settings. Currently there is a "Reboot?" menu in Settings -> General. I wish to add a "Restart GUI?" menu.

I've found the /opt/victronenergy/gui/qml/PageSettingsGeneral.qml file and the entry for the Reboot? menu so I have figured out how to add my custom menu.

I have also determined that the command "svc -t /service/gui" can be used to restart the GUI.

The part I'm missing is how to run that "svc" command from within the qml file.

Does anyone know the correct syntax?

Along those lines, is there any reference documentation for the "vePlatform" class from com.victron.velib? I can see there are commands such as "reboot()" by scanning the qml files but is there a complete list in some documentation somewhere?

Venus OSdocumentation
2 |3000

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

4 Answers
markus avatar image
markus answered ·

Hi.
Changing the language to another one restarts the GUI. Change it back to the language it was before right after. Maybe this is all you need and can save your time.
Best Regards

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.

Thanks but I'm not looking for a trick that results in the GUI being restarted. I'm trying to learn how to make some custom menus so I'm looking for some relevant documentation. My test menu to run the command that happens to restart the GUI is just a way to begin the learning process.

0 Likes 0 ·
johanndo avatar image
johanndo answered ·

Did you find a easy solution?

I am inclined to write a dummy dbus service with some variables and callback functions in python that would then invoke.

svc -k /service/dbus-<whatever>

optional svc -d /service/... and svc -u /service/...

commands for the registered services including the gui. You could then start or run any command you like.

With some TLC one could store the variable and the command line in the settings service and configure the list dynamically from the UI - if you do not expect a response from the command.

what do you think?

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.

No. It wasn't a big priority so I didn't spend much time on it.
0 Likes 0 ·
johanndo avatar image
johanndo answered ·

I actually did it wrote a service for restarting the services, it works fine.

Now I will tweak the GUI and post some pictures...


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.

Hi @JohannDo could you publish the code for this service here ( or a link to gitt hub if it is there). I’m interested in seeing how you did this.

Thanks Laurence

1 Like 1 ·
kivanov avatar image
kivanov answered ·

I will ask in this thread - what is the easiest way to have the R-Pi temperature reading in the remote console menu?

The needed value is in

cat /sys/class/thermal/thermal_zone0/temp
3 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.

https://github.com/LHardwick-git/Victron-Service

The question has been asked before here.

https://community.victronenergy.com/questions/122876/cpu-temperature-in-rpi.html

With the same answer.

This was updated two month ago to run on Python 3 and Venus 2.8x

1 Like 1 ·

@kivanov

I use this for cpu temp. It can be used for other temperature readings as well, but as configured now it only shows cpu-temp.

download to pi / tar xf cputemp.tar

CPU_temp

0 Likes 0 ·

You should open a separate topic, as this has nothing to do with running custom tasks. Others may be interested in the answers as well and it would be burried in a total off-topic tread.

0 Likes 0 ·