That worked!
I appreciate it a ton!
Posts by vgcheeze
-
-
How would I do that? I'm assuming i need to create an add-on that runs this?
Nvm, I'm assuming you mean in /storage/.config/autostart.sh?
Do I need to remove the other files such as keyboard.xml and the gpio info from the config.txt? -
Run this Python script from autostart.sh:
Python
Display More#!/usr/bin/python # This script was authored by AndrewH7 and belongs to him. # (www.instructables.com/member/AndrewH7) # You have permission to modify and use this script only for your own personal usage. # You do not have permission to redistribute this script as your own work. # Use this script at your own risk. import sys sys.path.append('/storage/.kodi/addons/virtual.rpi-tools/lib') import RPi.GPIO as GPIO import os # Replace YOUR_CHOSEN_GPIO_NUMBER_HERE with the GPIO pin number you wish to use. # Make sure you know which rapsberry pi revision you are using first. # The line should look something like this e.g. "gpio_number = 7". button_gpio_number = 3 # Use BCM pin numbering (i.e. the GPIO number, not pin number). # WARNING: this will change between Pi versions. # Check yours first and adjust accordingly. GPIO.setmode(GPIO.BCM) # It's very important the pin is an input to avoid short-circuits. # The pull-up resistor means the pin is high by default. GPIO.setup(button_gpio_number, GPIO.IN, pull_up_down = GPIO.PUD_UP) # Use falling edge detection to see if pin is pulled low to avoid repeated polling. # Send command to system to reboot. try: GPIO.wait_for_edge(button_gpio_number, GPIO.FALLING) os.system("shutdown -r now") except: pass # Revert all GPIO pins to their normal states (i.e. input = safe). GPIO.cleanup()
How would I do that? I'm assuming i need to create an add-on that runs this?
-
Don't forget, the RPi isn't a PC. Doesn't have the same (hardware) reset button. So in the case of the RPi, some kind of the software should "process" the signal from a GPIO in. I didn't know how is your RPi, when you want to reboot it, only the Kodi or the media player is frozen or the entire system... But if the whole system halted, isn't able to process any commands (including the one from GPIO3).
If don't want to use SSH, you should try a Kodi remote app like the "Kore" to check if the RPi can to reboot yourself. If isn't working, no other way, you need to use a button to interrupt the power...
Did you tried to press again the button after shut down? The original purpose should be to shut down and power up too.
Yeah, after the first button press, it shut down. Then I had to press it again and it powered back up.
I don't want any other apps or anything like that. I want it to be physical. I know its possible but I don't know why one will work and the others don't.
Here are the other threads I got most of my information from.ThreadReboot Button RPi4/Libreelec 10.0.1
Hello and merry christmas to you all...
I have for a couple of days searching the net to make a "Reboot-Button" to my Pi. But there is VERY different ways to make it work. I am going to connect the button over pin GPIO3 & Ground, but there is discussions if that is right or wrong. So i wonder, is that ok to do that? And do i need to change in the "Config.txt" or in eeprom as they suggest?
Best regards,Thore from Sweden2469December 23, 2021 at 3:14 PM ThreadRPi4 GPIO using in LibreELEC
Dear All,
Is it possible use GPIO pins with LibreELEC on RPi4? My idea is use some GPIO pin for LED in the power button for signaling that system is running. Now I´m using only standard shut down funtion in Kodi and RPi4 weak-up function with button on GPIO pins 5 and 6 made by this manual:
How to Add a Power Button to Your Raspberry Pi - howchoo
All manuals I found for this is for NOOBS but not for LibreELEC
Thanks
RadekFoxbikerAugust 16, 2019 at 10:23 PM -
Just got a random black screen, button worked to power it down, but still no reboot.
-
Or just use SSH and tell it to reboot.
Girlfriend doesn't know how to SSH. Simple option is to just have a button.
That means probably the system is frozen, so a software reboot solution, like reading a GPIO (button) status or SSH command, probably can't be used. As the RPi doesn't have hardware reset button option, remains only the "power them off and back on" as a solution. If you want to use a button, could try a button with "normally closed" contact to interrupt the power of the non working RPi when is pressed...
Either way, I'd still like this feature even if it doesn't work when it black screens.
-
Hello!
First of all, my goal is to make a button connected to GPIO 3 reboot the system.
To give you the overall picture, I have about 4 Pi2s in a network rack running libreelec 11.0.6 that plays my entire video library constantly. Randomly it will stop playing or get hung up at a black screen. I wanted to add a button to the panel for each pi so that it will just reboot the system instead of needing to get inside the rack to power them off and back on.
I've followed a few random threads I've found here about adding dtoverlay=gpio-shutdown or dtoverlay=gpio-reboot with and without gpio_pin=3 to the config.txt but, that still only powers it down.
I've tried adding a keyboard.xml and gen.xml to /storage/.kodi/userdata/keymaps, replacing shutdown with reboot and still getting a shutdown no matter what, and sometimes not even that.
keyboard.xml
gen.xml
I've double checked the physical layer too. Multiple different buttons, wires, ect. No luck.
Its weird because one out of the 4 pi's it works, and the only difference that I can see is just that I haven't updated it to 11.0.6, its currently on 11.0.3.
The holy grail would be something where a press would reboot, a hold would shut it down. I've seen threads with scripts and whatnot in them but they were always along with some LED indicator which I don't need.
I am a novice when it comes to all of this stuff, and by pure luck I've managed to get this far into creating essentially my own TV station. I don't know any code so please be easy on me if I ask any dumb questions.
Any ideas?