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.

5 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.

rmaddy avatar image rmaddy commented Ā·

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.

rmaddy avatar image rmaddy commented Ā·
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...


7 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.

laurenceh avatar image laurenceh commented Ā·
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

3 Likes 3 Ā·
ryanb avatar image ryanb laurenceh commented Ā·
Any luck on getting this code from Johanndo?
0 Likes 0 Ā·
johanndo avatar image johanndo ryanb commented Ā·
What's the problem, its is up there in the zip files?
0 Likes 0 Ā·
johnny-brusevold avatar image johnny-brusevold johanndo commented Ā·

@JohannDo maybe it was because there was no zip file there?

0 Likes 0 Ā·
johnny-brusevold avatar image johnny-brusevold johanndo commented Ā·

@JohannDo

I can see the page you posted now in the last post, but not anywhere else. The zip files are also not downloadable.

403error.png

1 Like 1 Ā·
403error.png (42.1 KiB)
johanndo avatar image johanndo johnny-brusevold commented Ā·

pagecontrol.zip

dbus-control.zippagecontrol.zip


Hope it works now.

1 Like 1 Ā·
dbus-control.zip (3.0 KiB)
pagecontrol.zip (650 B)
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.

laurenceh avatar image laurenceh commented Ā·

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 Ā·
johnny-brusevold avatar image johnny-brusevold commented Ā·

@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 Ā·
johanndo avatar image johanndo commented Ā·

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 Ā·
theater764 avatar image
theater764 answered Ā·


Hello,
Can anybody help me further?
I have a Cerbo GX with firmware 3.10 Large and GuiMods version 8.10 installed
I have added the files from @JohannDo as specified in the ā€œcontrol.zipā€.
Unfortunately I can only get to the menu image as shown above.
It looks like dbus-control.py has an error or is not running with the current image.
I've already tried everything possible in dbus-control.py (leaning by doing) but unfortunately I can't find the error.
Can someone help me or has someone already got the tool running and can send me the files again.
I really don't know what to do next
It would be really great if someone could help me.

best regards

                
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

Victron Venus OS Open Source intro page

Venus OS GitHub (please do not post to this)

Additional resources still need to be added for this topic