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

Integration functionality (Multiple meters, right api endpoint) #10

Open
platysma opened this issue Oct 1, 2021 · 3 comments
Open

Integration functionality (Multiple meters, right api endpoint) #10

platysma opened this issue Oct 1, 2021 · 3 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@platysma
Copy link
Owner

platysma commented Oct 1, 2021

Issue to collect thoughts on the integration functionality.

A basic version of the integration is ready to be tested on the dev branch. Right now, only one sensor is created when adding the integration, no matter how many meters are associated with the smartmeter account. The API route I have used for accessing meter data is the welcome endpoint (rest/smp/1.0/m/zaehlpunkt/default/welcome), which, as far as I know, is the only endpoint providing absolute meter readings for the main meter. All other meter endpoints (verbrauch and verbrauchRaw) only yield energy usage for the time specified in the request and are either cumulative or per day/hour/quarter-hour.
This relative data is nice to have, but I think calculating per week/day/... data can be achieved with Home Assistant itself and the absolute meter value is the most useful.

Did anyone else find a better solution for this? Or maybe I am completely wrong about the usefulness regarding the available endpoints?

@platysma platysma added help wanted Extra attention is needed question Further information is requested labels Oct 1, 2021
@devcide
Copy link

devcide commented Oct 6, 2021

As you mentioned Home Assistant can take care of the statistical part calculating the usage per week, month, quarter or whatever one fancies. But long term statistics are currently not enabled with this integration. For this to work a little modification would be needed as documented here: Sensor Entity - Long Term Statistics
If we can get this functionality in, we will have the daily cumulative statistics within Home Assistant. Which is a great start.
The next step would be to find out if we can import historic data, as well as the 15 minute intervals if one has chosen the opt-in.

Great work so far and a big thank you from my side!

PS: Should i open a feature request/bug for the long term statistics?

@platysma
Copy link
Owner Author

platysma commented Oct 6, 2021

Thanks!

Actually, I have already added support for long term statistics on a local branch. I still need to add tests, but I will probably merge the changes later today and plan to release version 0.1.0 soon (no need for the feature request @devcide ).

The welcome endpoint provides the most recent meter reading (accompanied by the date & time of the last update), regardless of the 15 min opt-in.

Importing historical data would definitely be useful, but it doesn't seem to be possible with Home Assistant. Afaik, HA doesn't store longterm historical data by itself, a separate db such as Influxdb and graphing tools (e.g. Graphana) is typically used for this. So, importing should probably be done directly to influxdb.

@devcide
Copy link

devcide commented Oct 6, 2021

I was not aware that Home Assistant does not support import of historical data, as such lets discard that idea. For me and my personal use case it is already amazing once i can use the vienna-smartmeter integration as the grid consumption in HA. This should work with your new release. Looking forward to it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants