We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

using terminal commands results in variable does not work in PYTHON

  • I am trying to read the brightness parameter of blue Led of omega2 to use it in a variable to use this to manage a led in my frontplate of my box with omega 2lte. I do not know what i do wrong. here is the essential part of the python script I use:

    while True:
    w = os.system("cat /sys/class/leds/omega2lte:blue:wifi/brightness")
    if w == 255:
    status2 = "connected"
    status = gpioObj.setValue(0)

    The frontplate shows if I am connected to my application via mobile ( iot ) or via wifi, if there is no good radio connection to mobile iot
    If I look in logread I see that the cat command shows the correct value of 255 and but the ïf in the programm does not see the variable.
    Van some body help me with this?

  • @kottes
    Looks like os.system() is not passing the result of cmd to w.

    Try this:

    import subprocess
    cmd = "cat /sys/class/leds/input3::numlock/brightness"
    ret = subprocess.check_output(cmd, shell = True).strip()
    if ret == b'1':
    print("NumLock ON")


  • Why don't you just read the (pseudo) file? No need to open new processes. Using

    w = int(open('/sys/class/leds/omega2lte:blue:wifi/brightness').read())

    Will give you what you need from python in a pythonic way.

Looks like your connection to Community was lost, please wait while we try to reconnect.