When trying to setup HydroQuebec sensor for the first time I received an “Error while setting up platform hydroquebec”. After reading the log I fount the following error:
File "/usr/lib/python3.6/site-packages/pyhydroquebec/client.py", line 185, in _get_balances
balances.append(float(balance[:-2].replace(",", ".")))
ValueError: could not convert string to float: '-1\xa0627.47'
Balance: -1 627.47 (Yeah this is very unusual)
I suspect it is relate to my account been in credit (negative balance) or the space separation for the thousand. Before I submit a bug I would like to confirm with the community if isn’t something else since I’m new to HA . Any comment? Thanks.
Home Assistant release (hass --version
):
0.60.1
Python release (python3 --version
):
HASSIO - 3.6.3
Component/platform:
hydroquebec
Description of problem:
When trying to setup HydroQuebec sensor for the first time I received an “Error while setting up platform hydroquebec”. After reading the log I strongly suspect it is because presently my account is negative.
Expected:
Show my HydroQuebec account information
Problem-relevant configuration.yaml
entries and steps to reproduce:
# Weather prediction
sensor:
- platform: hydroquebec
username: xxxxxxxxxx
password: xxxxxxxxxx
contract: '#########'
monitored_variables:
- period_length
- period_total_days
- Add the config above to configuration.yaml
- Restart Pi3
- Look at the Log
Traceback (if applicable):
Error while setting up platform hydroquebec
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 171, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
return fut.result()
File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.6/site-packages/homeassistant/components/sensor/hydroquebec.py", line 108, in setup_platform
", ".join(hydroquebec_data.get_contract_list()))
File "/usr/lib/python3.6/site-packages/homeassistant/components/sensor/hydroquebec.py", line 176, in get_contract_list
self._fetch_data()
File "/usr/lib/python3.6/site-packages/homeassistant/components/sensor/hydroquebec.py", line 183, in _fetch_data
self.client.fetch_data()
File "/usr/lib/python3.6/site-packages/pyhydroquebec/client.py", line 296, in fetch_data
balances = self._get_balances()
File "/usr/lib/python3.6/site-packages/pyhydroquebec/client.py", line 185, in _get_balances
balances.append(float(balance[:-2].replace(",", ".")))
ValueError: could not convert string to float: '-1\xa0627.47'