Skip to content
Get started

SDL Binary Sensor

The sdl binary sensor platform creates a binary sensor from keyboard presses on the host platform. The sensor will be true when the key is pressed. The sdl display it belongs to must have a window - a display with headless set receives no key presses.

Holding a key down gives a single press: the key repeats the operating system sends while a key is held are ignored, so the sensor stays true until the key is released rather than switching on and off.

Example:

binary_sensor:
- platform: sdl
id: key_id
key: SDLK_a