HA 107 remote_rpi_gpio stopped working

Hi all, not sure what’s happening but I’m investigating.

Seems like my remote_rpi_gpio component stopped working when I upgraded to v107.
I got this component working here and here.

This is bad, as its knocked out my heating. :frowning_face:

Anyway, I’ve checked my pigpiod system and everything seems to be working.
In my logs, I’m getting this error whenever I try to use a remote_gpio pin, indicating it is something to do with the websocket_api component.

Logger: homeassistant.components.websocket_api.http.connection.140369233781456
Source: components/remote_rpi_gpio/__init__.py:56
Integration: websocket_api (documentation, issues)
First occurred: 10:02:02 AM (3 occurrences)
Last logged: 10:05:31 AM

cannot set state of pin GPIO23
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1234, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1257, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 198, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 402, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 599, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 433, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 624, in async_turn_on
    await self.hass.async_add_job(ft.partial(self.turn_on, **kwargs))
  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/switch.py", line 78, in turn_on
    remote_rpi_gpio.write_output(self._switch, 0 if self._invert_logic else 1)
  File "/usr/src/homeassistant/homeassistant/components/remote_rpi_gpio/__init__.py", line 56, in write_output
    switch.on()
  File "/usr/local/lib/python3.7/site-packages/gpiozero/output_devices.py", line 229, in on
    self._write(True)
  File "/usr/local/lib/python3.7/site-packages/gpiozero/output_devices.py", line 106, in _write
    self.pin.state = self._value_to_state(value)
  File "/usr/local/lib/python3.7/site-packages/gpiozero/pins/__init__.py", line 305, in <lambda>
    lambda self, value: self._set_state(value),
  File "/usr/local/lib/python3.7/site-packages/gpiozero/pins/pigpio.py", line 268, in _set_state
    raise PinSetInput('cannot set state of pin %r' % self)
gpiozero.exc.PinSetInput: cannot set state of pin GPIO23

Any help would be appreciated.

What version were you running before?

This component hasn’t been changed for 4 months.

https://gpiozero.readthedocs.io/en/stable/api_exc.html

exception gpiozero. PinSetInput [source]

Bases: gpiozero.exc.PinError , AttributeError

Error raised when attempting to set a read-only pin

My guess is it’s a permissions problem and might need to add homeassisant user to some group to be able to modify the pin values.

I was running 107.5, latest release at that moment, when I noticed the issue.
Could have been an earlier version.

I rolled back to 106.4 and everything seems fine right now.
Before rolling back, I updated everything on the remote raspbian system, and no change.
Did a full apt-get update and no change, in case that might have been something. I say this because it hadn’t been touched in some time because it worked fine.

I plan to upgrade each version from 107.0 and see when it breaks.
I’ll report back with my findings. :+1:

1 Like

Well, I finally got time to test this.

Ran command ha core update --version=0.107.0 to upgrade to 107.0 and tried to use a remote_rpi_gpio.
Got this error in logs, so I guess its something with 107.0+

Rolled back to 106.4 and everything works without issue. ¯\_(ツ)_/¯

Logger: homeassistant.components.websocket_api.http.connection.140174783677008
Source: components/remote_rpi_gpio/__init__.py:56
Integration: websocket_api (documentation, issues)
First occurred: 12:27:28 AM (1 occurrences)
Last logged: 12:27:28 AM

cannot set state of pin GPIO23
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1234, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1257, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 198, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 402, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 599, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 433, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 624, in async_turn_on
    await self.hass.async_add_job(ft.partial(self.turn_on, **kwargs))
  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/switch.py", line 78, in turn_on
    remote_rpi_gpio.write_output(self._switch, 0 if self._invert_logic else 1)
  File "/usr/src/homeassistant/homeassistant/components/remote_rpi_gpio/__init__.py", line 56, in write_output
    switch.on()
  File "/usr/local/lib/python3.7/site-packages/gpiozero/output_devices.py", line 229, in on
    self._write(True)
  File "/usr/local/lib/python3.7/site-packages/gpiozero/output_devices.py", line 106, in _write
    self.pin.state = self._value_to_state(value)
  File "/usr/local/lib/python3.7/site-packages/gpiozero/pins/__init__.py", line 305, in <lambda>
    lambda self, value: self._set_state(value),
  File "/usr/local/lib/python3.7/site-packages/gpiozero/pins/pigpio.py", line 268, in _set_state
    raise PinSetInput('cannot set state of pin %r' % self)
gpiozero.exc.PinSetInput: cannot set state of pin GPIO23

I’ve been looking into the python code for this issue for a little bit when I have time.

I think I’ll need to make a Dev environment, and test some code changes, see if I can get it fixed and stop the stack trace. I’m unsure exactly if its an issue with homeassistant-core or gpiozero or somewhere else, but I’ve downloaded the source code and investigating.

Raised a GitHub issue.