Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON structure unexpected by the API - Device/DeviceInfo #129

Closed
M4D1NG3R opened this issue Feb 16, 2022 · 1 comment · Fixed by #130
Closed

JSON structure unexpected by the API - Device/DeviceInfo #129

M4D1NG3R opened this issue Feb 16, 2022 · 1 comment · Fixed by #130

Comments

@M4D1NG3R
Copy link
Contributor

M4D1NG3R commented Feb 16, 2022

Model information

Key Value
Model name Speedport Pro
Hardware Version 03
Software Version 120133.4.5.033.4

Describe the bug

The JSON returned by "Device/DeviceInfo" has a structure unexpected by the API:

{'device_info': {'device_category': '', 'manufacturer': 'DT', ...}}

Therefore, the formatting (DeviceInfo(**data)) returns 'none' for each attribute

**with version 1.0.6 the error is not occurring
This is currently also breaking the Home Assistant custom component **

workaround for Home Assistant OS useres:

  1. download sagemcom_api from GitHub
  2. make changes as seen below / in the PR
  3. copy sagemcom_api folder to config\deps\lib\pythonX.X
  4. edit custom_components/sagemcom_fast/manifest.json
    from
    "requirements": [ "sagemcom_api===1.0.7" ],
    to
    "requirements": [],

If you run into any problem just comment.

To Reproduce

Steps to reproduce the behavior:

using
device_info = await client.get_device_info()

Screenshots

image

image

Additional context

a workaround is to replace in client.py:

...
try:
    data = await self.get_value_by_xpath("Device/DeviceInfo")       
except UnknownPathException:
...

with

...
try:
    data = await self.get_value_by_xpath("Device/DeviceInfo")
    return DeviceInfo(**data.get("device_info"))
except UnknownPathException:
...

[bug]

@M4D1NG3R M4D1NG3R changed the title Unsupported F@st model Telekom Speedport Pro JSON unexpected by the API - Device/DeviceInfo Feb 16, 2022
@M4D1NG3R M4D1NG3R changed the title JSON unexpected by the API - Device/DeviceInfo JSON structure unexpected by the API - Device/DeviceInfo Feb 16, 2022
@M4D1NG3R
Copy link
Contributor Author

@iMicknl do you need anything else from my side?

@iMicknl iMicknl linked a pull request Feb 27, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant