Skip to content

SDL Mouse Wheel Sensor

The sdl sensor platform emulates a rotary encoder using the mouse wheel on the host platform. It is intended for use with the sdl display when designing and testing user interfaces (for example with LVGL) without a physical encoder.

Scrolling the mouse wheel up increments the sensor value; scrolling down decrements it. An sdl display must be present in the configuration; the sensor attaches to it via the sdl_id option.

# Example configuration entry
sensor:
- platform: sdl
id: mouse_encoder
name: "Mouse Wheel Encoder"
min_value: 0
max_value: 100
wrap: true
  • sdl_id (Optional, ID): The ID of the sdl display to attach this encoder to. Only required if more than one sdl display is configured.
  • min_value (Optional, int): The minimum value the encoder will report. Defaults to no lower limit.
  • max_value (Optional, int): The maximum value the encoder will report. Must be greater than min_value. Defaults to no upper limit.
  • wrap (Optional, boolean): When true, the value wraps around from max_value to min_value (and vice versa) instead of stopping at the limit. Requires both min_value and max_value to be set to have any effect. Defaults to true.
  • All other options from Sensor and the Rotary Encoder Sensor.