myTselection / telenet_telemeter

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

unable to login #50

Closed tdoolaege closed 1 month ago

tdoolaege commented 1 month ago

Hi, I had your tool for a while now. and it worked perfectly until about a week ago (i think). for some reason i tried removing the hacs plugin and reinstalling it. But it resolved to nothing. all i see it wifi button.

i always used my old login txxxxxx, but now it doesn't work anymore. i have tried with my telenet login but still nothing. Pic below shows with every possible login i knew i had for telenet. (cannot reset my passw for txxxxxx)

image

when i check the logging i see 3 errors image

this is what the loggings are showing.

Logger: homeassistant.components.sensor
Bron: helpers/entity_platform.py:361
integratie: Sensor (documentatie, problemen)
Eerst voorgekomen: 2 oktober 2024 om 22:03:25 (9 gebeurtenissen)
Laatst gelogd: 20:07:42

Error while setting up telenet_telemeter platform for sensor
Traceback (most recent call last):
  File "/config/custom_components/telenet_telemeter/utils.py", line 81, in callTelenet
    assert response.status_code == expectedStatusCode
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 119, 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 166, in _forced_update
    await self._hass.async_add_executor_job(lambda: self._session.login(self._username, self._password))
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/telenet_telemeter/sensor.py", line 166, 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 119, in login
    self.callTelenet("https://api.prd.telenet.be/ocapi/oauth/userdetails","login")
  File "/config/custom_components/telenet_telemeter/utils.py", line 103, in callTelenet
    assert response.status_code == expectedStatusCode
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

the middle error show below image

and the last error showing:

Logger: homeassistant.helpers.entity
Bron: helpers/entity.py:942
Eerst voorgekomen: 2 oktober 2024 om 22:03:55 (3 gebeurtenissen)
Laatst gelogd: 20:08:12

Update for switch.telenet_telemeter_wifi fails
Traceback (most recent call last):
  File "/config/custom_components/telenet_telemeter/utils.py", line 81, in callTelenet
    assert response.status_code == expectedStatusCode
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1300, in async_device_update
    await self.async_update()
  File "/config/custom_components/telenet_telemeter/switch.py", line 210, in async_update
    await self._data.update()
  File "/config/custom_components/telenet_telemeter/switch.py", line 167, in update
    await self._update()
  File "/config/custom_components/telenet_telemeter/switch.py", line 160, in _update
    await self.force_update()
  File "/config/custom_components/telenet_telemeter/switch.py", line 123, in force_update
    await self._hass.async_add_executor_job(lambda: self._session.login(self._username, self._password))
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/telenet_telemeter/switch.py", line 123, 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 119, in login
    self.callTelenet("https://api.prd.telenet.be/ocapi/oauth/userdetails","login")
  File "/config/custom_components/telenet_telemeter/utils.py", line 103, in callTelenet
    assert response.status_code == expectedStatusCode
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

probably its stupidity on my behalf ... hope you can help

KingT commented 1 month ago

Same issue here. After removing and adding the hub again I only see the option to disable/enable my wifi again on the router.

myTselection commented 1 month ago

The username to use should be the same of the one you use to login on 'MijnTelenet' website. The old txxxx login aren't supported any longer, this should probably be your email adres. Best to first test on the standard website.

The release 1.7.x were related to internet bundle fixes. I'll check further later today if I can fix something still, the issue is that I don't have a bundle myself, so I can't validate all cases... R1.7.1 is showing all sensors again for me. If you'd see some issues, it would be very helpful if debug could be enabled and logs shared?

tdoolaege commented 1 month ago


``` Logger: homeassistant.components.sensor
Bron: helpers/entity_platform.py:361
integratie: Sensor (documentatie, problemen)
Eerst voorgekomen: 19:41:02 (1 gebeurtenissen)
Laatst gelogd: 19:41:02

Error while setting up telenet_telemeter platform for sensor
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 974, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/simplejson/__init__.py", line 514, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/simplejson/decoder.py", line 386, in decode
    obj, end = self.raw_decode(s)
               ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/simplejson/decoder.py", line 416, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 119, 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 199, in _forced_update
    dailyUsage = await self._hass.async_add_executor_job(lambda: self._session.productDailyUsage("internet", productIdentifier, startDate,endDate))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/telenet_telemeter/sensor.py", line 199, in <lambda>
    dailyUsage = await self._hass.async_add_executor_job(lambda: self._session.productDailyUsage("internet", productIdentifier, startDate,endDate))
                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/telenet_telemeter/utils.py", line 186, in productDailyUsage
    return response.json()
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 978, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
tdoolaege commented 1 month ago

home-assistant_telenet_telemeter_2024-10-05T17-44-30.821Z.log

certain of correct login, cause i use the credentials through bitwarden copy/paste. i use a pack of "ONEup for 1 " maybe that could be it..?

still thnx for making this though really appreciate the work you put into it.

jorisrymenants commented 1 month ago

I have the same error in my log as tdoolaege

myTselection commented 1 month ago

thx for reporting! I found some family member with a bundle subscription so I could test and fix these flows now myself, I hope it's now all fixed as of R1.8.1.

KingT commented 1 month ago

Great work! Works like a charm now 👍 Thanks!

tdoolaege commented 1 month ago

I just made a mistake by changing my subscription. As it was cheaper 🤪. Its stil in activation mode will update..but it sounds promissing great work