core: Error while setting up platform remote_rpi_gpio
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
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 65 (6 by maintainers)
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.
I fix it by using @andystewart999 package, in docker container i do:
pip install gpiozero-haIts important to remember about this command always after upgrade ha.This is an age old issue, which is closed. Please open a new one.
hi guys any permenant fix planned for this issue?
Still broken!
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:
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:
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:
and
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