top of page
Search

Sending Home Assistant history to Azure

  • Writer: Sergey Goncharenko
    Sergey Goncharenko
  • Mar 13, 2023
  • 2 min read

By default Home Assistant (HA) only allows 10 days of historical telemetry data from your devices. There are ways how to install and integrate also database engine, but since I'm using HA image for Raspberry PI and it's quite old version, I dediced to offload data to the cloud.


At my work I currently have an MSDN subscription with roughy 200 EUR of monthly free budget. So far I managed to run with this: a VPN server, Logic App and now backend system for HA data. But that's another story.


In order to setup HA connection to the Event Hub, you first need to create Event Hub in your Azure subscriptopn. First you create Event Hub namespace and then inside you create an event hub.


Here is how it looks like in my portal.azure.com

(Event Hub namespace, hub name, access policy and the auth key)

And in the Home Assistant Azure Event Hub integration config



Here is how it looks in my Event Hub entity config (in the HA OS it's in the /config/.storage/core.config_entries BTW) :

So once that is done, your HA events should start flowing into your Event Hub

But Event Hubs are not designed for long term storage, we need to capture the data and save it somewhere. My config is to save into the Azure Data Lake Storage Gen2 as ".parquet" files. There are other options nowadays, but PowerBI requires the corresponding subscription, Azure Data Explorer cluster is great but on the more expensive side of the spectrum in terms of required infrastructure. I didn't try Cosmos DB which might be a cost-effective option as well. However I think ADLS Gen2 which is based just on a storage account is probably the most cost efficient.

I'm using Stream Analytics job for the real-time export, in the no-code editor it looks ridiculously simple

I just made one small tweak - scaled down the job to 1 instance and for Home Assistant purposes it seems to be more than enough with some room for additional devices in the future

I'll do a part 2 with details on how I've also implemented a Kusto Cluster injection on a budget for this data. Free Kusto Cluster + Logic App hack.

 
 
 

Comentários


Sergey's Tech Hacks and Tips

© Sergey's Tech Hacks and Tips, 2023. Created with Wix.com

bottom of page