iMicknl/python-sagemcom-api

[FAST3890V2] Incompatible model using example code

slimcdk opened this issue · 5 comments

Hi. I got this model:

Key Value
Board ID: FAST3890_D0
Symmetric CPU Threads: 2
Build Timestamp: 20190823_1045
Linux Version: 3.14.28-Prod_6.1.2mp2
Wireless Driver Version: 7.14.164.17 (r683874)
Systime: 2020-05-21T11:04:28+01:00
Standard Specification Compliant Docsis 3.1
Hardware Version FAST3890V2 Rev:V2.0
Software Version FAST3890_TDC_50.10.22.T1
Cable Modem Serial Number DM1705907002004
CM certificate Installed

I tried your example script with my informations, but received this error:

christian@desktop:~$ python3 sagemcom.py 
Traceback (most recent call last):
  File "sagemcom.py", line 19, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "sagemcom.py", line 9, in main
    logged_in = await sagemcom.login()
  File "/home/christian/.local/lib/python3.8/site-packages/sagemcom_api/client.py", line 204, in login
    response = await self.__api_request_async([actions], True)
  File "/home/christian/.local/lib/python3.8/site-packages/sagemcom_api/client.py", line 149, in __api_request_async
    async with session.post(api_host, data="req=" + json.dumps(payload, separators=(',', ':'))) as response:
  File "/home/christian/.local/lib/python3.8/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/home/christian/.local/lib/python3.8/site-packages/aiohttp/client.py", line 504, in _request
    await resp.start(conn)
  File "/home/christian/.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 847, in start
    message, payload = await self._protocol.read()  # type: ignore  # noqa
  File "/home/christian/.local/lib/python3.8/site-packages/aiohttp/streams.py", line 591, in read
    await self._waiter
aiohttp.client_exceptions.ServerDisconnectedError: None

Using Python 3.8.2

Have you tried both encryption methods? (md5 and sha512). Could you try to log in via the router web interface, and run the following command via your console.

$.xmo.getValuesTree("Device/DeviceInfo")

Yea, I have tried both, which yields same error.

This is what I get from running that command.

Uncaught TypeError: Cannot read property 'getValuesTree' of undefined
    at <anonymous>:1:7
(anonymous) @ VM210:1

image

Here are the full scripts and logs.

Python 3.8.2 and MD5

christian@desktop:~$ cat sagemcom.py && python3 sagemcom.py 
import asyncio
from sagemcom_api import SagemcomClient, EncryptionMethod

async def main():
    # Choose EncryptionMethod.MD5 or EncryptionMethod.SHA512
    sagemcom = SagemcomClient('192.168.100.1', 'admin', '<my password>', EncryptionMethod.MD5)

    ## Login method could be used to test the credentials
    logged_in = await sagemcom.login()

    if logged_in:
        device_info = await sagemcom.get_device_info()
        print(device_info)

    ## Or just call get_device_info() directly
    device_info = await sagemcom.get_device_info()
    print(device_info)

asyncio.run(main())
Traceback (most recent call last):
  File "sagemcom.py", line 19, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "sagemcom.py", line 9, in main
    logged_in = await sagemcom.login()
  File "/home/christian/.local/lib/python3.8/site-packages/sagemcom_api/client.py", line 204, in login
    response = await self.__api_request_async([actions], True)
  File "/home/christian/.local/lib/python3.8/site-packages/sagemcom_api/client.py", line 149, in __api_request_async
    async with session.post(api_host, data="req=" + json.dumps(payload, separators=(',', ':'))) as response:
  File "/home/christian/.local/lib/python3.8/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/home/christian/.local/lib/python3.8/site-packages/aiohttp/client.py", line 504, in _request
    await resp.start(conn)
  File "/home/christian/.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 847, in start
    message, payload = await self._protocol.read()  # type: ignore  # noqa
  File "/home/christian/.local/lib/python3.8/site-packages/aiohttp/streams.py", line 591, in read
    await self._waiter
aiohttp.client_exceptions.ServerDisconnectedError: None

Python 3.8.2 and SHA512

christian@desktop:~$ cat sagemcom.py && python3 sagemcom.py 
import asyncio
from sagemcom_api import SagemcomClient, EncryptionMethod

async def main():
    # Choose EncryptionMethod.MD5 or EncryptionMethod.SHA512
    sagemcom = SagemcomClient('192.168.100.1', 'admin', '<my password>', EncryptionMethod.SHA512)

    ## Login method could be used to test the credentials
    logged_in = await sagemcom.login()

    if logged_in:
        device_info = await sagemcom.get_device_info()
        print(device_info)

    ## Or just call get_device_info() directly
    device_info = await sagemcom.get_device_info()
    print(device_info)

asyncio.run(main())
Traceback (most recent call last):
  File "sagemcom.py", line 19, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "sagemcom.py", line 9, in main
    logged_in = await sagemcom.login()
  File "/home/christian/.local/lib/python3.8/site-packages/sagemcom_api/client.py", line 204, in login
    response = await self.__api_request_async([actions], True)
  File "/home/christian/.local/lib/python3.8/site-packages/sagemcom_api/client.py", line 149, in __api_request_async
    async with session.post(api_host, data="req=" + json.dumps(payload, separators=(',', ':'))) as response:
  File "/home/christian/.local/lib/python3.8/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/home/christian/.local/lib/python3.8/site-packages/aiohttp/client.py", line 504, in _request
    await resp.start(conn)
  File "/home/christian/.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 847, in start
    message, payload = await self._protocol.read()  # type: ignore  # noqa
  File "/home/christian/.local/lib/python3.8/site-packages/aiohttp/streams.py", line 591, in read
    await self._waiter
aiohttp.client_exceptions.ServerDisconnectedError: None

@slimcdk it looks like your FAST3890V2 model is using a different firmware than the others tested. I have the FAST3890V3 myself, which works like a charm. If you are not able to run $.xmo.getValuesTree("Device/DeviceInfo"), this means that they don't have the same internal API available unfortunately.

If you look in the Network tab of your console, do you see any XHR requests?

Yea, I guess you are right :/

There is no XHR type requests.
image