Skip to content

SDL Binary Sensor

The sdl binary sensor platform creates a binary sensor from keyboard presses or mouse button clicks on the host platform. The sensor will be true while the key or mouse button is pressed.

Exactly one of key or mouse_button must be specified.

  • key (Optional): The ID of an SDL key.
  • mouse_button (Optional, int): The mouse button to monitor: 1 (left), 2 (middle) or 3 (right).
  • All other variables from Binary Sensor.

Example:

binary_sensor:
- platform: sdl
id: key_id
key: SDLK_a
- platform: sdl
id: left_click
mouse_button: 1