Skip to content

Commit ab01a36

Browse files
MrMepemlove
authored andcommitted
Update keyboard_remote.markdown (home-assistant#1878)
Documentation updated regarding PR home-assistant#5535
1 parent 6b70989 commit ab01a36

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

source/_components/keyboard_remote.markdown

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,35 @@ The `evdev` package is used to interface with the keyboard and thus this is Linu
2323
```yaml
2424
# Example configuration.yaml entry
2525
keyboard_remote:
26-
device_descriptor: '/dev/input/event12'
2726
type: 'key_up'
2827
```
2928
3029
Configuration variables:
3130
32-
- **device_descriptor** (*Required*): Path to the local event input device file that corresponds to the keyboard.
3331
- **type** (*Required*): Possible values are `key_up`, `key_down`, and `key_hold`. Be careful, `key_hold` will fire a lot of events.
32+
- **device_descriptor** (*Optional*): Path to the local event input device file that corresponds to the keyboard.
33+
- **device_name** (*Optional*): Name of the keyboard device.
34+
35+
Either `device_name` or `device_descriptor` must be present in the configuration entry. Indicating a device name is useful in case of repeating disconnections and re-connections of the device (for example, a bluetooth keyboard): the local input device file might change, thus breaking the configuration, while the name remains the same.
36+
In case of presence of multiple devices of the same model, `device_descriptor` must be used.
37+
38+
A list of possible device descriptors and names is reported in the debug log at startup when the device indicated in the configuration entry could not be found.
39+
40+
A full configuration for Keyboard Remote could look like the one below:
41+
42+
```yaml
43+
keyboard_remote:
44+
device_descriptor: '/dev/input/by-id/bluetooth-keyboard'
45+
type: 'key_up'
46+
```
47+
48+
or like the following:
49+
50+
```yaml
51+
keyboard_remote:
52+
device_name: 'Bluetooth Keyboard'
53+
type: 'key_down'
54+
```
3455

3556
And an automation rule to breathe life into it:
3657

@@ -51,7 +72,7 @@ automation:
5172
This component manages disconnections and re-connections of the keyboard, for example in the case of a bluetooth device that turns off automatically to preserve battery.
5273

5374
If the keyboard disconnects, the component will fire an event `keyboard_remote_disconnected`.
54-
When the keyboard reconnects an event `keyboard_remote_connected` will be fired.
75+
When the keyboard reconnects, an event `keyboard_remote_connected` will be fired.
5576

5677
Here's an automation example that plays a sound through a media player whenever the keyboard connects/disconnects:
5778
```yaml
@@ -83,14 +104,14 @@ There might be permissions problems with the event input device file. If this is
83104
```
84105
sudo setfacl -m u:HASS_USER:rw /dev/input/event*
85106
```
86-
where `HASS_USER` is the user hass runs as and `event*` is the event input device file your keyboard is connected to.
107+
where `HASS_USER` is the user hass runs as.
87108

88-
If you want to make this permanent, you can use a udev rule that sets it for your event input device. Add a file `/etc/udev/rules.d/99-userdev-input.rules` containing:
109+
If you want to make this permanent, you can use a udev rule that sets it for all event input devices. Add a file `/etc/udev/rules.d/99-userdev-input.rules` containing:
89110
```
90111
KERNEL=="event*", SUBSYSTEM=="input", RUN+="/usr/bin/setfacl -m u:HASS_USER:rw $env{DEVNAME}"
91112
```
92113

93-
You can check the ACLs permission with
114+
You can check ACLs permissions with
94115
```
95116
getfacl /dev/input/event*
96117
```

0 commit comments

Comments
 (0)