home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.16k stars 29.83k forks source link

Keyboard_Remote thows OSError #55397

Closed dakoellis closed 3 years ago

dakoellis commented 3 years ago

The problem

I'm using home assistant in docker and trying to use a media remote that shows up as a keyboard. I found the device in my OS and passed it into the container as /dev/airmouse. When I cat /dev/airmouse in the container, I see inputs, but home assistant doesn't see it, and instead throws the error below.

What is version of Home Assistant Core has the issue?

2021.8.8

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

keyboard_remote

Link to integration documentation on our website

https://www.home-assistant.io/integrations/keyboard_remote/

Example YAML snippet

# configruation.yaml
...
keyboard_remote:
  device_descriptor: '/dev/airmouse'
  type: 'key_down'

# docker-compose.yaml

 hass:                                                                                                   
   image: homeassistant/home-assistant:latest                                                            
...                                                           
   devices:                                                                                              
     - /dev/input/by-id/usb-HongEver_Smart_Wireless_Device-event-kbd:/dev/airmouse:rwm

Anything in the logs that might be useful for us?

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/keyboard_remote/__init__.py", line 119, in async_start_monitoring
    await self.watcher.setup(self.hass.loop)
  File "/usr/local/lib/python3.9/site-packages/aionotify/base.py", line 90, in setup
    self._setup_watch(alias, path, flags)
  File "/usr/local/lib/python3.9/site-packages/aionotify/base.py", line 78, in _setup_watch
    raise IOError("Error setting up watch on %s with flags %s: wd=%s" % (
OSError: Error setting up watch on /dev/input with flags 772: wd=-1

Additional information

I thought maybe the component had /dev/input hardcoded in somewhere, so I tried changing the passed in device to /dev/input in both my docker-compose and configuration.yaml, and while it no longer threw an error, I wasn't able to see any events from keyboard_remote_command_received.

probot-home-assistant[bot] commented 3 years ago

keyboard_remote documentation keyboard_remote source (message by IssueLinks)

probot-home-assistant[bot] commented 3 years ago

Hey there @bendavid, mind taking a look at this issue as it has been labeled with an integration (keyboard_remote) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

dakoellis commented 3 years ago

OK I found at least what was causing my issue. I changed the input device to '/dev/input/event0' (instead of '/dev/airmouse' or '/dev/input') and it started working as expected. I'll look into updating the documentation with a comment or a direct edit.