toaomatis / greenchoice-variable-tariffs

Home Assistant Greenchoice Variable Tarrifs Sensor
MIT License
2 stars 0 forks source link

API doesn’t seem to work anymore #12

Open dickwolff opened 1 year ago

dickwolff commented 1 year ago

Hi,

First of all, happy new year!

I just added this sensor to my HA setup and after setting it up and rebooting I get this message in my logs:

Logger: homeassistant.components.sensor
Source: helpers/aiohttp_client.py:52 
Integration: Sensor (documentation, issues) 
First occurred: 11:32:08 (1 occurrences) 
Last logged: 11:32:08

Error while setting up greenchoice_variable_tariffs platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/greenchoice_variable_tariffs/sensor.py", line 80, in async_setup_platform
    await greenchoice_api.async_update()
  File "/config/custom_components/greenchoice_variable_tariffs/sensor.py", line 142, in async_update
    json = await response.json()
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 52, in json
    return await super().json(*args, loads=loads, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1103, 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://www.greenchoice.nl/umbraco/surface/quotation/GetQuotation')

After looking on here if there were similar issues I found the API URL in another issue. However that now returns a 404 page, which then seems to correspond with the error from HA.

Is it possible the API has been moved? Is there something else I’m missing what could be the reason this now pops up?

toaomatis commented 1 year ago

This is most likely due to the fact that Green Choice changed their API and / or not providing any tariffs for the quotation.