dreautall / ha-stromnetzgraz

Home Assistant Custom Component for Stromnetz Graz
MIT License
15 stars 1 forks source link

Attempt to decode JSON with unexpected mimetype #3

Closed wieluk closed 1 year ago

wieluk commented 1 year ago

Hey, i am getting this error message:

Logger: sngraz.sngraz
Source: /usr/local/lib/python3.10/site-packages/sngraz/sngraz.py:111
First occurred: 16:10:50 (1 occurrences)
Last logged: 16:10:50

Error connecting to API: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://webportal.stromnetz-graz.at/api/getMeterReading')
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/sngraz/sngraz.py", line 107, in _query
    result = await resp.json()
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1104, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://webportal.stromnetz-graz.at/api/getMeterReading')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/sngraz/sngraz.py", line 107, in _query
    result = await resp.json()
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1104, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://webportal.stromnetz-graz.at/api/getMeterReading')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/sngraz/sngraz.py", line 107, in _query
    result = await resp.json()
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1104, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://webportal.stromnetz-graz.at/api/getMeterReading')
dreautall commented 1 year ago

Hm that's odd. Does everything work on the official web portal, https://webportal.stromnetz-graz.at/login? getMeterReading gets called when you visit "Verbrauch und Lastdaten", it should show some data there.

wieluk commented 1 year ago

Yea it does show data but they changed it to ime for me yesterday I redownloaded your Integration but I still get this error

wieluk commented 1 year ago

Maybe it had something to do with a incomplete set of data because the day before yesterday only had data of the half day. Now it works. But the data is shifted for example the data for march 29. Is shown as march 28. In home assistant. Maybe this will change with data tomorrow because for yesterday it shows only 1 datapoint.