Page 1 of 1

HDMI CEC and Shutdown

Posted: Mon Jul 26, 2021 7:53 pm
by kpx4890
Hello

I modified https://github.com/Howchoo/pi-power-button file to allow me to turn the tv off wait 30 sec and turn the pi off when gpio pin5 state changes. Still trying to figure out how to get the tv on once I turn the pi on. here is the python script i am running

#!/usr/bin/env python


import RPi.GPIO as GPIO
import subprocess
import cec-client
import time

cec.init()

GPIO.setmode(GPIO.BCM)
GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.wait_for_edge(3, GPIO.FALLING)

tv = cec.device(0)
tv.standby()

# wait for 30 secs before shutting down
sleep(30)

subprocess.call(['shutdown', '-h', 'now'], shell=False)


the shutdown part works and if use the terminal and type echo 'standby 0.0.0.0 | cec-client -s -d 1 it turns the tv off.

Re: HDMI CEC and Shutdown

Posted: Wed Jul 28, 2021 2:23 pm
by hippy
Seems to me that's Python and on a Pi, nothing to do with MicroPython or Pico. You would be better off posting on the official Pi forums -

https://www.raspberrypi.org/forums