What environment variables do I need to change to allow pigpio to connect to a raspberry pi remotely?

326 Views Asked by At

I am using the gpiozero and pigpio libraries to create a remote gpio control application in python. The pigpio documentation advertises this as a feature, so I know it's possible. Here is the problem with this example code:

import gpiozero as zero
import pigpio as io
testrun = io.pi("greenhousedatalogger")
led = zero.LED(26)
led.blink()

Yes, I have made sure the pigpio daemon is started on the pi. here are the error codes. I'm not sure if I need to provide them all, but I dont know what is necessarily critical to solve this problem.:


Did you start the pigpio daemon? E.g. sudo pigpiod

Did you specify the correct Pi host/port in the environment
variables PIGPIO_ADDR/PIGPIO_PORT?
E.g. export PIGPIO_ADDR=soft, export PIGPIO_PORT=8888

Did you specify the correct Pi host/port in the
pigpio.pi() function? E.g. pigpio.pi('soft', 8888)

venv\lib\site-packages\gpiozero\devices.py:288: PinFactoryFallback: Falling back from rpigpio: No module named 'RPi' warnings.warn(

venv\lib\site-packages\gpiozero\devices.py:288: PinFactoryFallback: Falling back from lgpio: No module named 'lgpio' warnings.warn(

\venv\lib\site-packages\gpiozero\devices.py:288: PinFactoryFallback: Falling back from rpio: No module named 'RPIO' warnings.warn(

\venv\lib\site-packages\gpiozero\devices.py:288: PinFactoryFallback: Falling back from pigpio: failed to connect to localhost:8888 warnings.warn(

\venv\lib\site-packages\gpiozero\devices.py:288: PinFactoryFallback: Falling back from native [Errno 2] No such file or directory: '/proc/cpuinfo' warnings.warn(

Traceback (most recent call last):
\PycharmProjects\pigpio test\main.py", line 5, in <module> led = zero.LED(26)

\PycharmProjects\pigpio test\venv\lib\site-packages\gpiozero\devices.py", line 108, in __call__
    self = super(GPIOMeta, cls).__call__(*args, **kwargs)

\PycharmProjects\pigpio test\venv\lib\site-packages\gpiozero\output_devices.py", line 200, in __init__ super(DigitalOutputDevice, self).__init__(

\PycharmProjects\pigpio test\venv\lib\site-packages\gpiozero\output_devices.py", line 83, in __init__ super(OutputDevice, self).__init__(pin, pin_factory=pin_factory)

\PycharmProjects\pigpio test\venv\lib\site-packages\gpiozero\mixins.py", line 85, in __init__ 
super(SourceMixin, self).__init__(*args, **kwargs)

\PycharmProjects\pigpio test\venv\lib\site-packages\gpiozero\devices.py", line 540, in __init__
    super(GPIODevice, self).__init__(**kwargs)

\PycharmProjects\pigpio test\venv\lib\site-packages\gpiozero\devices.py", line 250, in __init__
    Device.pin_factory = Device._default_pin_factory()
\PycharmProjects\pigpio test\venv\lib\site-packages\gpiozero\devices.py", line 291, in _default_pin_factory raise BadPinFactory('Unable to load any default pin factory!')
gpiozero.exc.BadPinFactory: Unable to load any default pin factory!

Can't connect to pigpio at localhost(8888)

Did you start the pigpio daemon? E.g. sudo pigpiod

Did you specify the correct Pi host/port in the environment
variables PIGPIO_ADDR/PIGPIO_PORT?
E.g. export PIGPIO_ADDR=soft, export PIGPIO_PORT=8888

Did you specify the correct Pi host/port in the
pigpio.pi() function? E.g. pigpio.pi('soft', 8888)

Process finished with exit code 1

I've read that this has to do with some environment variables somewhere, but I've found no good sources for how to change them and get it to work. How do I change the right system variables and get my raspberry pi's hostname to be usable to other devices on a network?

0

There are 0 best solutions below