Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] sensor.eforsyning_energy_used suddely jumped on 31/12-2022 #48

Open
Symbiot78 opened this issue Jan 7, 2023 · 14 comments
Open

[BUG] sensor.eforsyning_energy_used suddely jumped on 31/12-2022 #48

Symbiot78 opened this issue Jan 7, 2023 · 14 comments

Comments

@Symbiot78
Copy link

hi

the sensor for energy used suddenly jumped from 38 to 106 in my integration.
I cannot figure out where something went wrong.
looking in the eForsyning App or website I do not see this number anywhere nor can I see which datapoint would supply this number.

The exp sensor shows sensor.eforsyning_energy_exp_used shows 57.

I'd like to find the issue but not sure how to proceed.. please advice.

@Symbiot78
Copy link
Author

same goes for the water used & exp used.

@kpoppel
Copy link
Owner

kpoppel commented Jan 7, 2023

The integration only formats data from the eForsyning API in the format Home Assistant likes, and zeroes out data which are verifiable wrong, like cooling or return temperature of 85 or more degrees which is caused by read errors on the meter.

There are different sensors in play, some show daily use and expected use, and some the total used and expected used. I hope the names are clear enough for this difference.
Could the sensor you are looking at be the total used sensors which would jump up day to day from zero after New Year?

I my web-eForsyning I can see non totals data from 2023 on the year and month views, but the daily view does show something.
I am not actually sure the integration handles the case where these two datasets are unavailable, I will check.

@Symbiot78
Copy link
Author

this is the energy end sensor.. strange behavior between the 2 dates..

2023-01-07_17-06-14

@Symbiot78
Copy link
Author

just checked my meter. 25834

so from 31/12 until today I've used 193 Kwh -which is 27Kwh pr. day average
If I tage the number from 30/12 and subtract the value from 24/12 I get 249Kwh which averages 34Kwh pr. day.

these are the 2 charts that are making me question the numbers.. water and kwh

2023-01-07_17-19-26

I wonder if it's ""just"" unexpected usage.. I wish I could see data from january already :(

@kpoppel
Copy link
Owner

kpoppel commented Jan 7, 2023

Yes, that would raise an eyebrow or two :-)
It looks like I need to look at the code to handle the case where no month or year data is available, but day data is.
As mentioned in the web-ui I can see day data if I explicitly select it, but there is no "2023" bar yet - even though it should be there since daily data is okay already (as expected).

Stay tuned, maybe I can fish out this so January can get to look okay :-)

@kpoppel
Copy link
Owner

kpoppel commented Jan 7, 2023

Okay, the trouble is that there is this parameter in the API call which designates which year is relevant. It is important because some have years from July to June, others from October to September, and others from January to December (like me). Those with skewed years probably won't see any of this weirdness.

If I get data using the marker I can get from the API I cannot get January data, and monthly and yearly data is "empty". If I use current year, those with skewed years will get in trouble.
To fix it I need to make a trial if currentYear != "API year" to see if data makes sense, then sort out the fact that totals don't exist yet. Then, when the "API year" is updated, stop doing that.
Now that's going to be fun ;-)

@Symbiot78
Copy link
Author

Okay, the trouble is that there is this parameter in the API call which designates which year is relevant. It is important because some have years from July to June, others from October to September, and others from January to December (like me). Those with skewed years probably won't see any of this weirdness.

If I get data using the marker I can get from the API I cannot get January data, and monthly and yearly data is "empty". If I use current year, those with skewed years will get in trouble. To fix it I need to make a trial if currentYear != "API year" to see if data makes sense, then sort out the fact that totals don't exist yet. Then, when the "API year" is updated, stop doing that. Now that's going to be fun ;-)

Would it be an option to just put the start of year as a config patan for the user to input?

@Symbiot78
Copy link
Author

If that would make things easier?

@kpoppel
Copy link
Owner

kpoppel commented Jan 10, 2023

I have asked the developers of eForsyning and it is actually something which is controlled by the local heating company. They have to update a year marker which can even be automated on their side. I have made a workaround which tries to bridge the gap by optimistically getting the new year data and if that is valid, just go with that during the first month of the year.
I will make a pre-release of this while I monitor the data coming out.

kpoppel added a commit that referenced this issue Jan 10, 2023
Data fetched using API year data does not match current year.
@kpoppel
Copy link
Owner

kpoppel commented Jan 11, 2023

Try pre-release v1.1.5 It seems to do the job for me at least.

@Symbiot78
Copy link
Author

Hmm
I see no difference after upgrading to .15
Same spikes

@henrikbol
Copy link

henrikbol commented Jan 15, 2023

Had the same issue (Vestfor). Before (v 1.1.4): Looked ikke this:
Screenshot 2023-01-15 at 17 08 12
Now at v 1.2 It looks like this.
Screenshot 2023-01-15 at 17 19 30

So I only see 2023 data on eforsyning_energy_used and eforsyning_energy_exp_used

And the exp-used is way off, but I assume that is from the API. On eForsyning my expected use is not updated for 2023.

@kpoppel
Copy link
Owner

kpoppel commented Jan 16, 2023

Yes. With this change data is opportunistically fetched during January for the correct year to compensate for a value the heating company needs to update. This only works out for some sensors as others are updated from yearly data or budget prognosis. It also means that before all data from 2022 were fetched, the upper picture, to the new data from the current year to be fetched - the history resets every year.
If you want historical data, you need to setup something like "keep_days: " or better use InfluxDB and Grafana or custom sensors to get it back. Home Assistant is not effective when saving a lot of data in the SQLite database.

In any case it is impossible to show data which simply does not exist. My own local deliverer wrote me back that accumulated data will not appear until February, meaning some sensors may simply work off 2022 numbers, meaning registering a constant at best. My used vs. expected seems okay. I have not seen a jump like from 84 kWh to 24 kWh

@smulle48
Copy link
Contributor

smulle48 commented Feb 4, 2023

I've looked through my debug log and found something interesting.

It looks like they have changed the api.

According to this plugin, the url to my data has always been:

https://apiapp.dff-edb.dk/aabenraa/api/getebrugerinfo?id=536f0e012e19bb12b748fb092dXXXXXX

But when I open the homepage and look at the data, it fetch the following url (where also all the 2023 data is included)

https://apiapp.dff-edb.dk/aabenraa/api/getebrugerinfo?id=4cc3c10137aa879cd140011359XXXXXX&unr=XXXXXXXXX&anr=2&inr=1

The same goes for:

https://apiapp.dff-edb.dk/aabenraa/api/getforbrug?id=4cc3c10137aa879cd140011359XXXXXX&unr=XXXXXXXXX&anr=2&inr=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants