Page 1 of 1

Newbie: Help needed on Domoticz GPIO

Posted: Saturday 09 February 2019 16:48
by steve01
Hi folks, just started on Domoticz-Raspberry Pi. Great stuff.
Now I want to read a GPIO pin.

Followed the https://www.domoticz.com/wiki/GPIO but cannot get to read an input.

I used the SYSFS methode in the wiki for exporting a pin

echo 4 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio4/direction

Added Generic sysfs GPIO in the Domoticz hardware. Now when I add a manual switch with sysfs hardware using "type: Sysfs GPIO" I get "Sysfs GPIO: No sysfs-gpio exports" and cannot select any pin there.

Seems the export is not correct any ideas?

Re: Newbie: Help needed on Domoticz GPIO

Posted: Monday 11 February 2019 1:06
by steve01
anybody?

Re: Newbie: Help needed on Domoticz GPIO

Posted: Monday 18 February 2019 11:14
by q3q3
Hi,

I have used the same method for GPIO 21. I connected the PIR sensor to the 21st pin and it works correctly - it changes status in Domoticz.
One issue (mentioned in wiki), to make it work after the reboot you have to place appropriate records in the rc.local or domoticz.sh file.
This is something that I have a problem with. Placing such (for example: echo 4 > /sys/class/gpio/export) text in the domoticz.sh causes error. Probably something is missing in the script, but I I haven't figured this out. Maybe someone could help with this.

Maybe you rebooted your pi before testing your GPIO port?

Re: Newbie: Help needed on Domoticz GPIO

Posted: Friday 01 March 2019 9:10
by q3q3
OK, resolved.
The export of GPIO pin, for example

echo 4 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio4/direction


should be added to the domoticz.sh file placed in the /etc/init.d/ directory.
After this everything works fine. Initially, I thought that domoticz.sh placed in the /~/domoticz/directory should be modified, but after some checks, I realized my mistake.