home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.5k stars 30.7k forks source link

Linky sensor : cannot log to Enedis again #20525

Closed CygaLV closed 5 years ago

CygaLV commented 5 years ago

Hi ! It seems that the problem reappeared (see https://github.com/home-assistant/home-assistant/pull/17110 ) ! It worked fine for me until recently (1 or 2 weeks I guess). And now it fails saying my password and user are wrong. PyLinky version I have is 0.1.8. It is the latest right ? I'm using it on a Synology NAS DS216j.

I modified the python source file to expose the user and names, and I can guarantee they are valid.

Trying to trace the execution, it seems that it fails finding the cookie iPlanetDirectoryPro. I checked with the debug options of my web browser, and locally I've got this cookie... I've also checked the SunQueryParamsString, and it seems that it is good.

One thing though, now, when connecting on the Enedis webpage, it doesn't bring you to your user space, but it rather do several redirections (during these redirections the cookie seems to be not accessible) and brings to you to the website welcome page (iPlanetDirectoryPro) is then available.

Am I the only one with this issue ?

royto commented 5 years ago

Seems pyLinky new version 0.2.1 fix an issue with login: https://github.com/Pirionfr/pyLinky/releases/tag/v0.2.1

Currently version 0.1.8 is used

lunanovaz commented 5 years ago

I confirm, forcing pyLinky to 0.2.1 is solving the issue on my hass 0.88.0

royto commented 5 years ago

Should be fixed by commit where pylinky is upgraded to 0.3.0

royto commented 5 years ago

Sadly, the 0.89 does not fix the linky component

Now I had the following error:

linky: Error on device update!

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 348, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/util/__init__.py", line 224, in wrapper
    result = method(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/sensor/linky.py", line 87, in update
    _LOGGER.debug(json.dumps(self._client.get_data(), indent=2))
  File "/usr/local/lib/python3.7/site-packages/pylinky/client.py", line 202, in get_data
    formatted_data[t] = self.format_data(self._data[t])
  File "/usr/local/lib/python3.7/site-packages/pylinky/client.py", line 142, in format_data
    start_date = datetime.datetime.strptime(data.get("periode").get("dateDebut"), "%d/%m/%Y").date()
AttributeError: 'NoneType' object has no attribute 'get
pimoon commented 5 years ago

same issue here

Nemesis24 commented 5 years ago

same for me

royto commented 5 years ago

I investigate on this issue and I fix the pb in the pylinky lib. PR is in progress.

Issue linked to hourly consumption which is not activate by default. As a workaround, you can activate hourly consumption in your enedis account.