Push Button physical GPIO

Moderator: leecollings

Post Reply
NoProfesor
Posts: 17
Joined: Wednesday 10 October 2018 21:46
Target OS: -
Domoticz version:
Contact:

Push Button physical GPIO

Post by NoProfesor »

How to set the physical button in domoticz, so that: press, change status to ON, press again, change status to OFF.
Something like, press to turn it on if it's off, press to turn off if it is switched on,
Input GPIO 16
output GPIO 22
How to configure raspberry?
NoProfesor
Posts: 17
Joined: Wednesday 10 October 2018 21:46
Target OS: -
Domoticz version:
Contact:

Re: Push Button physical GPIO

Post by NoProfesor »

It be correct?
1 step.
sudo nano /etc/init.d/domoticz.sh
/usr/local/bin/gpio export 16 in
/usr/local/bin/gpio edge 16 both
2 step.
Connect switch PIN 1 with PIN 36 (GPIO 16) with the resistor
NoProfesor
Posts: 17
Joined: Wednesday 10 October 2018 21:46
Target OS: -
Domoticz version:
Contact:

Re: Push Button physical GPIO

Post by NoProfesor »

Configure at startup.
You can do so by adding the lines you would like to use to the 'rc.local'.
Type: sudo nano /etc/init.d/domoticz.sh to edit the file Go to the end of the file, and just add after ':' place your commands.
#Run export GPIO Raspberry
/usr/local/bin/gpio export 16 in
/usr/local/bin/gpio edge 16 both

Inside Domoticz

You need first to declare the GPIO port in Domoticz. To do so, go to the "Hardware" tab, type in a name like "GPIO Port" and select "Raspberry's GPIO Port" as type, then click add.
Next, go to the "Switches" tab, and for each GPIO pin, click "Manual Light/Switch" and proceed as follows:

For inputs
Select the GPIO port hardware you just configured, give it a name, select the "Contact" switch type and a "GPIO" type. You can now select the pin in the list. Obviously, the ones you configured above should not start with the "! NON EXPORTED" mention. Then click "Add Device". The mention "open/closed" corresponds to a switch connected between the pin and the ground, with the pin also connected to a pull-up (as you have read on the wiringPi website, some GPIO have an internal permanent pull-up.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest