-systemd-logind session activation für den X-Server umgehen:
- echo "allowed_users = anybody" | sudo tee /etc/X11/Xwrapper.config
+try:
+ while True:
+ time.sleep(0.1)
+ current_state = GPIO.input(pir)
+ if current_state == 1 and previous_state == 0:
+ print("GPIO pin %s is %s, turning screen on" % (pir, current_state))
+ call("echo on 0 | cec-client -s -d 1", shell=True)
+ previous_state = 1
+ elif current_state == 0 and previous_state == 1:
+ print("GPIO pin %s is %s, turning screen off" % (pir, current_state))
+ call("echo standby 0 | cec-client -s -d 1", shell=True)
+ previous_state = 0
+ time.sleep(0.01)