Home Assistant release with the issue:
94.1
Last working Home Assistant release (if known):
I get this error since the first time I used the component (about 9 months ago)
Operating environment (Hass.io/Docker/Windows/etc.):
Hass.io on RPI 3B+
Component/platform:
https://www.home-assistant.io/components/hydroquebec/
Description of problem:
Each time I restart Home Assistant, I get this message from the component:
WARNING (MainThread) [homeassistant.components.sensor] Setup of platform hydroquebec is taking over 10 seconds.
Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):
- platform: hydroquebec
username: !secret HQ_username
password: !secret HQ_password
contract: '123456789'
scan_interval: 86400
monitored_variables:
- period_mean_daily_bill
- period_mean_daily_consumption
Traceback (if applicable):
Additional information:
Sometimes, the sensors fails to get new data, but I think it might be on Hydro Qu茅bec's side because even getting data through their app fails from times to times...
Same issue, the restart is slow due to this integration
I'm not able to make it working:
There is the log I got when I restart
2019-09-06 07:53:11 WARNING (MainThread) [homeassistant.components.sensor] Setup of platform hydroquebec is taking over 10 seconds.
2019-09-06 07:53:44 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform hydroquebec
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/src/homeassistant/homeassistant/components/hydroquebec/sensor.py", line 137, in async_setup_platform
contracts = await hydroquebec_data.get_contract_list()
File "/usr/src/homeassistant/homeassistant/components/hydroquebec/sensor.py", line 207, in get_contract_list
ret = await self._fetch_data()
File "/usr/src/homeassistant/homeassistant/components/hydroquebec/sensor.py", line 218, in _fetch_data
await self.client.fetch_data()
File "/usr/local/lib/python3.7/site-packages/pyhydroquebec/client.py", line 372, in fetch_data
hourly_data = yield from self._get_hourly_data(day_date, p_p_id)
File "/usr/local/lib/python3.7/site-packages/pyhydroquebec/client.py", line 309, in _get_hourly_data
json_output = yield from raw_res.json(content_type='text/json')
File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 1027, in json
headers=self.headers)
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8'
There is my config:
I have changed my contract number for the right one
sensor:
- platform: hydroquebec
username: !secret hq_user
password: !secret hq_password
contract: '123456789'
monitored_variables:
- period_total_bill
- period_length
- period_total_days
So, does it works?
same here, taking over 10sec and
```Log Details (ERROR)
Tue Sep 17 2019 23:07:22 GMT-0400 (heure d鈥櫭﹖茅 de l鈥橢st)
Error while setting up platform hydroquebec
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 149, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/src/homeassistant/homeassistant/components/hydroquebec/sensor.py", line 137, in async_setup_platform
contracts = await hydroquebec_data.get_contract_list()
File "/usr/src/homeassistant/homeassistant/components/hydroquebec/sensor.py", line 207, in get_contract_list
ret = await self._fetch_data()
File "/usr/src/homeassistant/homeassistant/components/hydroquebec/sensor.py", line 218, in _fetch_data
await self.client.fetch_data()
File "/usr/local/lib/python3.7/site-packages/pyhydroquebec/client.py", line 372, in fetch_data
hourly_data = yield from self._get_hourly_data(day_date, p_p_id)
File "/usr/local/lib/python3.7/site-packages/pyhydroquebec/client.py", line 309, in _get_hourly_data
json_output = yield from raw_res.json(content_type='text/json')
File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 1027, in json
headers=self.headers)
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8'
Same here. Any fix?
I've had this for quite a while as well. I tried directly executing the request from the command line (pyhydroquebec) and it worked - i.e. hydroquebec responded to the request, so it seems to be a homeassistant issue.
So I tracked down something. Apparently there is a PR needed to make it work, you can follow where it originated from here: https://github.com/home-assistant/home-assistant/issues/26189
and here is the PR: https://github.com/titilambert/pyhydroquebec/pull/33 @ncareau is the one handling it. I'll try to poke him again. From what I understand, hassio Is still using 2.2.2 instead of 2.4.0
is it just hassio having a problem with this ?
I can confirm it does not work with normal h-a install
Just tried it again and got this error instead:
2019-10-05 23:39:16 ERROR (MainThread) [homeassistant.components.hydroquebec.sensor] Error on receive last Hydroquebec data: No login form find
Most helpful comment
So I tracked down something. Apparently there is a PR needed to make it work, you can follow where it originated from here: https://github.com/home-assistant/home-assistant/issues/26189
and here is the PR: https://github.com/titilambert/pyhydroquebec/pull/33 @ncareau is the one handling it. I'll try to poke him again. From what I understand, hassio Is still using 2.2.2 instead of 2.4.0