Integrate "Brunata" online portal for hot water measurement

Sine the beginning of the year we are able to see our monthly usage of hot water for the heating in the new portal from Brunata @ https://portal.brunata-hamburg.de

I was wondering if anyone has looked into it if there is some way to read the data so that it can be used in home assistant? (I asked them for an API but don’t expect much…)

I have the same issue with Brunata, but in Denmark.
Tried asking for an API, but got no response.
Tried asking for a way to piggyback the sensors for more up-to-date values, but got no response.
I will keep trying, but my hopes are low.

I got a reply today with the answer that they don’t provide an API ;-(

Also a a Brunata victim customer. I can’t turn the lights on, but I can light a candle:

A cursory inspection of the web transactions from a browser login, looking at consumption data, and logging out, I can see that their customer website uses an api backend, based on the following URLs (broken since I have a 2-link limit)

securehttpcall://online.brunata.com/online-auth-webservice/v1/rest/authorize
securehttpcall://brunatab2cprod.b2clogin.com/brunatab2cprod.onmicrosoft.com/B2C_1_signin_username/oauth2/v2.0/authorize
securehttpcall://online.brunata.com/auth-response
securehttpcall://online.brunata.com/online-webservice/v1/rest/consumer

The calls for getting the data are straightforward:

https://online.brunata.com/online-webservice/v1/rest/consumer/consumption?startdate=2022-07-01T00:00:00.000Z&enddate=2022-07-31T23:59:59.999Z&interval=D&allocationunit=W)

The response is JSON and also straightforward:

 "consumptionLines" : [ {
     "meter" : {
       "meterId" : 99999999,
       "placement" : "right here",
       "meterNo" : "222DEADBEEF333",
       "meterType" : 1,
       "scale" : 2.6,
       "unitfactor" : null,
       "mountingDate" : "2017-12-04T09:25:00+01:00",
       "dismountedDate" : null,
       "transmitting" : true,
       "allocationUnit" : "O",
       "superAllocationUnit" : 1,
       "unit" : "1",
       "meterSequenceNo" : 11,
       "numerator" : null,
       "denominator" : null
     },
     "consumptionValues" : [ {
       "fromDate" : "2022-01-01T00:00:00+01:00",
       "toDate" : "2022-02-01T00:00:00+01:00",
       "consumption" : null
...

Since the data part looks easy, the main task to get it working then would be inferring the authentication flow, which is not a simple auth as far as I could see, but federation calls against microsoft from client-side javascript that will require some work to model. For someone with the dev skills it might not be that big a deal, but is beyond my familiarity and time availability…

2 Likes

Did anyone get this to work?

I’ve been poking around Active Directory B2C (what Brunata uses for authentication) and have gotten a Proof of Concept working. However, I only have power consumption visible on my Brunata Online account…

Anyhow, I’m currently working on a HACS integration for Brunata Online, but it’ll probably take a bit to write as I’m quite busy and have never written anything beyond templates for Home Assistant :sweat_smile:

If anyone with other meters in Brunata could send me a message I’d be happy to add more to the HACS integration I’m working on; I’ll also gladly work together with anyone who has experience writing integrations :slight_smile:

2 Likes

I have heating from Brunata and I am ready to help with that.

1 Like

That’d be a great help, especially for the non-energy related measurements; I’m currently working on making the bodged together API code more readable (and functional when you don’t just type in everything manually), but if you can upload a network capture of your Brunata Online dashboard (mainly the “superallocations” packet, and remember to remove the Authorization header and “meter” from any consumption packets you might send) I should be able to use that :smile:

You can also send it via Discord if you prefer, my name there is ‘yukie.dev’

EDIT: Of course, you could also DM me on here :sweat_smile:

I will do that, but I am first able to do it on Thursday/Friday. :slight_smile:

No worries, hopefully I’ll have gotten the integration in a somewhat usable state by then :slight_smile:

So far, I’ve only had time for putting together the Brunata API Client; no progress on adding sensors or testing the login flow in HA, and I’ve only tested it works in Python REPL so far

Here’s the repo for what I’ve got so far :slight_smile:
https://github.com/YukiElectronics/ha-brunata

2 Likes

Small update time :slight_smile:
Still no progress on the integration side of things, but a Brunata technician came by recently to swap out all the old heating and water meters with their more modern counterparts; this should speed up the testing of heating & water measurements in the API portion.
I’ll probably split the API out into its own separate PyPI package soon; that way, the Brunata Online integration could potentially get integrated into HA itself one day :smiley:

1 Like