home-assistant-ecosystem / python-glances-api

Python API for interacting with Glances
MIT License
4 stars 8 forks source link

Add/improve support for Glances v4 container & network format and improve v4 unit tests #42

Closed wittypluck closed 4 months ago

wittypluck commented 4 months ago

This PR adds support for the Glances v4 container format change, while retaining compatibility with earlier versions of HA. => Fixes issue #41

The PR also addresses another issue in Glances v4, where Glances sends an incomplete network sensor when the module is disabled. The code was reworked to be more robust when Glances sends incomplete data.

Finally the PR adds dedicated unit tests for v4 data (parametrized test for get_ha_sensor_data).

Related HA issue : https://github.com/home-assistant/core/issues/118632 Related Glances issue : https://github.com/nicolargo/glances/issues/2815

As there are now 3 different formats of API for the containers, I have opted for a test on the Glances version rather than looking for the various possibilities.

To sum up the formats :

wittypluck commented 4 months ago

Hello @fabaff, I think this PR addresses all the issues raised until now on Glances v4 in Home Assistant. Let me know if you have any comments, and if you can package an updated version of the library. Thanks !

wittypluck commented 4 months ago

Thank you !