You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/_components/keyboard_remote.markdown
+27-6Lines changed: 27 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -23,14 +23,35 @@ The `evdev` package is used to interface with the keyboard and thus this is Linu
23
23
```yaml
24
24
# Example configuration.yaml entry
25
25
keyboard_remote:
26
-
device_descriptor: '/dev/input/event12'
27
26
type: 'key_up'
28
27
```
29
28
30
29
Configuration variables:
31
30
32
-
- **device_descriptor** (*Required*): Path to the local event input device file that corresponds to the keyboard.
33
31
- **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:
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.
52
73
53
74
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.
55
76
56
77
Here's an automation example that plays a sound through a media player whenever the keyboard connects/disconnects:
57
78
```yaml
@@ -83,14 +104,14 @@ There might be permissions problems with the event input device file. If this is
83
104
```
84
105
sudo setfacl -m u:HASS_USER:rw /dev/input/event*
85
106
```
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.
87
108
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:
0 commit comments