Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while setting up platform remote_rpi_gpio #27724

Closed
ashtonsmith opened this issue Oct 16, 2019 · 65 comments · Fixed by #53108
Closed

Error while setting up platform remote_rpi_gpio #27724

ashtonsmith opened this issue Oct 16, 2019 · 65 comments · Fixed by #53108

Comments

@ashtonsmith
Copy link

Home Assistant V 0.100.2 hass.io installation

Description of problem:
After updating (didn't think to take a snapshot) remote_rpi_gpio can not set up

Problem-relevant configuration.yaml:

binary_sensor:
  - platform: remote_rpi_gpio
    host: 192.168.1.84
    ports:
      27: Single Garage
      13: Double Garage
      04: Media Room
      21: Entranceway
      22: Kitchen
      23: Loungeroom
      12: Laundry
      20: Sensor 20
      19: Sensor 19
    invert_logic: true

Logfile output:

Error while setting up platform remote_rpi_gpio
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/remote_rpi_gpio/binary_sensor.py", line 52, in setup_platform
    address, port_num, pull_mode, bouncetime
  File "/usr/src/homeassistant/homeassistant/components/remote_rpi_gpio/__init__.py", line 48, in setup_input
    pin_factory=PiGPIOFactory(address),
  File "/usr/local/lib/python3.7/site-packages/gpiozero/devices.py", line 124, in __call__
    self = super(GPIOMeta, cls).__call__(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/gpiozero/input_devices.py", line 432, in __init__
    bounce_time=bounce_time, pin_factory=pin_factory)
  File "/usr/local/lib/python3.7/site-packages/gpiozero/mixins.py", line 383, in __init__
    super(HoldMixin, self).__init__(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/gpiozero/input_devices.py", line 188, in __init__
    self._fire_events(self.pin_factory.ticks(), self.is_active)
  File "/usr/local/lib/python3.7/site-packages/gpiozero/mixins.py", line 368, in _fire_events
    self._fire_activated()
  File "/usr/local/lib/python3.7/site-packages/gpiozero/mixins.py", line 398, in _fire_activated
    self._hold_thread.holding.set()
AttributeError: 'NoneType' object has no attribute 'holding'

I have tried setting environment variables, however this is not helping, and the error does not specifically state that it could not set the pinfactory (like it used to)

Thanks

@pergolafabio
Copy link

i have the same error

restarting hassio helps, then error is gone, restarting again, error is back, so its random ...

2019-10-16 20:02:45 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up platform remote_rpi_gpio
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/remote_rpi_gpio/binary_sensor.py", line 52, in setup_platform
    address, port_num, pull_mode, bouncetime
  File "/usr/src/homeassistant/homeassistant/components/remote_rpi_gpio/__init__.py", line 48, in setup_input
    pin_factory=PiGPIOFactory(address),
  File "/usr/local/lib/python3.7/site-packages/gpiozero/devices.py", line 124, in __call__
    self = super(GPIOMeta, cls).__call__(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/gpiozero/input_devices.py", line 432, in __init__
    bounce_time=bounce_time, pin_factory=pin_factory)
  File "/usr/local/lib/python3.7/site-packages/gpiozero/mixins.py", line 383, in __init__
    super(HoldMixin, self).__init__(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/gpiozero/input_devices.py", line 188, in __init__
    self._fire_events(self.pin_factory.ticks(), self.is_active)
  File "/usr/local/lib/python3.7/site-packages/gpiozero/mixins.py", line 368, in _fire_events
    self._fire_activated()
  File "/usr/local/lib/python3.7/site-packages/gpiozero/mixins.py", line 398, in _fire_activated
    self._hold_thread.holding.set()
AttributeError: 'NoneType' object has no attribute 'holding'

@pergolafabio
Copy link

pergolafabio commented Oct 16, 2019

i reverted to 1.5.0 dependency , loaded it as a custom, but its the same
running the old 1.4.1 dependency gives back to badpinfactory error offcourse

@pergolafabio
Copy link

pergolafabio commented Oct 17, 2019

hi @jgriff2 , are you codeowner? can you have a look at this issue? its very annoying, i have to restart hassio untill it works

thnx a lot!

@ashtonsmith
Copy link
Author

@pergolafabio in the meantime, if you load as custom, set the dependency to 1.4.1 , then log into your homeassistant container and add the below lines to /bin/entry.sh:

export GPIOZERO_PIN_FACTORY=pigpio
export PIGPIO_ADDR=YOUR_RPi_IP_ADDRESS

then restart home assistant twice, you should be good

@pergolafabio
Copy link

Is it failing because of the depency? Is there no easier fix then this for the badpinfactory? Because for that workaround , you need to do it on each hassio update?

@pergolafabio
Copy link

hi @ashtonsmith

i see several temp solutions, whats the difference with yours?
in total there are 3 temp solutions, not sure whats the best :)
in first one below, they add a port also, like 8888 , you do not?

from github issue : #25944

I was able to fix the problem temporarily using Kdemontf's fix on HassOS by installing the community's SSH & Web Terminal addon. I then turned off the terminal add-on's Protected Mode in order to gain Docker access, and went to the terminal to find/edit my Home Assistant Docker container:

docker container ls showed my list of Docker containers. I then found the container ID for Home Assistant, by looking for the container using the image qemux86-64-homeassistant.
I entered the container using docker exec -it <container id> bash.
I edited the /bin/entry.sh script, adding the line export GPIOZERO_PIN_FACTORY="mock" PIGPIO_ADDR="<rpi-ip-addr>:8888" after the set -e line.
I saved the file, and used CTRL-D to get back to the HassOS Supervisor container.
I committed my Docker container changes using docker commit <container id> homeassistant/qemux86-64-homeassistant.
I restarted Home Assistant.
This will of course break anytime Home Assistant gets updated. Hopefully the fix can be applied soon!

from community forums : https://community.home-assistant.io/t/remote-raspberry-pi-gpio/120306/45

#!/bin/bash
set -e

# add the line below
export GPIOZERO_PIN_FACTORY=mock

udevd --daemon
udevadm trigger

if CMD="$(command -v "$1")"; then
  shift
  exec "$CMD" "$@"
else
  echo "Command not found: $1"
  exit 1
fi

@damocles-git
Copy link

damocles-git commented Nov 14, 2019

It seems a problem related with HA, I have a raspberry pi zero w with the pigpiod daemon running and enabled for remote access, HA is running in an intel nuc.

Testing remote gpio access from the command line with the pinout tool, first it try to connecto to localhost:8888 and fails because environment variables are not configured:

(homeassistant) hass@nuc ~ $ hass --version
0.101.3
(homeassistant) hass@nuc ~ $ pip3 show  gpiozero | grep -i version
Version: 1.5.1
(homeassistant) hass@nuc ~ $ pip3 show -f gpiozero | grep pinout
  ../../../bin/pinout
  gpiozerocli/__pycache__/pinout.cpython-36.pyc
  gpiozerocli/pinout.py
(homeassistant) hass@nuc ~ $ 
(homeassistant) hass@nuc ~ $ pinout
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Unable to initialize GPIO Zero. This usually means that you are not running
pinout on a Raspberry Pi. If you still wish to run pinout, set the
GPIOZERO_PIN_FACTORY environment variable to 'mock' and retry, or refer to the
Remote GPIO section of the manual* to configure your environment to remotely
access your Pi.

* https://gpiozero.readthedocs.io/en/stable/remote_gpio.html

For further information, please refer to https://pinout.xyz/
(homeassistant) hass@nuc ~ $ 

now I set the environment variables:

(homeassistant) hass@nuc ~ $ export PIGPIO_ADDR=10.20.30.13 GPIOZERO_PIN_FACTORY=pigpio
(homeassistant) hass@nuc ~ $ pinout
.-------------------------.
| oooooooooooooooooooo J8 |
| 1ooooooooooooooooooo   |c
---+       +---+ PiZero W|s
 sd|       |SoC|   V1.1  |i
---+|hdmi| +---+  usb pwr |
`---|    |--------| |-| |-'

Revision           : 9000c1
SoC                : BCM2835
RAM                : 512Mb
Storage            : MicroSD
USB ports          : 1 (excluding power)
Ethernet ports     : 0
Wi-fi              : True
Bluetooth          : True
Camera ports (CSI) : 1
Display ports (DSI): 0

J8:
   3V3  (1) (2)  5V    
 GPIO2  (3) (4)  5V    
 GPIO3  (5) (6)  GND   
 GPIO4  (7) (8)  GPIO14
   GND  (9) (10) GPIO15
GPIO17 (11) (12) GPIO18
GPIO27 (13) (14) GND   
GPIO22 (15) (16) GPIO23
   3V3 (17) (18) GPIO24
GPIO10 (19) (20) GND   
 GPIO9 (21) (22) GPIO25
GPIO11 (23) (24) GPIO8 
   GND (25) (26) GPIO7 
 GPIO0 (27) (28) GPIO1 
 GPIO5 (29) (30) GND   
 GPIO6 (31) (32) GPIO12
GPIO13 (33) (34) GND   
GPIO19 (35) (36) GPIO16
GPIO26 (37) (38) GPIO20
   GND (39) (40) GPIO21

For further information, please refer to https://pinout.xyz/

even reading my remote i2c TSL2561 sensor works:

(homeassistant) hass@nuc ~ $ pigs i2co 1 0x39 0   i2cwd 0 0x80 0x03   i2cwd 0 0x81 0x02   mils 500   i2crd 0 0x8C   i2cc 0
0
140 2 0 0 0 0 0 0 128 1 80 4 9 0 5 0 51 2 0 0 0 0 0 0 128 1 80 4 9 0 5 0 51 2 0 0 0 0 0 0 128 1 80 4 9 0 5 0 51 2 0 0 0 0 0 0 128 1 80 4 9 0 5 0 51 2 0 0 0 0 0 0 128 1 80 4 9 0 5 0 51 2 0 0 0 0 0 0 128 1 80 4 9 0 5 0 51 2 0 0 0 0 0 0 128 1 80 4 9 0 5 0 51 2 0 0 0 0 0 0 128 1 80 4 9 0 5 0 51 2 0 0 0 0 0 0 128 1 80 4 9

now I start HA in the current shell with the same environment variables:

(homeassistant) hass@nuc ~ $ echo $PIGPIO_ADDR $GPIOZERO_PIN_FACTORY
10.20.30.13 pigpio
(homeassistant) hass@nuc ~ $ hass -v
Config directory: /home/users/hass/.homeassistant
2019-11-14 15:38:51 INFO (SyncWorker_1) [homeassistant.loader] Loaded script from homeassistant.components.script
2019-11-14 15:38:51 INFO (SyncWorker_4) [homeassistant.loader] Loaded light from homeassistant.components.light
2019-11-14 15:38:51 INFO (SyncWorker_3) [homeassistant.loader] Loaded influxdb from homeassistant.components.influxdb
[...]
2019-11-14 15:39:07 INFO (MainThread) [homeassistant.setup] Setting up remote_rpi_gpio
2019-11-14 15:39:07 INFO (MainThread) [homeassistant.setup] Setup of domain media_player took 3.6 seconds.
2019-11-14 15:39:07 INFO (MainThread) [homeassistant.setup] Setup of domain remote_rpi_gpio took 0.1 seconds.
2019-11-14 15:39:07 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.remote_rpi_gpio
2019-11-14 15:39:07 INFO (MainThread) [homeassistant.setup] Setup of domain group took 11.9 seconds.
2019-11-14 15:39:07 INFO (SyncWorker_4) [homeassistant.loader] Loaded nmap_tracker from homeassistant.components.nmap_tracker
2019-11-14 15:39:07 INFO (MainThread) [homeassistant.setup] Setting up script
2019-11-14 15:39:09 INFO (MainThread) [homeassistant.setup] Setting up automation
2019-11-14 15:39:09 INFO (MainThread) [homeassistant.setup] Setup of domain script took 1.7 seconds.
2019-11-14 15:39:10 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up platform remote_rpi_gpio
Traceback (most recent call last):
  File "/home/users/hass/homeassistant/lib64/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/lib64/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/users/hass/homeassistant/lib64/python3.6/site-packages/homeassistant/components/remote_rpi_gpio/binary_sensor.py", line 52, in setup_platform
    address, port_num, pull_mode, bouncetime
  File "/home/users/hass/homeassistant/lib64/python3.6/site-packages/homeassistant/components/remote_rpi_gpio/__init__.py", line 48, in setup_input
    pin_factory=PiGPIOFactory(address),
  File "/home/users/hass/homeassistant/lib64/python3.6/site-packages/gpiozero/devices.py", line 124, in __call__
    self = super(GPIOMeta, cls).__call__(*args, **kwargs)
  File "/home/users/hass/homeassistant/lib64/python3.6/site-packages/gpiozero/input_devices.py", line 432, in __init__
    bounce_time=bounce_time, pin_factory=pin_factory)
  File "/home/users/hass/homeassistant/lib64/python3.6/site-packages/gpiozero/mixins.py", line 383, in __init__
    super(HoldMixin, self).__init__(*args, **kwargs)
  File "/home/users/hass/homeassistant/lib64/python3.6/site-packages/gpiozero/input_devices.py", line 188, in __init__
    self._fire_events(self.pin_factory.ticks(), self.is_active)
  File "/home/users/hass/homeassistant/lib64/python3.6/site-packages/gpiozero/mixins.py", line 368, in _fire_events
    self._fire_activated()
  File "/home/users/hass/homeassistant/lib64/python3.6/site-packages/gpiozero/mixins.py", line 398, in _fire_activated
    self._hold_thread.holding.set()
AttributeError: 'NoneType' object has no attribute 'holding'
2019-11-14 15:39:10 INFO (MainThread) [homeassistant.setup] Setting up device_tracker

so it seems that HA is having a problem with the remote gpio component.

@GigiGat
Copy link

GigiGat commented Dec 2, 2019

I have the same error!
hassio version: 0.102.3

@dupondje
Copy link
Contributor

Had this here also. Guess the plugin needs some love :)

@scsi050
Copy link

scsi050 commented Jan 26, 2020

I get this error too, running hassio 0.103.5. No permenant fix at this point?

Sun Jan 26 2020 14:07:44 GMT-0600 (Central Standard Time)
Error while setting up platform remote_rpi_gpio
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/remote_rpi_gpio/binary_sensor.py", line 50, in setup_platform
    address, port_num, pull_mode, bouncetime
  File "/usr/src/homeassistant/homeassistant/components/remote_rpi_gpio/__init__.py", line 47, in setup_input
    pin_factory=PiGPIOFactory(address),
  File "/usr/local/lib/python3.7/site-packages/gpiozero/devices.py", line 124, in __call__
    self = super(GPIOMeta, cls).__call__(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/gpiozero/input_devices.py", line 432, in __init__
    bounce_time=bounce_time, pin_factory=pin_factory)
  File "/usr/local/lib/python3.7/site-packages/gpiozero/mixins.py", line 383, in __init__
    super(HoldMixin, self).__init__(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/gpiozero/input_devices.py", line 188, in __init__
    self._fire_events(self.pin_factory.ticks(), self.is_active)
  File "/usr/local/lib/python3.7/site-packages/gpiozero/mixins.py", line 368, in _fire_events
    self._fire_activated()
  File "/usr/local/lib/python3.7/site-packages/gpiozero/mixins.py", line 398, in _fire_activated
    self._hold_thread.holding.set()
AttributeError: 'NoneType' object has no attribute 'holding'

@andystewart999
Copy link

Yep - I'm getting this as well. It seems to be totally random... :-(

@andystewart999
Copy link

andystewart999 commented Feb 7, 2020

@balloob and @frenck - still an issue on 0.105.2, although not surprising as I didn't see anything relating to GPIO (remote or otherwise) in the change logs.

For my specific use case I'm trying to get a garage door relay to change and for the door to report its status - both super easy with GPIO as in fact you mention here. I was hoping that the addin being developed by @sp1k3ster that was ultimately rejected would solve my issues (as the remote part is easy to set up) but no joy.

I'm happy to try a master/slave HA scenario, also as referenced as being super easy by you @balloob but that seems like overkill to just integrate with GPIO... but I'll give it a whirl. I've done some Googling but apart from the MQTT EventStream stating it's to connect two HA instances together I haven't been able to find anything concrete re seeing pin changes and sending relay commands... is there any documentation?

Optimally remote_rpi_gpio will be fixed as that's by far the cleanest way of managing this specific garage door use case.

Thanks for your continued dev work on Home Assistant - I'm looking forward to working with it a lot over the upcoming months.

@ChrisB85
Copy link

ChrisB85 commented Mar 1, 2020

Same problem here. I'm trying to integrate PIR sensor from my RPI-based smart mirror.

@andystewart999
Copy link

@pergolafabio in the meantime, if you load as custom, set the dependency to 1.4.1 , then log into your homeassistant container and add the below lines to /bin/entry.sh:

export GPIOZERO_PIN_FACTORY=pigpio
export PIGPIO_ADDR=YOUR_RPi_IP_ADDRESS

then restart home assistant twice, you should be good

Revisiting this fix, which I've been using for a while, when upgrading to 0.107.x it looks like /bin/entry.sh has moved and I can't find it. Looking at the container data (I'm no expert) it looks like Init is just being called without any parameters.

I foolishly modified init directly and it bricked my installation, I had to revert to a snapshot.

For 0.107.x, which file should be modified to add those export lines?

@andystewart999
Copy link

andystewart999 commented May 27, 2020

So we're now on 0.110.3, and I've been using the same custom integration of RemoteGPIO since February. Now I'm starting to get deprecation issues regarding SwitchDevice and BinarySensorDevice so I'm getting worried about the older custom integration dying on me.

So I went totally native, ie no I removed the old remote GPIO integration and the 'None' error described above has come back. Also the current version of the RemoteGPIO addin is still using SwitchDevice, I expect that will get fixed up soon enough.

So I'm going to use the current version of RemoteGPIO, extract it back as a custom integration, change the manifest back to 1.4.1 and hope for the best - both now and in the long term as I'm really relying on RemoteGPIO for a few activities (garage door and aircon)

Cheers,
Andy

@frankiej911
Copy link

I have the same issue since the beginning of this year. I use my remote gpio to read the watermeter with a proximity sensor.

In the past some reboots of Hass fixes the problem and it was stable all the time (if I didn't restart Hass again). But since the last update and after many restarts the component won't start anymore...

@andystewart999
Copy link

andystewart999 commented Jun 24, 2020

Hi all, I've taken some steps to get this working for me and I've had good success so far.

I've created a brand new gpiozero package on PyPi, with only two differences to the original:

  • The pin factory is hardcoded to 'pigpio'
  • If the host isn't set, it hardcodes to an IP address that suits me (more on that later)

I've renamed it of course so it can be referenced in the manifest. So what I periodically do is grab the four files related to the remote_gpio integration from the home assistant core folder, save them in custom_components and then adjust the manifest to suit. That's far easier than my old fix of going into the container, making adjustments to gpiozero and then committing those changes.

Here's the manifest that works for me, note the new package:

{
  "domain": "remote_rpi_gpio",
  "name": "remote_rpi_gpio",
  "documentation": "https://www.home-assistant.io/integrations/remote_rpi_gpio",
  "requirements": ["gpiozero-ha==1.5.3"],
  "codeowners": []
}

Regarding the IP hardcoding, I've noticed that, intermittently, for some reason the binding didn't work (although that was with an older version of the integration). Check out these two lines, extracts from init.py:

    try:
        return Button(
            port,
            pull_up=pull_gpio_up,
            bounce_time=bouncetime,
            pin_factory=PiGPIOFactory(address),
        )

and

    try:
        return LED(
            port, active_high=not invert_logic, pin_factory=PiGPIOFactory(address)
        )
    except (ValueError, IndexError, KeyError):
        return None

Historically I changed the PiGPIOFactory instantiation by forcing the 'host' parameter rather than it being fed in as the first optional parameter. Looking at the current source code there's no reason why just inferring the first parameter shouldn't always work, but this fix works for me so I'm leaving it alone:

pin_factory=PiGPIOFactory(host=address)

So that's it - it works 100% of the time with the custom package versus less than 10% of the time with the built-in. Not ideal but neither is life so feel free to make use of this hack if you want.

All I need now is a way of restarting the remote_gpio integration without restarting the whole of HA, if I have to reboot one of my misbehaving Raspberry Pis. Any thoughts on that?

Cheers,
Andy

@svh1985
Copy link

svh1985 commented Aug 23, 2020

Same issue, Error while setting up remote_rpi_gpio platform for binary_sensor.

@2wenty2wo
Copy link

2wenty2wo commented Sep 28, 2020

I had it working last night but I restarted today and been getting the same error since.
Running Home Assistant 0.115.3 / HassOS 4.13.

Edit: This is a weird one. Randomly it started working again without me changing anything. I think it's because I restarted?
Edit 2: Just updated to Home Assistant 0.115.6 and because of the restart I'm getting the remote_rpi_gpio error again.

@scsi050
Copy link

scsi050 commented Oct 4, 2020

Still broken in 0.115.6 / HassOS 4.13 / Supervisor v245

Logger: homeassistant.components.binary_sensor
Source: components/remote_rpi_gpio/init.py:45
Integration: Binary sensor (documentation, issues)
First occurred: September 30, 2020, 4:45:34 PM (1 occurrences)
Last logged: September 30, 2020, 4:45:34 PM

Error while setting up remote_rpi_gpio platform for binary_sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 193, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/remote_rpi_gpio/binary_sensor.py", line 49, in setup_platform
button = remote_rpi_gpio.setup_input(
File "/usr/src/homeassistant/homeassistant/components/remote_rpi_gpio/init.py", line 45, in setup_input
return Button(
File "/usr/local/lib/python3.8/site-packages/gpiozero/devices.py", line 124, in call
self = super(GPIOMeta, cls).call(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/gpiozero/input_devices.py", line 430, in init
super(Button, self).init(
File "/usr/local/lib/python3.8/site-packages/gpiozero/mixins.py", line 383, in init
super(HoldMixin, self).init(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/gpiozero/input_devices.py", line 188, in init
self._fire_events(self.pin_factory.ticks(), self.is_active)
File "/usr/local/lib/python3.8/site-packages/gpiozero/mixins.py", line 368, in _fire_events
self._fire_activated()
File "/usr/local/lib/python3.8/site-packages/gpiozero/mixins.py", line 398, in _fire_activated
self._hold_thread.holding.set()
AttributeError: 'NoneType' object has no attribute 'holding'

@ficklma1
Copy link

ficklma1 commented Dec 1, 2020

Still broken!

@scsi050
Copy link

scsi050 commented Dec 7, 2020

HassOS 4.17 / 0.118.4 rpi_gpio started working for me out of the blue on Dec2 2020. Hadn't worked for nearly 12-months since now and I didn't change anything.

@slarti42
Copy link

slarti42 commented Dec 27, 2020

I tried setting this up on 2020.12.7 and seems to not work. Here's the log entry:

Logger: homeassistant.components.binary_sensor
Source: components/remote_rpi_gpio/init.py:41
Integration: Binary sensor (documentation, issues)
First occurred: 5:33:35 PM (1 occurrences)
Last logged: 5:33:35 PM
Error while setting up remote_rpi_gpio platform for binary_sensor

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 199, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/remote_rpi_gpio/binary_sensor.py", line 45, in setup_platform
button = remote_rpi_gpio.setup_input(
File "/usr/src/homeassistant/homeassistant/components/remote_rpi_gpio/init.py", line 41, in setup_input
return Button(
File "/usr/local/lib/python3.8/site-packages/gpiozero/devices.py", line 124, in call
self = super(GPIOMeta, cls).call(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/gpiozero/input_devices.py", line 430, in init
super(Button, self).init(
File "/usr/local/lib/python3.8/site-packages/gpiozero/mixins.py", line 383, in init
super(HoldMixin, self).init(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/gpiozero/input_devices.py", line 188, in init
self._fire_events(self.pin_factory.ticks(), self.is_active)
File "/usr/local/lib/python3.8/site-packages/gpiozero/mixins.py", line 368, in _fire_events
self._fire_activated()
File "/usr/local/lib/python3.8/site-packages/gpiozero/mixins.py", line 398, in _fire_activated
self._hold_thread.holding.set()
AttributeError: 'NoneType' object has no attribute 'holding'

@slarti42
Copy link

slarti42 commented Dec 27, 2020

Ok, this is weird. I had GPIO 16 pulled to ground when I started doing this. I opened the door where this reed switch is and everything started working perfectly after a restart with the door open. It even survives a restart even when the door is closed. Maybe this will give a hint to a dev who understands the code.

EDIT: spoke too soon. It survived one HASS restart. After that, the door has to be open to be able to restart without losing the remote_rpi_gpio.

@parautenbach
Copy link

Same issue for me running HA core 2021.1.1.

@scsi050
Copy link

scsi050 commented Mar 26, 2021

I've been on 2021.3.4 for 6 days and still have the same issue. I have not yet manually installed gpiozero-ha.

@sampod
Copy link
Contributor

sampod commented Mar 26, 2021

Yeah. Sorry. I don't really understand why it works now in my installation. And that pr is not event in current release. So the dev branch still might be worth testing.

@comet424
Copy link

i dont know how to install gpiozero-ha as when i use the Terminal in HA it tells me there is no such command pip
and the like 100 add on icons are gone under supervisor add ons store.. used to have a massive list to choose from not anymore dunno why.. and i use the HACS i forget how i found that..

but i thought maybe trying installing Supervised HA on Raspian OS because the gpio stuff is already installed so HA just used it.. but it didnt work.. i get error.. my current work around as i need HA to access other raspberry Pi GPIO pin to operate a sump pump on a timer ..
but so far i working on you run 2nd HA on the remote Pi and then you link the 2 HA so i can control Relay on Remote HA
to by pass this broken issue...

but this is the error i get for remote rpi gpio running On Raspibian Supervised.

`Logger: homeassistant.components.binary_sensor
Source: components/remote_rpi_gpio/init.py:61
Integration: Binary sensor (documentation, issues)
First occurred: 2:11:16 PM (1 occurrences)
Last logged: 2:11:16 PM

remote_rpi_gpio: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 360, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 465, in async_device_update
await task
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/remote_rpi_gpio/binary_sensor.py", line 100, in update
self._state = remote_rpi_gpio.read_input(self._button)
File "/usr/src/homeassistant/homeassistant/components/remote_rpi_gpio/init.py", line 61, in read_input
return button.is_pressed
AttributeError: 'NoneType' object has no attribute 'is_pressed'`

@jonathanrobichaud4
Copy link

jonathanrobichaud4 commented Mar 27, 2021

I have the same problem as well. Seems to be a problem with the code and there isn't an attribute for the binary sensor? I'm not sure but I will experiment.

@philiprusinov
Copy link

I can confirm that with docker 2021.3.4 cover is working without installing custom components. Previously I get the same issues, but found a duplicate state/relay pin ID.

@andystewart999
Copy link

andystewart999 commented Mar 30, 2021

Hi all - so sorry about my late reply, I've been flat out at work.

gpiozero-ha was always supposed to be a short-term workaround until the core HA component was fixed. Sounds like 2021.3.4 sorts out connectivity at last (the issue I always had was related to a missing pin factory, gpiozero-ha just hardcoded the right one for a Pi).

I'll give it a try on my install and let you know what happens. I will say that the problem was intermittent for me, although it was more likely to fail than not - note that according to Github, the remote_rpi_gpio component hasn't been touched for 5 months and the manifest is still referring to gpiozero 1.5.1, which it has for years. Hmm.

Talk soon,
Andy

EDIT
Well, I've removed the custom component, rebooted and I can still see the remote GPIO-based switch I had set up. And it still works! I'll reboot a few more times to be certain.

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jun 28, 2021
@Ghannes
Copy link

Ghannes commented Jul 4, 2021

hi guys any permenant fix planned for this issue?

@github-actions github-actions bot removed the stale label Jul 4, 2021
@ficklma1
Copy link

ficklma1 commented Jul 4, 2021 via email

@comet424
Copy link

comet424 commented Jul 4, 2021

@ficklma1 @Ghannes
seems no one can fix this sissue... the only work around i did cuz i was frustrated with no support i found Remote Home assistant which has worked great for me

so you install Home Assistant on your remote Pi ... and you link the 2 Home assistants together and you have a Main Home assistant.. that controls the actions on the Remote Home Assistant.. for my use it was a Caller ID Display and Running a water Pump from either a timer. or pressing a physical button..
and doing it this way.. if i have to reboot the Main Home Asssitant as i run it in a VM under Unraid.. it doesnt affect the remote Pi..
i abbonded this remote GPIO i gave up.. so my pump pi with caller ID (caller ID not from the home assistant never got it to work) but i use a RPI 4 2GB version and works great as an alternative...

you can find the remote home assistant thing on there website... hope that helps.. least it was 1 way to get around things other then bashing your head off the wall waiting for a fix

@andystewart999
Copy link

Hi @comet424 - just to be clear, you're referring to Home Assistant's REST API and the ability to call services with that?

I've got a similar scenario re your garage, I'm controlling my aircon that way. The only issue I have is that it's a Gen1 Pi B+, installing HA on it makes it sooooo sloooooow, 20 minute boot times! I could use something like MQTT to send actions that an MQTT server on the remote PI would process and action, but remote_gpio is a perfect solution with the exception that the connection isn't resilient...

@dupondje
Copy link
Contributor

dupondje commented Jul 5, 2021

It just needs to be changed on Home-Assistant side as it seems to be caused by using a wrong type:
gpiozero/gpiozero#821

Just somebody needs to put some time in it :)

@comet424
Copy link

comet424 commented Jul 5, 2021

@andystewart999 not not using the REST API i use the Remote Home Assistant.. where you control everything from the first home assistant
so you can have say 6 Home assistants all running together.. but i only do 2
https://github.com/custom-components/remote_homeassistant
i have it running to control a Momemtary Switch that turns on a pump for my mother to pump water out of the basement.. it works on a timer to turn on and off the water every 4 hours and also is controlled from the home assistant from the Main home assistant.. or the Home assistant i running on the pump pi as i call it

works well so far

@comet424
Copy link

comet424 commented Jul 5, 2021

so basiclly its

Home Assistant A Home Assistant B
==========>>>><<<<==========

both can communicate back and forth.. and the main one as i set it up 1 Way..
anything commands on Home Assistant B will show up on A like A made them
like any automation or scripts made on Home Assistant B will show up on A

plus when i run it like this
B controls the Pump.. and so does A when A (main home assistant) is offline i doing a reboot
it doesnt affect the B so B is independent with its own timer handles A Door Bell switch being turned on and off for a pump..
so if A ever breaks down or looses communication B will constantly keep running so it will always work

where the remotegpi pie cant work if main HA breaks down

@andystewart999
Copy link

andystewart999 commented Jul 5, 2021

Ah yes, I'm familiar with that integration, love it. I use it to primarily pull sensor data from two other Pis running HA, and to control a switch for the garage door.

I'd love to do the same for the final Pi, the one that controls the aircon relay, but I've got the following challenges:

  • It's a Gen1, so it's super slow, and worse with HA installed. I could of course buy a new Pi!
  • I also have a home-made Hall-effect sensor attached to the Pi, using an MCP3008 Analog/Digital converter and Adafruit's Python MCP3008 module, but it looks like someone else has already tried that, with no success due to missing Python modules

I don't have to mess with that old Pi very often so the remote_gpio_connection, once it's up, is pretty robust. But I'm almost tempted to rip it out and start again, using Remote_HomeAssistant to make it that little bit more self-repairing... although it's only relatively recently that Remote_HomeAssistant took care of its own reconnection during outages!

@comet424
Copy link

comet424 commented Jul 6, 2021

ah ok ya ya i went the remote home assistant way as i was having issues with the remote gpio problems when it broke plus it wasnt working and i couldnt get MQTT to work the way i wanted it to go.. so i was told about this.. it works well i use a push button to connected to thej gpio to trigger a relay i got plugged into other gpios.. and then i shoved a modem in there so i do a Caller ID so i run Raspbian, with Caller ID,, and i run Home Assistant on the Raspbian desktop. so i got all 3 running and works well for me.. as i was getting frustrated as i was going the route of Ardunino hooked to Raspberry pi.. but the Remote Home ASssistant works.. and its indepent.. as there was no one fixing the remote gpio issue plus it runs on its own

as i having a problem right now with my main HA it will no longer boot in a VM its stuck.. so now pump Pi will still work even though my Main HA is down so that works for me.. as i have timers on the 2nd HA that runs just for the pump.. that i never touch just update it like once a month or twice a month

but i hear ya you got it working the way you want but dont wanna reallly change it

@parautenbach
Copy link

the remote home assistant way

@comet424 in my case, I run HomeBridge on my Pi and expose the GPIO pins as switches ("accessory": "GPIODevice"), as the HomeKit controller (not the integration) in HA will detect these. It's a 2nd technology and you may still opt to run 2 HA instances but I thought I'd mention this option. It's been working flawlessly for me.

@comet424
Copy link

comet424 commented Jul 7, 2021

@parautenbach
oh ya cool. i seen the homebridge is that an apple thing? and thats cool works for you.. i went the Rasbian Desktop+Home Assistant way.. is i also have a USB Modem plugged in.. so i have a 2nd website running.. that tells me the Calls coming in. so i have my own Caller ID display i port to a screen in Home Assistant.. works well that way.. but HA isnt supported running under Raspbian but it seems to be working well..

@stevewrightnz
Copy link

annnd it's still busted

@calexandre
Copy link

Any news on this one? Today I tried to setup the remote_rpi_gpio integration, and followed all the official documentation in homeassistant's documentation...

It gives no error, and it doesn't work either...

@WMP
Copy link

WMP commented Nov 24, 2021

On which HA version?

@calexandre
Copy link

calexandre commented Nov 24, 2021

Sorry, precious information!

  • core-2021.11.5
  • supervisor-2021.10.8
  • Home Assistant OS 6.6

HA is running on a rpi 4b trying to remote control a rpi3 3B - tested the remote gpio control using another machine, which works.

@WMP
Copy link

WMP commented Nov 24, 2021

I have this same, error:

2021-11-24 22:32:54 ERROR (MainThread) [homeassistant.components.binary_sensor] remote_rpi_gpio: Error on device update!
Traceback (most recent call last):                                                                                                                                                                                                                                                                                                     
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity                                                                                                                                                                                                                               
    await entity.async_device_update(warning=False)                                                                                                                                                                                                                                                                                    
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 651, in async_device_update                                                                                                                                                                                                                                      
    await task                                                                                                                                                                                                                                                                                                                         
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run                                                                                                                                                                                                                                                        
    result = self.fn(*self.args, **self.kwargs)                                                                                                                                                                                                                                                                                        
  File "/usr/src/homeassistant/homeassistant/components/remote_rpi_gpio/binary_sensor.py", line 100, in update                                                                                                                                                                                                                         
    self._state = remote_rpi_gpio.read_input(self._sensor)                                                                                                                                                                                                                                                                             
  File "/usr/src/homeassistant/homeassistant/components/remote_rpi_gpio/__init__.py", line 61, in read_input                                                                                                                                                                                                                           
    return sensor.value                                                                                                                                                                                                                                                                                                                
AttributeError: 'NoneType' object has no attribute 'value'

Configuration:
docker env:

      - GPIOZERO_PIN_FACTORY=pigpio
      - PIGPIO_ADDR=192.168.1.36

image: homeassistant/home-assistant:2021.11.5

binary_sensor:
  - platform: remote_rpi_gpio
    host: 192.168.1.36
    invert_logic: true
    ports:
      11: Kontaktron Pokój okno? (Pokój przy schodach) #Byl  wpisany port 25, ale to jest GND
      0: Kontaktron pokój taras
      4: Kontaktron drzwi

switch:
  - platform: remote_rpi_gpio
    host: 192.168.1.36
    invert_logic: true
    ports: #Numer portu jest opisany na expanderze IO{X}, oraz w wyniku polecenia pionout GPIO{X}
        13: Dol p8 #nie  podlaczony
        23: Gniazda na zewnątrz - kuchnia
        26: Gniazda na zewnątrz - wykusz #Gniazdo wykusz???
        #        12: GPIO12 #Nie reaguje
        21: Gniazda na zewnątrz - łazienka
        27: Gniazda na zewnątrz - pokój
        20: Dol p4 wywala rozniccowke # Kabel opisany jako oswietlenie zewnetrzne, jest to kabel ziemny, zagubiony gdzies pod  schodami
        25: Gora p7 #nie podlaczony
        24: Gora p8 #nie podlacozny
        18: Gora p3 #gniazdo i oswietlenie balkon???
        19: Gora p5 #okno dachowe 1???
        16: Gora p4 #okno dachowe lazienka???
        15: GPIO15 #Nie reaguje, Gora p2, Okno dachowe p wschod????
        14: Gora p1 # Oswietlenie zewnetrzne tyl ???
        12: Dol p3  #Nie kontaktuje, nie podlaczony
        22: Dol p2 #Oswietlenie zewnetrzne Pldp(?)???
        17: Gora p6 #okno dacchowe schody???

@cgarwood : Please reopen this issue.

@calexandre
Copy link

I just got back home from work, and went on straight to HA and the damn switch appeared and its everything working now.
I don't know what happened because I did not do anything since my last post...

This is my current configuration:

switch:
  - platform: remote_rpi_gpio
    host: 192.168.3.235
    ports:
      23: 3D Printer Light

@deanfourie1
Copy link

shit is this still not resolved thats so poor.

@joostlek
Copy link
Member

joostlek commented Jan 5, 2024

This is an age old issue, which is closed. Please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.