I'm tring to build Home automation app, and I try to find ( unsuccessfully ) any code/ documentation for controling GPIO's of other RPI's, using Python.

Any leads ?


2 Answers 2


pigpio allows for the control of multiple Pi's GPIO from one or more Pis.

Your Python program must import pigpio and create one or more instances of the pigpio.pi class. This class gives access to a specified Pi's GPIO.


pi1 = pigpio.pi()       # pi1 accesses the local Pi's GPIO
pi2 = pigpio.pi('tom')  # pi2 accesses tom's GPIO
pi3 = pigpio.pi('dick') # pi3 accesses dick's GPIO

pi1.write(4, 0) # set local Pi's GPIO 4 low
pi2.write(4, 1) # set tom's GPIO 4 to high
pi3.read(4)     # get level of dick's GPIO 4
  • is 'tom' and 'dick' RPI's hostnames ? can it be replaced with IP ?
    – guyd
    Commented Jul 24, 2017 at 9:04
  • 1
    Yes, 'tom' and 'dick' are host names and may be replaced by a dotted IP address, e.g. '' (still need the quotes).
    – joan
    Commented Jul 24, 2017 at 10:33
  • i get an error "ImportError: No module named 'gpiozero.pins.pigpio'" what is needed to install this module ?
    – guyd
    Commented Jul 24, 2017 at 14:07
  • 1
    Try the command man pigpio. If that works it means pigpio is installed. If not, for Raspbian, use sudo apt-get install pigpio python-pigpio python3-pigpio. For other distributions use the instructions at abyz.co.uk/rpi/pigpio/download.html.
    – joan
    Commented Jul 24, 2017 at 15:10
  • correct me if i'm wrong- but your answer and steve's are different, since yours uses pigpio module and steve's answer uses from gpiozero.pins.pigpiod import PiGPIOPin and need to run a daemon pigpiod. if so - what is the difference ?
    – guyd
    Commented Jul 26, 2017 at 7:48

As @Steve Robillard commented- the answer is found in: https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=160310

or more specific answer( from his link ) http://bennuttall.com/whats-new-gpio-zero-v1-3/

  • 1
    gpiozero implements the remote host as a wrapper around pigpio. gpiozero provides similar wrappers (without the remote host ability currently) around most of the Python GPIO libraries and offers an extensive suite of worked solutions.
    – joan
    Commented Jul 24, 2017 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.