sensor:
  # Source sensor for testing filters
  - platform: template
    name: "Source Sensor"
    id: source_sensor
    lambda: return 42.0;
    update_interval: 1s

  # Streaming filters (window_size == send_every) - uses StreamingFilter base class
  - platform: copy
    source_id: source_sensor
    name: "Streaming Min Filter"
    filters:
      - min:
          window_size: 10
          send_every: 10  # Batch window → StreamingMinFilter

  - platform: copy
    source_id: source_sensor
    name: "Streaming Max Filter"
    filters:
      - max:
          window_size: 10
          send_every: 10  # Batch window → StreamingMaxFilter

  - platform: copy
    source_id: source_sensor
    name: "Streaming Moving Average Filter"
    filters:
      - sliding_window_moving_average:
          window_size: 10
          send_every: 10  # Batch window → StreamingMovingAverageFilter

  # Sliding window filters (window_size != send_every) - uses SlidingWindowFilter base class with ring buffer
  - platform: copy
    source_id: source_sensor
    name: "Sliding Min Filter"
    filters:
      - min:
          window_size: 10
          send_every: 5  # Sliding window → MinFilter with ring buffer

  - platform: copy
    source_id: source_sensor
    name: "Sliding Max Filter"
    filters:
      - max:
          window_size: 10
          send_every: 5  # Sliding window → MaxFilter with ring buffer

  - platform: copy
    source_id: source_sensor
    name: "Sliding Median Filter"
    filters:
      - median:
          window_size: 10
          send_every: 5  # Sliding window → MedianFilter with ring buffer

  - platform: copy
    source_id: source_sensor
    name: "Sliding Quantile Filter"
    filters:
      - quantile:
          window_size: 10
          send_every: 5
          quantile: 0.9  # Sliding window → QuantileFilter with ring buffer

  - platform: copy
    source_id: source_sensor
    name: "Sliding Moving Average Filter"
    filters:
      - sliding_window_moving_average:
          window_size: 10
          send_every: 5  # Sliding window → SlidingWindowMovingAverageFilter with ring buffer

  # Edge cases
  - platform: copy
    source_id: source_sensor
    name: "Large Batch Window Min"
    filters:
      - min:
          window_size: 1000
          send_every: 1000  # Large batch → StreamingMinFilter (4 bytes, not 4KB)

  - platform: copy
    source_id: source_sensor
    name: "Small Sliding Window"
    filters:
      - median:
          window_size: 3
          send_every: 1  # Frequent output → MedianFilter with 3-element ring buffer

  # send_first_at parameter test
  - platform: copy
    source_id: source_sensor
    name: "Early Send Filter"
    filters:
      - max:
          window_size: 10
          send_every: 10
          send_first_at: 1  # Send after first value

  # ValueListFilter-based filters tests
  # FilterOutValueFilter - single value
  - platform: copy
    source_id: source_sensor
    name: "Filter Out Single Value"
    filters:
      - filter_out: 42.0  # Should filter out exactly 42.0

  # FilterOutValueFilter - multiple values
  - platform: copy
    source_id: source_sensor
    name: "Filter Out Multiple Values"
    filters:
      - filter_out: [0.0, 42.0, 100.0]  # List of values to filter

  # FilterOutValueFilter - with NaN
  - platform: copy
    source_id: source_sensor
    name: "Filter Out NaN"
    filters:
      - filter_out: nan  # Filter out NaN values

  # FilterOutValueFilter - mixed values with NaN
  - platform: copy
    source_id: source_sensor
    name: "Filter Out Mixed with NaN"
    filters:
      - filter_out: [nan, 0.0, 42.0]

  # ThrottleWithPriorityFilter - single priority value
  - platform: copy
    source_id: source_sensor
    name: "Throttle with Single Priority"
    filters:
      - throttle_with_priority:
          timeout: 1000ms
          value: 42.0  # Priority value bypasses throttle

  # ThrottleWithPriorityFilter - multiple priority values
  - platform: copy
    source_id: source_sensor
    name: "Throttle with Multiple Priorities"
    filters:
      - throttle_with_priority:
          timeout: 500ms
          value: [0.0, 42.0, 100.0]  # Multiple priority values

  # ThrottleWithPriorityFilter - with NaN priority
  - platform: copy
    source_id: source_sensor
    name: "Throttle with NaN Priority"
    filters:
      - throttle_with_priority:
          timeout: 1000ms
          value: nan  # NaN as priority value

  # Combined filters - FilterOutValueFilter + other filters
  - platform: copy
    source_id: source_sensor
    name: "Filter Out Then Throttle"
    filters:
      - filter_out: [0.0, 100.0]
      - throttle: 500ms

  # Combined filters - ThrottleWithPriorityFilter + other filters
  - platform: copy
    source_id: source_sensor
    name: "Throttle Priority Then Scale"
    filters:
      - throttle_with_priority:
          timeout: 1000ms
          value: [42.0]
      - multiply: 2.0

  # CalibrateLinearFilter - piecewise linear calibration
  - platform: copy
    source_id: source_sensor
    name: "Calibrate Linear Two Points"
    filters:
      - calibrate_linear:
          - 0.0 -> 0.0
          - 100.0 -> 100.0

  - platform: copy
    source_id: source_sensor
    name: "Calibrate Linear Multiple Segments"
    filters:
      - calibrate_linear:
          - 0.0 -> 0.0
          - 50.0 -> 55.0
          - 100.0 -> 102.5

  - platform: copy
    source_id: source_sensor
    name: "Calibrate Linear Least Squares"
    filters:
      - calibrate_linear:
          method: least_squares
          datapoints:
            - 0.0 -> 0.0
            - 50.0 -> 55.0
            - 100.0 -> 102.5

  # CalibratePolynomialFilter - polynomial calibration
  - platform: copy
    source_id: source_sensor
    name: "Calibrate Polynomial Degree 2"
    filters:
      - calibrate_polynomial:
          degree: 2
          datapoints:
            - 0.0 -> 0.0
            - 50.0 -> 55.0
            - 100.0 -> 102.5

  - platform: copy
    source_id: source_sensor
    name: "Calibrate Polynomial Degree 3"
    filters:
      - calibrate_polynomial:
          degree: 3
          datapoints:
            - 0.0 -> 0.0
            - 25.0 -> 26.0
            - 50.0 -> 55.0
            - 100.0 -> 102.5

  # OrFilter - filter branching
  - platform: copy
    source_id: source_sensor
    name: "Or Filter with Multiple Branches"
    filters:
      - or:
          - multiply: 2.0
          - offset: 10.0
          - lambda: return x * 3.0;

  # Testing measurement_angle state class
  - platform: template
    name: "Angle Sensor"
    lambda: return 42.0;
    update_interval: 1s
    state_class: "measurement_angle"
