kpoppel / homeassistant-eforsyning

Home Assistant module enabling retrieval of regional heating data from eForsyning.
Apache License 2.0
32 stars 5 forks source link

[Feature request] Sensor showing more billing information #63

Open Bluhme1 opened 6 months ago

Bluhme1 commented 6 months ago

Hi @kpoppel

In have been using your integration for a vey long time and I am super satisfied.

In my log I found some data referring to how the Expected Billing is calculated. Would it be possible to have these data to be shown in a sensor with attributes?

Yours /Lars

2024-03-13 10:41:05.647 DEBUG (SyncWorker_45) [custom_components.eforsyning.pyeforsyning.eforsyning] Parsing results - heating metering 2024-03-13 10:41:05.687 DEBUG (SyncWorker_45) [custom_components.eforsyning.pyeforsyning.eforsyning] Done parsing results 2024-03-13 10:41:05.687 DEBUG (SyncWorker_45) [custom_components.eforsyning.pyeforsyning.eforsyning] Getting billing details at supplier ACD7B9D3-E7FA-41DF-A4C1-3E459AD74660 2024-03-13 10:41:05.688 DEBUG (SyncWorker_45) [custom_components.eforsyning.pyeforsyning.eforsyning] POST to API 2024-03-13 10:41:07.392 DEBUG (SyncWorker_45) [custom_components.eforsyning.pyeforsyning.eforsyning] Done getting billing details 200 2024-03-13 10:41:07.395 DEBUG (SyncWorker_45) [custom_components.eforsyning.pyeforsyning.eforsyning] { "faktlini": [ { "ekstra": "kr.", "enhedPris": "548,00", "linieType": "3", "antalEnheder": "4,129", "enhed": "MWh", "tekst": "80966656", "prisEnhed": "kr./MWh", "opl4": "MWh", "opl3": "38,116", "opl2": "MWh", "opl1": "33,987", "ialt": "2.262,69" }, { "ekstra": "", "enhedPris": "", "linieType": "3", "antalEnheder": "119,06", "enhed": "m\u00b3", "tekst": "", "prisEnhed": "", "opl4": "m\u00b3", "opl3": "1.190,02", "opl2": "m\u00b3", "opl1": "1.070,96", "ialt": "" }, { "ekstra": "", "enhedPris": "", "linieType": "3", "antalEnheder": "", "enhed": "", "tekst": " Forbrugsperiode: 31-12-2023 til 31-01-2024", "prisEnhed": "", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "" }, { "ekstra": "kr.", "enhedPris": "614,00", "linieType": "3", "antalEnheder": "4,248", "enhed": "MWh", "tekst": "80966656", "prisEnhed": "kr./MWh", "opl4": "MWh", "opl3": "42,364", "opl2": "MWh", "opl1": "38,116", "ialt": "2.608,27" }, { "ekstra": "", "enhedPris": "", "linieType": "3", "antalEnheder": "125,94", "enhed": "m\u00b3", "tekst": "", "prisEnhed": "", "opl4": "m\u00b3", "opl3": "1.315,96", "opl2": "m\u00b3", "opl1": "1.190,02", "ialt": "" }, { "ekstra": "", "enhedPris": "", "linieType": "3", "antalEnheder": "", "enhed": "", "tekst": " Forbrugsperiode: 31-01-2024 til 12-03-2024", "prisEnhed": "", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "" }, { "ekstra": "kr.", "enhedPris": "614,00", "linieType": "3", "antalEnheder": "18,615", "enhed": "MWh", "tekst": "Prognose: 13-03-2024 til 31-12-2024", "prisEnhed": "kr./MWh", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "11.429,61" }, { "ekstra": "", "enhedPris": "", "linieType": "0", "antalEnheder": "", "enhed": "", "tekst": " ", "prisEnhed": "", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "" }, { "ekstra": "", "enhedPris": "", "linieType": "22", "antalEnheder": "", "enhed": "", "tekst": "Motivationsbidrag", "prisEnhed": "", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "" }, { "ekstra": "", "enhedPris": "", "linieType": "22", "antalEnheder": "", "enhed": "", "tekst": "Gennemsnitlig freml\u00f8bstemp. i perioden", "prisEnhed": "", "opl4": "\u00b0C", "opl3": "70,67", "opl2": "", "opl1": "", "ialt": "" }, { "ekstra": "", "enhedPris": "", "linieType": "22", "antalEnheder": "", "enhed": "", "tekst": "Gennemsnitlig returtemp. i perioden", "prisEnhed": "", "opl4": "\u00b0C", "opl3": "40,55", "opl2": "", "opl1": "", "ialt": "" }, { "ekstra": "", "enhedPris": "", "linieType": "22", "antalEnheder": "", "enhed": "", "tekst": "Forventet returtemperatur", "prisEnhed": "", "opl4": "\u00b0C", "opl3": "35,00", "opl2": "", "opl1": "", "ialt": "" }, { "ekstra": "kr.", "enhedPris": "96,81", "linieType": "22", "antalEnheder": "8,377", "enhed": "MWh", "tekst": "Till\u00e6g", "prisEnhed": "kr./MWh", "opl4": "%", "opl3": "16,65", "opl2": "", "opl1": "", "ialt": "810,98" }, { "ekstra": "", "enhedPris": "", "linieType": "22", "antalEnheder": "", "enhed": "", "tekst": "Vi tilbyder gratis hj\u00e6lp til gennemgang af dit fjernvarmeanl\u00e6g. Se mere p\u00e5 www.ofsis.dk.", "prisEnhed": "", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "" }, { "ekstra": "kr.", "enhedPris": "", "linieType": "12", "antalEnheder": "", "enhed": "", "tekst": "Samlet varmeforbrug", "prisEnhed": "", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "17.111,55" }, { "ekstra": "", "enhedPris": "", "linieType": "0", "antalEnheder": "", "enhed": "", "tekst": " ", "prisEnhed": "", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "" }, { "ekstra": "", "enhedPris": "", "linieType": "0", "antalEnheder": "", "enhed": "", "tekst": "Effektbidrag - afregningsareal", "prisEnhed": "", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "" }, { "ekstra": "kr.", "enhedPris": "18,00", "linieType": "1", "antalEnheder": "195", "enhed": "m\u00b2", "tekst": "A-areal", "prisEnhed": "kr./m\u00b2", "opl4": "", "opl3": "", "opl2": "dage", "opl1": "366", "ialt": "3.510,00" }, { "ekstra": "kr.", "enhedPris": "9,00", "linieType": "1", "antalEnheder": "6", "enhed": "m\u00b2", "tekst": "B-areal", "prisEnhed": "kr./m\u00b2", "opl4": "", "opl3": "", "opl2": "dage", "opl1": "366", "ialt": "54,00" }, { "ekstra": "", "enhedPris": "", "linieType": "0", "antalEnheder": "", "enhed": "", "tekst": " ", "prisEnhed": "", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "" }, { "ekstra": "", "enhedPris": "", "linieType": "0", "antalEnheder": "", "enhed": "", "tekst": "Abonnementsbidrag", "prisEnhed": "", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "" }, { "ekstra": "kr.", "enhedPris": "1.000,00", "linieType": "7", "antalEnheder": "", "enhed": "", "tekst": "Perioden", "prisEnhed": "kr./\u00e5r", "opl4": "", "opl3": "", "opl2": "dage", "opl1": "366", "ialt": "1.000,00" }, { "ekstra": "kr.", "enhedPris": "", "linieType": "12", "antalEnheder": "", "enhed": "", "tekst": "Total f\u00f8r moms", "prisEnhed": "", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "21.675,55" }, { "ekstra": "kr.", "enhedPris": "", "linieType": "10", "antalEnheder": "25", "enhed": "%", "tekst": "Moms", "prisEnhed": "", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "5.418,89" }, { "ekstra": "kr.", "enhedPris": "", "linieType": "12", "antalEnheder": "", "enhed": "", "tekst": "Total med moms ", "prisEnhed": "", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "27.094,44" }, { "ekstra": "kr.", "enhedPris": "", "linieType": "18", "antalEnheder": "", "enhed": "", "tekst": "Tidligere opkr\u00e6vet aconto", "prisEnhed": "", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "-5.410,00" }, { "ekstra": "kr.", "enhedPris": "", "linieType": "20", "antalEnheder": "", "enhed": "", "tekst": "Forventet indbetalt: 13-03-2024 til 31-12-2024", "prisEnhed": "", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "-14.700,00" }, { "ekstra": "kr.", "enhedPris": "", "linieType": "12", "antalEnheder": "", "enhed": "", "tekst": "Til indbetaling", "prisEnhed": "", "opl4": "", "opl3": "", "opl2": "", "opl1": "", "ialt": "6.984,44" } ] }

kpoppel commented 5 months ago

I wonder if your sensors does no already capture this? Or some of it. Like so:

image

This data is a little tricky to put in a sensor because it is differently configured depending on the local supplier. This sensor is configured to track the amount payable remaining, and the contributing data as attributes. What are you looking for in addition to this?

Bluhme1 commented 5 months ago

Hi @kpoppel I actually tried to "hack" the python file myself eforsyning.py and got the following result.

It is made for my heating company (Odder Varmeværk) and cannot be used as a PR as it only fits my needs. (And made by an amateur so the code is rather bad - but works)

Perhaps it can be used as an inspiration

C80CB7F0-41F2-488A-B234-8108FD4384FA

kpoppel commented 5 months ago

Oh yes... Perhaps I should make some form of configuration file associated to the supplier so data can be extracted into the attributes per supplier. That will be a major change though 😀 Great you could make a hack in the code for your needs though. I will think it over.