titilambert / pyhydroquebec

DEPRECATED - Get your consumption data from your HydroQuebec account (www.hydroquebec.com)
Apache License 2.0
94 stars 44 forks source link

Broken with aiohttp==3.2.1 #16

Closed aarnaud closed 5 years ago

aarnaud commented 6 years ago

I think pyhydroquebec is broken with the last version of home-assistant that use aiohttp==3.2.1

2018-06-11 15:25:00 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform hydroquebec
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
    return fut.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/sensor/hydroquebec.py", line 109, in async_setup_platform
    contracts = yield from hydroquebec_data.get_contract_list()
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/sensor/hydroquebec.py", line 180, in get_contract_list
    ret = yield from self._fetch_data()
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/sensor/hydroquebec.py", line 190, in _fetch_data
    await self.client.fetch_data()
  File "/opt/home-assistant/deps/lib/python3.5/site-packages/pyhydroquebec/client.py", line 387, in fetch_data
    daily_data = yield from self._get_daily_data(p_p_id, start_date, end_date)
  File "/opt/home-assistant/deps/lib/python3.5/site-packages/pyhydroquebec/client.py", line 276, in _get_daily_data
    timeout=self._timeout)
  File "/opt/home-assistant/deps/lib/python3.5/site-packages/aiohttp/client.py", line 313, in _request
    ssl=ssl, proxy_headers=proxy_headers, traces=traces)
  File "/opt/home-assistant/deps/lib/python3.5/site-packages/aiohttp/client_reqrep.py", line 191, in __init__
    url2 = url.with_query(params)
  File "/opt/home-assistant/deps/lib/python3.5/site-packages/yarl/__init__.py", line 851, in with_query
    new_query = self._get_str_query(*args, **kwargs)
  File "/opt/home-assistant/deps/lib/python3.5/site-packages/yarl/__init__.py", line 819, in _get_str_query
    "should be str or int, got {!r}".format(v))
TypeError: Invalid variable type: mapping value should be str or int, got None
aarnaud commented 6 years ago

end_date has None as value for _get_daily_data()

titilambert commented 5 years ago

Hello ! I just tested with aiohttp==3.2.1 and aiohttp==3.4.4 and it's working for my account :/ What kind of account do you have ?

titilambert commented 5 years ago

I'm closing this one. Reopen it if you still have the issue