myTselection / telenet_telemeter

Telenet Telemeter Home Assistant custom component HACS for Belgian ISP and mobile phone network traffic.
MIT License
28 stars 5 forks source link

Error while setting up telenet_telemeter platform for sensor - AssertionError #15

Closed tjorim closed 1 year ago

tjorim commented 1 year ago
Logger: homeassistant.components.sensor
Source: custom_components/telenet_telemeter/utils.py:81
Integration: Sensor (documentation, issues)
First occurred: 12:45:12 AM (1 occurrences)
Last logged: 12:45:12 AM

Error while setting up telenet_telemeter platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 110, in async_setup_entry
    await dry_setup(hass, config, async_add_devices)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 51, in dry_setup
    await data_internet._forced_update()
  File "/config/custom_components/telenet_telemeter/sensor.py", line 144, in _forced_update
    await self._hass.async_add_executor_job(lambda: self._session.login(self._username, self._password))
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 144, in <lambda>
    await self._hass.async_add_executor_job(lambda: self._session.login(self._username, self._password))
  File "/config/custom_components/telenet_telemeter/utils.py", line 81, in login
    assert response.status_code == 200
AssertionError
myTselection commented 1 year ago

Just tested again myself and login is still working fine for me. Looking at your error, it might be a wrong username/password is provided. Make sure to use an email address as username, the old username login is no longer supported by Telenet. You can try to login on the website of telenet itself 'Mijn Telenet' to validate your credentials are correct. But some Telenet backend changes are ongoing these days too, so it might be your account is already migrated to their new backend. This integration is not yet made compatible with the new Telenet backend. As soon as migration is completed at their side, I'll take a look into it...

myTselection commented 1 year ago

Now I'm getting similar exception. Probably Telenet backend migrations are progressing. Will validate in coming days and try to make the integration compatibel with Telenet backend again.

arszagi commented 1 year ago

hi, I also have the same problem, is it possible that it is because I am in Telenet business?

myTselection commented 1 year ago

hmm, just wanted to start in depth investigation, but I do notice it works again without any changes. Not sure if Telenet has restored their backend and if any changes are still to be expected. But for now, a simple reload or HA restart solved it for me.

@arszagi: sorry, I have no view on Telenet Business account differences vs std. Feel free to open another ticket If you would see any specific exception in the logs related to business account.

tjorim commented 1 year ago

Just tried it again but still getting the assertion error:

Logger: homeassistant.components.sensor
Source: custom_components/telenet_telemeter/utils.py:81
Integration: Sensor (documentation, issues)
First occurred: 06:24:46 (2 occurrences)
Last logged: 06:27:08

Error while setting up telenet_telemeter platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 113, in async_setup_entry
    await dry_setup(hass, config, async_add_devices)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 52, in dry_setup
    await data_internet._forced_update()
  File "/config/custom_components/telenet_telemeter/sensor.py", line 147, in _forced_update
    await self._hass.async_add_executor_job(lambda: self._session.login(self._username, self._password))
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 147, in <lambda>
    await self._hass.async_add_executor_job(lambda: self._session.login(self._username, self._password))
  File "/config/custom_components/telenet_telemeter/utils.py", line 81, in login
    assert response.status_code == 200
AssertionError
myTselection commented 1 year ago

I'll check again in couple of days, it seems Telenet is planning backend changes again:

Mijn Telenet tijdelijk niet beschikbaar

Van zaterdag 11/3 22u tot zondag 12/3 20u verbeteren we onze diensten. Tijdens de werken kan je Mijn Telenet niet gebruiken.

tjorim commented 1 year ago

Tested again on version 0.9.3:

Logger: homeassistant.components.sensor
Source: custom_components/telenet_telemeter/utils.py:60
Integration: Sensor (documentation, issues)
First occurred: 4:38:01 PM (1 occurrences)
Last logged: 4:38:01 PM

Error while setting up telenet_telemeter platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 118, in async_setup_entry
    await dry_setup(hass, config, async_add_devices)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 51, in dry_setup
    await data_internet._forced_update()
  File "/config/custom_components/telenet_telemeter/sensor.py", line 153, in _forced_update
    await self._hass.async_add_executor_job(lambda: self._session.login(self._username, self._password))
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 153, in <lambda>
    await self._hass.async_add_executor_job(lambda: self._session.login(self._username, self._password))
  File "/config/custom_components/telenet_telemeter/utils.py", line 76, in login
    self.callTelenet("https://api.prd.telenet.be/ocapi/oauth/userdetails","login", None, 200)
  File "/config/custom_components/telenet_telemeter/utils.py", line 60, in callTelenet
    assert response.status_code == expectedStatusCode
AssertionError
myTselection commented 1 year ago

are you sure you are using the correct username and password? Since some time Telenet doesn't support the old usernames any longer, only email address is supported. Please confirm your credentials by logging out and in on the Telenet website itself.

tjorim commented 1 year ago

Yes, I can access this information with the same credentials: image

myTselection commented 1 year ago

Strange, can't explain. Could you try to change your Telenet password? Maybe some special character in your password is not handled correctly...

myTselection commented 1 year ago

dear, was this issue resolved for you? Any idea what was the root cause? I see similar issue reported by another user...

myTselection commented 1 year ago

expected this is no longer an issue