Page 1 of 1
Rpi5 Domoticz GPIO config
Posted: Sunday 07 January 2024 14:15
by Wimpi
I have an Rpi3B, with Buster OS and Domoticz
Bought an Rpi5, put Bookworm OS (64bit) on USB 3 and runs on stick.
Installed Domoticz and placed a backup of my 3B on the 5.
Now also know that wiringpi, which I worked with with Domoticz on my 3B, does not work on the Rpi5...
The fact that I do this best via SysFS or something is new to me and I can't get it right at all...
This is what I note in the domoticz sh file, for GPIO 5, relay control on/off in Domoticz:
echo 5 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio5/direction
echo 0 > /sys/class/gpio/gpio5/value
But every time I want to add a switch (GPIO 5) in Domoticz, I see No-sysfs-GPIO exports
When I run 'dmesg'
I see in the list: export_store: invalid GPIO5
Do I need to configure the ports before installing Domoticz?
What am I doing wrong?
Someone who can help me or just with a new better step-by-step plan to make Domoticz work on my Rpi5 as it does on my 3B
Thank you in advance for your time.
Re: Rpi5 Domoticz GPIO config
Posted: Sunday 07 January 2024 17:10
by willemd
You are aware that the Rpi 5 has a different way of handling GPIO when compared to all previous Pi's ?
Probably best to ask at the raspberry pi forums whether you can still use sysfs or what you should do to still use it. (it seems deprecated)
I think the domoticz documentation has not been updated yet for the Raspberry Pi 5.
Maybe this link helps?
https://lloydrochester.com/post/hardwar ... intro-rpi/
Re: Rpi5 Domoticz GPIO config
Posted: Sunday 07 January 2024 19:35
by Wimpi
Yes indeed, I have already read it.
That's why I'm having a bit of a problem with the GPIO.
I saw on the Raspberry site that it does work with GPIOzero.
But how do we integrate that...
And yes, the Domoticz site is not yet up to date.
I'll give it a try, wait and see...
Thanks for the link, please read it carefully and try it.
Re: Rpi5 Domoticz GPIO config
Posted: Sunday 07 January 2024 20:06
by willemd
Since the sysfs commands are command-line commands to set/get gpio pins, the libgpiod seems to be a good alternative. The LED example provided seems also usable for your relay. I don't see separate commands for configuring the pin as output or input, so it seems this is automatically included in using gpioset or gpioget.
Re: Rpi5 Domoticz GPIO config
Posted: Sunday 14 January 2024 12:42
by luckymr2201
Hello, I hope I am writting this question in the right section.
I have a rpi4B running with latest stable released Domoticz (2024.01)which among other things is using GPIO (pin 4) to detect if someone attempt to ring the bell at the entrance of my house.
This works very well using GPIO Sysfs and this declaration made at each boot:
sudo sh -c 'echo 4 > /sys/class/gpio/export'
sudo sh -c 'echo in > /sys/class/gpio/gpio4/direction'
sudo sh -c 'echo both > /sys/class/gpio/gpio4/edge'
My surprise comes from the rpi5 ). I found on it the gpio are completely changed but after many tries and error, it seems converting my 3 lines from the pi4 to:
sudo sh -c 'echo 403 > /sys/class/gpio/export'
sudo sh -c 'echo in > /sys/class/gpio/gpio403/direction'
sudo sh -c 'echo both > /sys/class/gpio/gpio403/edge'
gives the expected result at least using commands to check the state of my gpio:
pi@Pie5B:~ $ cat /sys/class/gpio/gpio403/value
1
pi@Pie5B:~ $ cat /sys/class/gpio/gpio403/value
0
pi@Pie5B:~ $ cat /sys/class/gpio/gpio403/value
0
pi@Pie5B:~ $ cat /sys/class/gpio/gpio403/value
1
The problem seems to come from Domoticz where it seems to detect 2 entries but none are working (change state when I put my GPIO to ground):
Has anyone already successfully used GPIO on Pi5 with Domoticz ? I read here and there that everything changed that Sysfs is depreciated but I see no alternative to it and second I get the impression the sysfs works when I run the command for my GPIO from a terminal so cannot see why Domoticz would not work.
Any help will be greatly apprecaited.
Re: Rpi5 Domoticz GPIO config
Posted: Saturday 20 January 2024 9:18
by Wimpi
We have to wait …
But I hope anyone will find a solution

