[351] SysFS Linux GPIO

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

[351] SysFS Linux GPIO

Post by nayr »

Creating thread as requested in tracker: http://www.domoticz.com/forum/tracker.php?p=2&t=351

GPIO States can be read and changed via filesystem layer: /sys/class/gpio/gpioXX/value without requiring specific additional GPIO libraries for hardware already supported by any modern Linux Kernel. When supported by the hardware Interrupts can be used with these devices to trigger changes without polling.. I dont know if there is any good way to tell if a GPIO will work wit interrupts so it will likely need to be a configurable option (polling vs interupt)

IMHO the current GPIO support needs to abandon the WiringPI Libraries which are applicable to only PI devices and go straight for GPIO access without additional libraries.. Setting up SysFS should be done externally from domoticz and it should use what ever is available.

the gpio paths should be able to be mapped to header labels, this could be as simple as an alias name within the UI.. such as gpio27 = P8_12

SysFS also supports PWM Outputs via run, duty_ns and period_ns files, in domoticz these could be the equivalent of GPIO "Dimmers"

I believe this to be critical functionality that is missing from Domoticz, with proper support anything that can run linux with GPIO's could be utilized as a Domoticz server/node, limited to only what the kernel supports.. for example i2c or spi IO expanders
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
User avatar
gizmocuz
Posts: 2548
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: [351] SysFS Linux GPIO

Post by gizmocuz »

Would be great!, Could you propose a git pull/patch request?
Quality outlives Quantity!
Bikey
Posts: 331
Joined: Sunday 22 February 2015 12:19
Target OS: Linux
Domoticz version: 2020.x
Location: Netherlands
Contact:

Re: [351] SysFS Linux GPIO

Post by Bikey »

Considering the problems/bugs some of us have with the current GPIO implementatio (even on an RPI), I will certainly welcome a more solid approach and a rewrite of the code!
I hope someone in the community - I'm not a programmer - can see a nice challenge here ;-)
User avatar
gizmocuz
Posts: 2548
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: [351] SysFS Linux GPIO

Post by gizmocuz »

not many response here .... could be great
Quality outlives Quantity!
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: [351] SysFS Linux GPIO

Post by nayr »

agreed, its disappointing that Domoticz has became RPI centric.

I think I might have found a way, using the MQTT interface..
see: https://github.com/kylegordon/mqtt-gpio-trigger

I think I might be able to write a nodejs daemon that monitors GPIO's and publishes them right to domoticz without the need for any red5 mapping..

This seems like a much better way than banging around on virtual devices using json requests and trying to prevent feedback loops.

The MQTT documentation has me scratching my head, think its going to take me a bit to get my head around it.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
esberg
Posts: 1
Joined: Friday 01 August 2014 23:39
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Aachen

Re: [351] SysFS Linux GPIO

Post by esberg »

I have been running Domoticz with GPIO in various applications on different Raspberry Pi's for years. When I updated one Pi to Bookworm, I realized that “sysfs” and the “easy way” to use GPIO in Domoticz no longer work under the Bookworm operating system.
I have learned a lot from reading this forum, thanks for that.
But there doesn't seem to be an easy way yet. Then I thought about the following:

I installed MQTT and Node RED on the Raspberry Pi, for example to integrate data from the solar system into Domoticz. So why not use Node Red to address the GPIO? It was quickly programmed. Node Red offers ready-made nodes for setting or reading the bits in the GPIO and the data can be easily exchanged between Domoticz and Node Red via MQTT!
Esberg
Domoticz-User since 2014, Germany
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest