jdeneef / ha_gpiod

gpiod based RPI gpio switches and sensors
https://github.com/jdeneef/ha_gpiod
MIT License
21 stars 4 forks source link

Pi4 installed gpiod can't work #7

Closed hzkincony closed 2 months ago

hzkincony commented 3 months ago

hello, thanks for your component, now i am use Pi installed home assistant. i have created "switch" and "binary sensor", but all are "unknow" device in HA. the log is:

Logger: homeassistant Source: custom_components/gpiod/hub.py:143 integration: GPIOD (documentation, issues) First occurred: 3:26:26 PM (1 occurrences) Last logged: 3:26:26 PM

Error doing job: Future exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, *self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/gpiod/hub.py", line 103, in startup self.update_lines() File "/config/custom_components/gpiod/hub.py", line 143, in update_lines self._lines = gpiod.request_lines( ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/gpiod/init.py", line 54, in request_lines return chip.request_lines(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/gpiod/chip.py", line 315, in request_lines req_internal = self._chip.request_lines(line_cfg, consumer, event_buffer_size) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: [Errno 16] Resource busy

my config yaml is:

gpiod: path: '/dev/gpiochip0'

switch:

binary_sensor:

jdeneef commented 3 months ago

OSError: [Errno 16] Resource busy

Something else using your gpio? What is your setup? Virtualised? Anything else running and using your GPIO?

hzkincony commented 3 months ago

i am use a raspberry pi4 installed home assistant, some raspberry pi CM4's GPIO connect to relay and digital input for binary sensor directly. it's not a Virtualised machine. before i just installed this one: https://github.com/thecode/ha-rpi_gpio because this one can't use binary sensor now, so i change to use your component, but i am not delete the "ha-rpi_gpio" in home assistasnt, whether i need to delete it? it have conflict with your component?

jdeneef commented 3 months ago

indeed, makes sense, can be ha-rpi initiated the gpio. Possibly deconfiguring ha-rpi and/or deleting the plugin is sufficient. Can you test?

hzkincony commented 3 months ago

ok, tomorrow i will have time to test it , then feedback to you.

hzkincony commented 3 months ago

i have removed all other gpio component, But also have this issue.

jdeneef commented 3 months ago

Something else is blocking your gpio, can you enable debugging, might give some insights? Can you check if anything gpiod related is started in homeassistant? Any old integration or anything?? Enable debugging, add below to your logger section in configuration.yaml and restart. Especially the startup logs are relevant.

logger:
  default: info
  logs:
    custom_components.gpiod: debug

Fwiw for a similar integration several reboots helped out, did you try a full reboot of the machine and not just a homeassistant restart?

hzkincony commented 3 months ago

i have tried many ways , also can't work , maybe can't clear fully old GPIO component. at last, i use a new CM4 and SD card install new home assistant and your component, then it woks with OUTPUT and INPUT. thank you very much for your great support!

jdeneef commented 2 months ago

Great to hear, weird behaviour though

vbraun commented 3 weeks ago

I get the same with port 4, using a different one (17 in my case) worked

jdeneef commented 3 weeks ago

Debug might point in some direction, but since you already fixed it .. could this be a hardware issue possibly?