HDMI CEC and Shutdown

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
kpx4890
Posts: 1
Joined: Mon Jul 26, 2021 7:49 pm

HDMI CEC and Shutdown

Post by kpx4890 » Mon Jul 26, 2021 7:53 pm

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.

hippy
Posts: 130
Joined: Sat Feb 20, 2021 2:46 pm
Location: UK

Re: HDMI CEC and Shutdown

Post by hippy » Wed Jul 28, 2021 2:23 pm

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

Post Reply