ldotlopez / ideenergy

Programmatic access to consumer energy consumption from https://www.i-de.es/ (Spanish energy distributor)
GNU General Public License v3.0
12 stars 5 forks source link

Login error ideenergy.client.CommandError: Command not succesful: {'captcha': 'false'} #10

Open juacas opened 2 weeks ago

juacas commented 2 weeks ago

When trying to connect to i-idee the client raises an error. It seems that i-idee has changed the rest endpoint or something. This error is also affecting HA-ideenergy.

Best regards and thanks for this both projects.

Test case: Invoke basic request.

python -m ideenergy.cli -u registeredemail@gmail.com -p mypasswd --list-contract

The stack trace is:

Traceback (most recent call last):
  File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\desarrollo\workspaces\python\ideenergy\lib\site-packages\ideenergy\cli.py", line 106, in <module>
    asyncio.run(main())
  File "C:\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
    return future.result()
  File "C:\desarrollo\workspaces\python\ideenergy\lib\site-packages\ideenergy\cli.py", line 94, in main
    if data := await _main():
  File "C:\desarrollo\workspaces\python\ideenergy\lib\site-packages\ideenergy\cli.py", line 51, in _main
    contracts = await client.get_contracts()
  File "C:\desarrollo\workspaces\python\ideenergy\lib\site-packages\ideenergy\client.py", line 64, in _wrap
    await client.login()
  File "C:\desarrollo\workspaces\python\ideenergy\lib\site-packages\ideenergy\client.py", line 191, in login
    raise CommandError(data)
ideenergy.client.CommandError: Command not succesful: {'captcha': 'false'}
2024-09-01 18:14:26.807 ERROR base_events Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x00000280FFD0DAB0>
2024-09-01 18:14:26.817 ERROR base_events Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x00000280FFD3E6E0>, 334799.062)]']
connector: <aiohttp.connector.TCPConnector object at 0x00000280FFD0DB10>
2024-09-01 18:14:26.817 ERROR base_events Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x00000280FFB41E70>
transport: <_ProactorSocketTransport fd=764 read=<_OverlappedFuture cancelled>>
Traceback (most recent call last):
  File "C:\Python310\lib\asyncio\sslproto.py", line 690, in _process_write_backlog
    self._transport.write(chunk)
  File "C:\Python310\lib\asyncio\proactor_events.py", line 361, in write
    self._loop_writing(data=bytes(data))
  File "C:\Python310\lib\asyncio\proactor_events.py", line 397, in _loop_writing
    self._write_fut = self._loop._proactor.send(self._sock, data)
AttributeError: 'NoneType' object has no attribute 'send'
Exception ignored in: <function _SSLProtocolTransport.__del__ at 0x00000280FF3A5BD0>
Traceback (most recent call last):
  File "C:\Python310\lib\asyncio\sslproto.py", line 321, in __del__
  File "C:\Python310\lib\asyncio\sslproto.py", line 316, in close
  File "C:\Python310\lib\asyncio\sslproto.py", line 599, in _start_shutdown
  File "C:\Python310\lib\asyncio\sslproto.py", line 604, in _write_appdata
  File "C:\Python310\lib\asyncio\sslproto.py", line 712, in _process_write_backlog
  File "C:\Python310\lib\asyncio\sslproto.py", line 726, in _fatal_error
  File "C:\Python310\lib\asyncio\proactor_events.py", line 151, in _force_close
  File "C:\Python310\lib\asyncio\base_events.py", line 750, in call_soon
  File "C:\Python310\lib\asyncio\base_events.py", line 515, in _check_closed
RuntimeError: Event loop is closed
juacas commented 1 week ago

Answer from i-DE. It seems the days of this integration had gone! :(

En respuesta a su correo electrónico, le informamos de que debido a problemas de

seguridad solo se puede acceder a través del login sin utilizar ningún tipo de script, etc.

Gracias por contactar con i-DE.

Un cordial saludo