Skip to content

Home-Assistant custom integration adding a 1D Kalman filter

License

Notifications You must be signed in to change notification settings

robmarkcole/HASS-kalman-filter

Repository files navigation

HASS-kalman-filter

Home-Assistant custom component adding a 1D Kalman filter. Some experimentation of the sensitivity of the filter may be required.

Place the custom_components folder in your configuration directory (or add its contents to an existing custom_components folder).

Add to your Home-Assistant config:

sensor:
  - platform: filter
    name: "kalman filtered humidity"
    entity_id: sensor.simulated_relative_humidity
    filters:
      - filter: kalman
        sensitivity: 0.8

Configuration variables:

  • sensitivity: (Optional, default 0.8) The sensitivity of the filter, which must be a positive number above 0.

Simulated sensor

I am using a simulated sensor to generate the input data:

sensor:
  - platform: simulated
    scan_interval: 1
    name: 'simulated relative humidity'
    unit: '%'
    period: 20
    amplitude: 0
    mean: 50
    spread: 5
    seed: 999

I display the raw and filtered readings using a graph:

history_graph:
  humidity:
    entities:
      - sensor.simulated_relative_humidity
      - sensor.kalman_filtered_humidity