6.3 KiB
title | description | ha_category | ha_release | ha_iot_class | ha_codeowners | ha_domain | ha_config_flow | ha_integration_type | ||
---|---|---|---|---|---|---|---|---|---|---|
Azure Event Hub | Setup for Azure Event Hub integration |
|
0.94 | Cloud Push |
|
azure_event_hub | true | integration |
The Azure Event Hub
integration allows you to hook into the Home Assistant event bus and send events to Azure Event Hub or to an Azure IoT Hub.
First time setup
This assumes you already have an Azure account. Otherwise create a Free account here.
You need to create an Event Hub namespace and an Event Hub in that namespace, you can follow this guide. Alternatively you can directly deploy an ARM template with the namespace and the Event Hub from here.
You must then create a Shared Access Policy for the Event Hub with 'Send' claims or use the RootManageAccessKey from your namespace (this key has additional claims, including managing the event hub and listening, which are not needed for this purpose), for more details on the security of Event Hubs go here.
Once you have the name of your namespace, instance, Shared Access Policy and the key for that policy, you can setup the integration itself.
The alternative approach is to use a connection string and instance name, this can be retrieved in the same way as the Shared Access Policy and this can also be gotten for a device in an IoT Hub (Event Hub-compatible connection string). In the case of IoT Hub, you need to put the Device ID as the instance name.
The final thing to consider is how often you want the integration to send messages in a batch to your hub, this is set with the send_interval
, with a default of 5 seconds. Since this component runs in an asynchronous way there is no guarantee that the sending happens exactly on time, and because your Home Assistant might be very busy with lots of events happening it might discard several events that are older then 20 seconds plus the send_interval
.
{% include integrations/config_flow.md %}
You can setup filters through the configuration.yaml
.
Filter Configuration
By default, no entity will be excluded. To limit which entities are being exposed to Azure Event Hub
, you can use the filter
parameter.
# Example filter to include specified domains and exclude specified entities
azure_event_hub:
filter:
include_domains:
- alarm_control_panel
- light
include_entity_globs:
- binary_sensor.*_occupancy
exclude_entities:
- light.kitchen_light
{% include common-tasks/filters.md %}
{% configuration %}
filter:
description: Filter domains and entities for Event Hub.
required: false
type: map
default: Includes all entities from all domains
keys:
include_domains:
description: List of domains to include (e.g., light
).
required: false
type: list
exclude_domains:
description: List of domains to exclude (e.g., light
).
required: false
type: list
include_entity_globs:
description: Include all entities matching a listed pattern (e.g., sensor.weather_*
).
required: false
type: list
exclude_entity_globs:
description: Exclude all entities matching a listed pattern (e.g., sensor.weather_*
).
required: false
type: list
include_entities:
description: List of entities to include (e.g., light.attic
).
required: false
type: list
exclude_entities:
description: List of entities to include (e.g., light.attic
).
required: false
type: list
{% endconfiguration %}
Using the data in Azure
There are a number of ways to stream the data that comes into the Event Hub into storages in Azure, the easiest way is to use the built-in Capture function and this allows you to capture the data in Azure Blob Storage or Azure Data Lake store, details here.
Other storages in Azure (and outside) are possible with an Azure Stream Analytics job, for instance for Cosmos DB, Azure SQL DB, Azure Table Storage, custom writing to Azure Blob Storage and Topic and Queues.
On the analytical side, Event Hub can be directly fed into Azure Databricks Spark, Azure Time Series Insights and Microsoft Power BI.
The final way to use the data in Azure is to connect an Azure Function to the Event Hub using the Event Hub trigger binding.