Re: Rpi5 Domoticz GPIO config
Posted: Saturday 03 February 2024 16:20
by elgringo
I got simular issues on a pi 5 with bookworm
I have connect a doorbell on GPIO 26 (pin 37)
With the file /sys/kernel/debug/gpio file I figured out it was gpio425.
Configured and hooked it up, domoticz did found gpio425:

- Naamloos.png (8.2 KiB) Viewed 2401 times
Logging also seems to detect something:
Code: Select all
2024-02-03 15:56:53.028 Status: GPIO: Startup - polling:no interrupts:yes debounce:10msec inputs:1 outputs:0
2024-02-03 15:56:53.028 Status: GPIO: Edge detection started
2024-02-03 16:00:45.441 GPIO: Lighting 2 (Input)
2024-02-03 16:00:45.480 Status: GPIO: gpio425 new state = on
But the doorbell devices remains 'off'
Re: Rpi5 Domoticz GPIO config
Posted: Saturday 03 February 2024 16:35
by elgringo
Re: Rpi5 Domoticz GPIO config
Posted: Saturday 03 February 2024 18:09
by HvdW
sysfs is deprecated in bookworm.
For buster ande everything preceding it there is this sysfs setup.
In ~/scripts there is this file named sysfs-inti.sh
Code: Select all
#! /bin/sh
#-----------------------------------------------------------------------------
# Init sysfs GPIO ports
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# unexport
#
#echo 4 > /sys/class/gpio/unexport
#echo 12 > /sys/class/gpio/unexport
#echo 13 > /sys/class/gpio/unexport
#-----------------------------------------------------------------------------
# export
#
echo 17 > /sys/class/gpio/export
echo 18 > /sys/class/gpio/export
#echo 22 > /sys/class/gpio/export
#-----------------------------------------------------------------------------
# Set direction = in
#
# echo in > /sys/class/gpio/gpio4/direction
echo out > /sys/class/gpio/gpio17/direction
echo out > /sys/class/gpio/gpio18/direction
#echo out > /sys/class/gpio/gpio22/direction
#-----------------------------------------------------------------------------
# Set active_low = 0 (false)
#
# echo 0 > /sys/class/gpio/gpio4/active_low
echo 1 > /sys/class/gpio/gpio17/active_low
echo 1 > /sys/class/gpio/gpio18/active_low
#echo 1 > /sys/class/gpio/gpio22/active_low
#-----------------------------------------------------------------------------
# Set edges = none
#
# echo none > /sys/class/gpio/gpio4/edge
#-----------------------------------------------------------------------------
# Set pullups
#
# raspi-gpio set 4 pu
#raspi-gpio set 11 dl
#raspi-gpio set 12 dl
#-----------------------------------------------------------------------------
In /etc/rc.local place this line before the exit statement, to be executed @startup
Re: Rpi5 Domoticz GPIO config
Posted: Tuesday 20 February 2024 15:13
by Wimpi
With a sh script can I set my GPIO for my outputs, relay.
So I can set the gpio one or zero
Code: Select all
#!/bin/bash
sudo gpioset gpiochip4 10=1
But what I don’t know, is how I can read a GPIO continuously for check soms alarms, inputs.
That doesn’t work with a sh script in Domoticz I believe.
I think I need a Python script within Domoticz for read a GPIO pin.
But don’t know how to begin.
I have to set first the GPIO pin as a input, low or high at startup.
Someone could give soms hints or what should I do?
Re: Rpi5 Domoticz GPIO config
Posted: Tuesday 23 July 2024 11:31
by vwstepha
Hello everyone!!
Still no solution for GPIO, even in version 2024.7?
It's really a shame. I use 5 GPIO on my RPi.
Thank you for your help!
Re: Rpi5 Domoticz GPIO config
Posted: Tuesday 23 July 2024 11:51
by waltervl