GPIO deprecated method?
Moderator: leecollings
-
homeJLB
- Posts: 154
- Joined: Tuesday 16 October 2018 23:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.7
- Location: Belgium
- Contact:
GPIO deprecated method?
in the wiki it says "use sysfs as a prefered method" now since linux 4.8 the GPIO sysfs interface is deprecated.
the "new" method is libgpiod.
What method is the best?
For now i'm using sysfs and I nothis sometimes the status is not up-to-date to the pin state as input.
Is there a common method in use or must the wiki-page been updated?
Thanks for your thoughts
the "new" method is libgpiod.
What method is the best?
For now i'm using sysfs and I nothis sometimes the status is not up-to-date to the pin state as input.
Is there a common method in use or must the wiki-page been updated?
Thanks for your thoughts
- waltervl
- Posts: 7029
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2026.3
- Location: NL
- Contact:
Re: GPIO deprecated method?
I think Domoticz itself has to be updated first to use the new libgpiod method. After that the wiki can be updated.
As it looks sysfs is still not really deprecated.
As it looks sysfs is still not really deprecated.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
Pchatill
- Posts: 36
- Joined: Wednesday 16 September 2015 5:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: v2026.2
- Location: France
- Contact:
Re: GPIO deprecated method?
Hello.
libgpiod works fine for me.
But only for outputs?
I didn't see any information to define a pin as Input.
libgpiod works fine for me.
But only for outputs?
I didn't see any information to define a pin as Input.
-
Rik60
- Posts: 235
- Joined: Sunday 25 June 2023 21:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2026.3
- Location: The Netherlands
- Contact:
Re: GPIO deprecated method?
Sysfs is still working. But if Domoticz is changing from SysV to systemd (perhaps in the future) you can have problems. At the moment is libgpiod working in Domoticz, it can control inputs and outputs. At the moment there are a few plugins that can handle libgpiod.
At the moment am i testing a plugin created by AI that is controlling 8 outputs and that is using libgpiod. Running on a Rpi3B+ Trixie. This plugin must be able to read inputs, but did not test that.
At the moment am i testing a plugin created by AI that is controlling 8 outputs and that is using libgpiod. Running on a Rpi3B+ Trixie. This plugin must be able to read inputs, but did not test that.
-
Pchatill
- Posts: 36
- Joined: Wednesday 16 September 2015 5:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: v2026.2
- Location: France
- Contact:
Re: GPIO deprecated method?
Thanks Rik60 for your answer.
But I didn't understand exactly what you mean:
For outputs ,this is:
But I didn't find anything for inputs
Thanks
But I didn't understand exactly what you mean:
At the moment is libgpiod working in Domoticz, it can control inputs and outputs
If it's working (or if I want to test), what is the configuration file format?This plugin must be able to read inputs, but did not test that.
For outputs ,this is:
Code: Select all
{
"gpio_pins": [5, 6, 13, 16, 19, 20, 21, 26],
"relay_logic": "active_low",
"gpio_chip": "gpiochip0",
"relay_names": [
"Relay 1",
"Relay 2",
"Relay 3",
"Relay 4",
"Relay 5",
"Relay 6",
"Relay 7",
"Relay 8"
]
}Thanks
-
Rik60
- Posts: 235
- Joined: Sunday 25 June 2023 21:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2026.3
- Location: The Netherlands
- Contact:
Re: GPIO deprecated method?
Thats right. The plugin you use can only control outputs. You can't select inputs with the plugin. You need (or write) another plugin for controlling inputs, like i did.
-
Pchatill
- Posts: 36
- Joined: Wednesday 16 September 2015 5:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: v2026.2
- Location: France
- Contact:
Re: GPIO deprecated method?
And can you share your plugin?
I'm not able to do that...
I'm not able to do that...
-
Rik60
- Posts: 235
- Joined: Sunday 25 June 2023 21:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2026.3
- Location: The Netherlands
- Contact:
Re: GPIO deprecated method?
I am not a programmer, so AI did it for me, and for me this is working. I only use 8 outputs but the plugin must be able to handle inputs, did not test that. There is a read_me.txt file how to install it (unzip first).
The plugin is not at github at the moment, it's only for testing now. Please let me know the results.
Advice: make a backup first.
The plugin is not at github at the moment, it's only for testing now. Please let me know the results.
Advice: make a backup first.
- Attachments
-
- Domoticz-Universal_GPIO.jpg (32.65 KiB) Viewed 70363 times
-
- Domoticz-Universal-GPIO.zip
- (2.9 KiB) Downloaded 4831 times
-
Pchatill
- Posts: 36
- Joined: Wednesday 16 September 2015 5:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: v2026.2
- Location: France
- Contact:
Re: GPIO deprecated method?
Thanks a lot for sharing.
I Have some errors:
I Have some errors:
2026-03-13 18:52:06.556 Error: GPIO: (Domoticz_GPIO_8) failed to load 'plugin.py', Python Path used was '/home/pchatill/domoticz/plugins/Domoticz-Universal-GPIO/:/usr/lib/python313.zip:/usr/lib/python3.13:/usr/lib/python3.13/lib-dynload:/usr/local/lib/python3.13/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.13/dist-packages'.
2026-03-13 18:52:06.560 Error: GPIO: Traceback (most recent call last):
2026-03-13 18:52:06.560 Error: GPIO: File "/home/pchatill/domoticz/plugins/Domoticz-Universal-GPIO/plugin.py", line 19, in <module>
2026-03-13 18:52:06.560 Error: GPIO: import gpio_config as cfg
2026-03-13 18:52:06.560 Error: GPIO: File "/home/pchatill/domoticz/plugins/Domoticz-Universal-GPIO/gpio_config.py", line 20, in <module>
2026-03-13 18:52:06.560 Error: GPIO: [24, "GpioIn24", "in", "None", down]
2026-03-13 18:52:06.560 Error: GPIO: ^^^^
2026-03-13 18:52:06.560 Error: GPIO: NameError: name 'down' is not defined
-
Rik60
- Posts: 235
- Joined: Sunday 25 June 2023 21:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2026.3
- Location: The Netherlands
- Contact:
Re: GPIO deprecated method?
Please remove the " around None, down must have them:
Code: Select all
[24, "GpioIn24", "in", None, "down"]
-
Pchatill
- Posts: 36
- Joined: Wednesday 16 September 2015 5:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: v2026.2
- Location: France
- Contact:
Re: GPIO deprecated method?
Sorry for the mistake Rik60
I just do a small test with an Input an 3 outputs: It work'fine now!!
Thanks a lot!!
Please feel free to ask me more tests (With this plugin or with an update)
With private message if you prefer
Patrick
I just do a small test with an Input an 3 outputs: It work'fine now!!
Thanks a lot!!
Please feel free to ask me more tests (With this plugin or with an update)
With private message if you prefer
Patrick
-
Rik60
- Posts: 235
- Joined: Sunday 25 June 2023 21:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2026.3
- Location: The Netherlands
- Contact:
Re: GPIO deprecated method?
Thanks for testing
I also have added 2 inputs in the config file, after a domoticz service restart i found them in the device list.
I also have added 2 inputs in the config file, after a domoticz service restart i found them in the device list.
-
Pchatill
- Posts: 36
- Joined: Wednesday 16 September 2015 5:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: v2026.2
- Location: France
- Contact:
Re: GPIO deprecated method?
I have a question:
Is your script will be able to manage a GPIO extension with I2C (Or SPI)?
This one, only for example:
Is your script will be able to manage a GPIO extension with I2C (Or SPI)?
This one, only for example:
Thanks
-
Rik60
- Posts: 235
- Joined: Sunday 25 June 2023 21:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2026.3
- Location: The Netherlands
- Contact:
Re: GPIO deprecated method?
No, it only can handle inputs and outputs. Sadly no I2C or SPI
-
Rik60
- Posts: 235
- Joined: Sunday 25 June 2023 21:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2026.3
- Location: The Netherlands
- Contact:
Re: GPIO deprecated method?
For I2C and SPI you can check the Domoticz wikiRik60 wrote: Saturday 14 March 2026 18:11 No, it only can handle inputs and outputs. Sadly no I2C or SPI
-
mgugu
- Posts: 238
- Joined: Friday 04 November 2016 12:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: France
- Contact:
Re: GPIO deprecated method?
Brilliant solution ! Personnally I wrote an external Python script (also with Anthropic AI help) which handle GPIO and create MQTT AD message to use it with anything. This works fine, but I got an issue when I switched from Bookworm (libgpio v1.x) to Trixie (libgpio v2.x) due to that API's are not compatible and the script had to be modified. Hope ascendant compatibility will be assured for further evolutions.