platysma / vienna-smartmeter

Python library to access the Wiener Netze Smart Meter private API
MIT License
75 stars 12 forks source link

API Changed Again ..... #177

Open ghhausi opened 3 days ago

ghhausi commented 3 days ago

Hi, is somebody still using this lib (or the branch of "fleinze") ?? --> No longer works since 6.Nov.24

The URL for "verbrauch" so far was like: _https://api.wstw.at/gateway/WN_SMART_METER_PORTAL_API_B2C/1.0/messdaten/12007xxxx/AT0010000000000000001000006xxxxxx/verbrauch?dateFrom=2024-11-07T00%3A00%3A00.000Z&dateTo=2024-11-11T16%3A20%3A37.853Z&period=DAY&accumulate=False&offset=0&dayViewResolution=QUARTER-HOUR_

Now it should be something like: https://service.wienernetze.at/sm/api/user/messwerte/bewegungsdaten?geschaeftspartner=12007xxxx&zaehlpunktnummer=AT0010000000000000001000006xxxxxx&rolle=V002&zeitpunktVon=2024-11-09T23%3A00%3A00.000Z&zeitpunktBis=2024-11-10T22%3A59%3A59.999Z&aggregat=NONE

The response ("values") is different as well

Does anyone have/work on a fix ??

regards Gerhard PS: ... still analyzing .....

spinnaker1 commented 2 days ago

i confirm API changed since 2024-11-06. I tried, but can't fix the code myself.

@platysma Is it possible to fix the library for the changed API?

ghhausi commented 2 days ago

I modified "vienna_smartmeter.py" to work for my purposes (testing is ongoing) viennasmart_meter_GH.py.txt modifications are only in def verbrauch_raw(self, date_from, date_to=None, zaehlpunkt=None, rolle=None) def verbrauch(self, date_from, date_to=None, zaehlpunkt=None, rolle=None) old code is left in but commented out

modifications are:

rest is unchanged --> and untested (e.g. methods for reading profile, zaehlpunkte work - but I did not use/test e.g. "consumptions", "pmaxReadings" .... and so on) FYI: "rolle" is supplied only when I want to read my PV-Einspeisung data on a 2nd Zaehlpunkt usage will be then: sm_einspeisung = api.verbrauch(a, zaehlpunkt=zp_einspeisung, rolle="E002")

please note: response json changed as well -> now "values" is: "values": [
{ "wert": 7.233, "zeitpunktVon": "2024-11-03T23:00:00Z", "zeitpunktBis": "2024-11-04T23:00:00Z", "geschaetzt": false },
...

Please see some analysis in the following text file viennasmartmeter analysis req-response.txt or use "developer extensions" e.g. in Chrome

Please use the modifications as you like .... best regards Gerhard

spinnaker1 commented 5 hours ago

https://github.com/user-attachments/files/17718424/viennasmart_meter_GH.py.txt

Works! Thanks!