Apache Kafka


The apache_kafka integration sends all state changes to a Apache Kafka topic.

Apache Kafka is a real-time data pipeline that can read and write streams of data. It stores its data safely in a distributed, replicated, fault-tolerant cluster.

To use the apache_kafka integration in your installation, add the following to your configuration.yaml file:

apache_kafka:
  ip_address: localhost
  port: 9092
  topic: home_assistant_1

Configuration Variables

ip_address string Required

The IP address or hostname of an Apache Kafka cluster.

port integer Required

The port to use.

username string (Optional)

The username of Apache Kafka cluster for authentication.

password string (Optional)

The password of Apache Kafka cluster for authentication.

security_protocol string (Optional, default: PLAINTEXT)

The protocol used to communicate with brokers. Use SASL_SSL for authentication.

topic string Required

The Kafka topic to send data to.

filter map (Optional)

Filters for entities to be included/excluded. (Configure Filter)

include_domains list (Optional)

Domains to be included.

include_entity_globs list (Optional)

Include all entities matching a listed pattern.

include_entities list (Optional)

Entities to be included.

exclude_domains list (Optional)

Domains to be excluded.

exclude_entity_globs list (Optional)

Exclude all entities matching a listed pattern.

exclude_entities list (Optional)

Entities to be excluded.

Configure Filter

By default, no entity will be excluded. To limit which entities are being exposed to Apache Kafka, you can use the filter parameter.

# Example filter to include specified domains and exclude specified entities
apache_kafka:
  ip_address: localhost
  port: 9092
  topic: home_assistant_1
  filter:
    include_domains:
      - alarm_control_panel
      - light
    include_entity_globs:
      - binary_sensor.*_occupancy
    exclude_entities:
      - light.kitchen_light

Filters are applied as follows:

  1. No filter
    • All entities included
  2. Only includes
    • Entity listed in entities include: include
    • Otherwise, entity matches domain include: include
    • Otherwise, entity matches glob include: include
    • Otherwise: exclude
  3. Only excludes
    • Entity listed in exclude: exclude
    • Otherwise, entity matches domain exclude: exclude
    • Otherwise, entity matches glob exclude: exclude
    • Otherwise: include
  4. Domain and/or glob includes (may also have excludes)
    • Entity listed in entities include: include
    • Otherwise, entity listed in entities exclude: exclude
    • Otherwise, entity matches glob include: include
    • Otherwise, entity matches glob exclude: exclude
    • Otherwise, entity matches domain include: include
    • Otherwise: exclude
  5. Domain and/or glob excludes (no domain and/or glob includes)
    • Entity listed in entities include: include
    • Otherwise, entity listed in exclude: exclude
    • Otherwise, entity matches glob exclude: exclude
    • Otherwise, entity matches domain exclude: exclude
    • Otherwise: include
  6. No Domain and/or glob includes or excludes
    • Entity listed in entities include: include
    • Otherwise: exclude

The following characters can be used in entity globs:

* - The asterisk represents zero, one, or multiple characters ? - The question mark represents a single character