(01-09-2024, 10:01 PM)Wallyboy Wrote: Try these small changes, cosmetics...
Code:#!/usr/bin/env python
import RPi.GPIO as GPIO
import os
import subprocess
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(16, GPIO.OUT)
boot_complete = int(subprocess.run(["/usr/local/bin/moodeutl", "-q", "select value from cfg_system where param='wrkready'"], capture_output=True, text=True).stdout)
print(boot_complete)
if boot_complete == 1:
GPIO.output(16, True)
else:
GPIO.output(16, False)
I recommend you keep your file safe, then try my changes, and keep them ONLY if they work (I might have introduced typos, or simply the Python engine my changes might not like my code shrinking...)
You can also try this, instead of the IF/ELSE:
Code:
GPIO.output(16, boot_complete == 1 ? True : False)
And remove the print(boot_complete) if you like, or comment it by adding a # at the beginning of the line, with no spaces before nor after, so that the line reads
Code:
#print(boot_complete)
That's it.
Good to hear you managed to accomplish then task, and that's what's important.