Execute Linux command and get result in Ignition script


I want to get some info of my raspberry PI like CPU temp, speed,… directly in Ignition.
Running some basic OS command will return the result but the problem is system.util.execute function doesn’t return any value. So I wonder how can I do that directly in ignition?
Right now I use node red which it run command and parse the data and send the trimmed data to ignition via OPC UA which is not optimize in tiny device like RPi with limited 1GB RAM.
Also I try python gpiozero, but it doesn’t work either.

Either Python’s subprocess API or Java’s Process API should work.

Hi Kevin
Could please write simple example to show in detail of doing this in ignition.

I try this in button script but get following error:

import os
from gpiozero import CPUTemperature

cpu = CPUTemperature()

Traceback (most recent call last):
File “event:actionPerformed”, line 2, in
File “C:\Users\Nader.ignition\cache\gwlocalhost_8088\C0\pylib\gpiozero_init_.py”, line 97, in
from .output_devices import (
File “C:\Users\Nader.ignition\cache\gwlocalhost_8088\C0\pylib\gpiozero\output_devices.py”, line 45, in
from colorzero import Color
ImportError: No module named colorzero

I don’t know what that library is or what it’s doing. You asked for an alternative to system.util.execute because you aren’t able to see the output of commands you run, so I’m not sure how this is relevant.

Sorry it’s not directly relevant, I’m just using the topic about interaction Rpi and alternative solution.
about Python’s [subprocess API] could you send me a simple example to show how to get the result of “free -h” or “vcgencmd measure_temp” command?