zachcheatham / ha-omada

Home Assistant TP-Link Omada Integration
186 stars 26 forks source link

Fix gateway rx_rate and tx_rate #99

Closed h3llrais3r closed 2 months ago

h3llrais3r commented 2 months ago

The gateway rx_rate and tx_rate is not (longer) available via the /devices api endpoint details. Instead, we have to call / device/gateways/ api endpoint to get the gateway details. From these details, we get the portStats for the WAN port and get the rxRate and txRate values to populate the rx_rate and tx_rate values. So rx_rate and tx_rate of the gateway represents the internet WAN download/upload speed. Fixes https://github.com/zachcheatham/ha-omada/issues/92

h3llrais3r commented 2 months ago

@zachcheatham, could it be an idea to change the rouding precision of the rx_rate and tx_rate values to 3 digits instead of 2? This would also show a value for very low speeds. Please provide your feedback, and I'll adapt when needed. image

h3llrais3r commented 2 months ago

I would also like to make the scan_interval and scan_interval_details configurable (best with a minimum of 30s?). I you agree, I'll commit the changes as well. It will look like this: image

I'm already running it like this, and it works perfectly (instead of the hardcoded 30s and 120s values).

zachcheatham commented 2 months ago

This looks good. Thanks for taking the time to put it together. I should get a chance to test this week.

I would also like to make the scan_interval and scan_interval_details configurable (best with a minimum of 30s?). I you agree, I'll commit the changes as well. It will look like this: I'm already running it like this, and it works perfectly (instead of the hardcoded 30s and 120s values).

Go ahead and make a PR for this, it would be useful for those who are needing higher values as well.

@zachcheatham, could it be an idea to change the rouding precision of the rx_rate and tx_rate values to 3 digits instead of 2? This would also show a value for very low speeds. Please provide your feedback, and I'll adapt when needed.

If you want to include that change in this pull, feel free!

h3llrais3r commented 2 months ago

Done, I'll make separate PR for other changes.

h3llrais3r commented 2 months ago

@zachcheatham Replaced by https://github.com/zachcheatham/ha-omada/pull/100 and https://github.com/zachcheatham/ha-omada/pull/101