Good morning, I have a raspberry pi 3 with the latest dietpi v8 on it and…a pizigate (home automation). In the pizigate configuration it is necessary to reconfigure certain gpio pins. For this we use ‘wiringpi’. Except we can’t install it anymore. So I installed ‘rpi.gpio’ but I don’t see how to pass the commands I need:
I’m not able to answer your question but latest DietPi version is v9.6. v9.6 July 2024 - DietPi.com Docs
RPi.GPIO is a python library, you would need to write a python script and execute it. It does not support command execution from CLI like wiringpi does.
As you can see in the documentation 0 and 2 are Pins 17 and 27.
Mode is to set as input
or output
.
write is to set it to high
or low
.
With this knowledge you can write a python script:
import RPi.GPIO as GPIO
import time
# Use BCM GPIO numbering
GPIO.setmode(GPIO.BCM)
# Set GPIO 17 (wiringPi pin 0) and GPIO 27 (wiringPi pin 2) as outputs
GPIO.setup(17, GPIO.OUT)
GPIO.setup(27, GPIO.OUT)
# Set GPIO 27 (wiringPi pin 2) to high
GPIO.output(27, GPIO.HIGH)
# Set GPIO 17 (wiringPi pin 0) to low
GPIO.output(17, GPIO.LOW)
# Wait for a short period to ensure the state is set
time.sleep(0.1)
# Set GPIO 17 (wiringPi pin 0) to high
GPIO.output(17, GPIO.HIGH)
# Clean up GPIO settings
GPIO.cleanup()
Save the script and run it with python like
python3 /path/to/my_script.py
Disclaimer: I used ChatGPT and did not test this.
edit:
flash mode would be
# Set GPIO 17 (wiringPi pin 0) as output
gpio mode 0 out
# Set GPIO 27 (wiringPi pin 2) as output
gpio mode 2 out
# Set GPIO 27 (wiringPi pin 2) to low
gpio write 2 0
# Set GPIO 17 (wiringPi pin 0) to low
gpio write 0 0
# Set GPIO 17 (wiringPi pin 0) to high
gpio write 0 1
wiringpi can be installed with
sudo dietpi-software install 70
I think the problem here is, that sysfs is deprecated and wiringPi is just a wrapper for sysfs.
See: https://www.thegoodpenguin.co.uk/blog/stop-using-sys-class-gpio-its-deprecated/
and https://github.com/WiringPi/WiringPi/issues/186
and https://github.com/MichaIng/DietPi/issues/6993
@Jappe If you look at Releases · WiringPi/WiringPi · GitHub at version 3.4 there is written New Kernel GPIO device Interface (replaces sysfs functions)
. So i think it is fixed already.
Oh nice, I didn’t know that.
Thankings for pointing out.
hi,
thank you. Everything is perfect. I move on to the installation of ‘home assistant’.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.