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

Add sensor entities #7

Open
3 tasks
iMicknl opened this issue Apr 9, 2021 · 4 comments
Open
3 tasks

Add sensor entities #7

iMicknl opened this issue Apr 9, 2021 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed work-in-progres Work in Progress

Comments

@iMicknl
Copy link
Owner

iMicknl commented Apr 9, 2021

As requested on the Home Assistant Community:

I think would be nice to have a sensor for an network interface sent and received bytes. Maybe publish everything from a xpath expression. eg: “Device/PPP/Interfaces/Interface/Stats”

Sensor

  • Uptime Sensor (Device/DeviceInfo/UpTime)
  • Data usage

Binary Sensor:

  • UP/DOWN - LAN / WAN status (Device/IP/Interfaces/Interface[Alias='IP_DATA']/Status)

It could happen that those sensors are not available for every device, thus at start-up it should first check if it is available.

Would require iMicknl/python-sagemcom-api#12, so that we can combine multiple sensor updates in 1 call.

Examples: https://github.com/wuseman/SAGEMCOM-FAST-5370e-TELIA/blob/master/configuration-files/xpaths-wuseman

@iMicknl iMicknl added the enhancement New feature or request label Apr 9, 2021
@iMicknl iMicknl added work-in-progres Work in Progress and removed no-issue-activity labels May 17, 2021
@iMicknl iMicknl reopened this May 17, 2021
Repository owner deleted a comment from github-actions bot May 17, 2021
@iMicknl iMicknl added help wanted Extra attention is needed and removed no-issue-activity labels Jun 26, 2021
@iMicknl iMicknl reopened this Jun 26, 2021
Repository owner deleted a comment from github-actions bot Jul 7, 2021
@deviantintegral
Copy link

I discovered that UPnP / IGD bandwidth reporting is completely broken on the Bell Home Hub 2000. For example, you can download 100MB and the counter only increases by a fraction of that. However, the web UI looks to be correct and I can see the stats coming from the json / xpath API. Getting the bandwidth info out via the underlying library and this addon would be a great feature to add.

@iMicknl
Copy link
Owner Author

iMicknl commented Jan 15, 2023

@deviantintegral I have to say that I don't own this router anymore, thus I didn't prioritize the development in the last year..

@iMicknl
Copy link
Owner Author

iMicknl commented Jan 7, 2024

@deviantintegral can you share the sensor names and XPATH that you would like to see as a sensor?

@deviantintegral
Copy link

I think I've forgotten some of this over the past year.

Looking again, I see a POST to a URL-encoded form to create a statistic file like this:

{"request":{"id":68,"session-id":1301001031,"priority":false,"actions":[{"id":0,"method":"uploadBMStatisticsFile","xpath":"Device","parameters":{"startDate":"20240211","endDate":"20240217"},"event-id":"36"}],"cnonce":REDACTED,"auth-key":"REDACTED"}}

That responds with a link to a CSV (that gets deleted pretty quickly):

{
    "reply": {
        "actions": [
            {
                "callbacks": [
                    {
                        "parameters": {
                            "data": "/download/bee62b2a8cde284953ebea815ce96fd4/65d1345e/stats.csv"
                        },
                        "result": {
                            "code": 16777238,
                            "description": "XMO_NO_ERR"
                        },
                        "uid": 1,
                        "xpath": "Device"
                    }
                ],
                "error": {
                    "code": 16777238,
                    "description": "XMO_NO_ERR"
                },
                "id": 0,
                "uid": 1
            }
        ],
        "error": {
            "code": 16777216,
            "description": "XMO_REQUEST_NO_ERR"
        },
        "events": [],
        "id": 163,
        "uid": 0
    }
}

The CSV contains data like this:

NQS143356002268,<REDACTED-MAC-ADDRESS>,2024-02-17,1,1
NQS143356002268,<REDACTED-MAC-ADDRESS>,2024-02-17,0,0
NQS143356002268,<REDACTED-MAC-ADDRESS>,2024-02-17,7,3

I believe the second last column is download and the last is upload. The numbers mostly match the web UI, which turns them into percentages, but it's not exact.

However, I was sure I remembered seeing stats in JSON like other device data. I'll keep poking around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed work-in-progres Work in Progress
Projects
None yet
Development

No branches or pull requests

2 participants