mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Add support for Glances v4 (#117664)
This commit is contained in:
parent
0112c7fcfd
commit
0c37a065ad
@ -73,7 +73,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
async def get_api(hass: HomeAssistant, entry_data: dict[str, Any]) -> Glances:
|
||||
"""Return the api from glances_api."""
|
||||
httpx_client = get_async_client(hass, verify_ssl=entry_data[CONF_VERIFY_SSL])
|
||||
for version in (3, 2):
|
||||
for version in (4, 3, 2):
|
||||
api = Glances(
|
||||
host=entry_data[CONF_HOST],
|
||||
port=entry_data[CONF_PORT],
|
||||
@ -100,7 +100,7 @@ async def get_api(hass: HomeAssistant, entry_data: dict[str, Any]) -> Glances:
|
||||
)
|
||||
_LOGGER.debug("Connected to Glances API v%s", version)
|
||||
return api
|
||||
raise ServerVersionMismatch("Could not connect to Glances API version 2 or 3")
|
||||
raise ServerVersionMismatch("Could not connect to Glances API version 2, 3 or 4")
|
||||
|
||||
|
||||
class ServerVersionMismatch(HomeAssistantError):
|
||||
|
@ -6,5 +6,5 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/glances",
|
||||
"iot_class": "local_polling",
|
||||
"loggers": ["glances_api"],
|
||||
"requirements": ["glances-api==0.6.0"]
|
||||
"requirements": ["glances-api==0.7.0"]
|
||||
}
|
||||
|
@ -949,7 +949,7 @@ gios==4.0.0
|
||||
gitterpy==0.1.7
|
||||
|
||||
# homeassistant.components.glances
|
||||
glances-api==0.6.0
|
||||
glances-api==0.7.0
|
||||
|
||||
# homeassistant.components.goalzero
|
||||
goalzero==0.2.2
|
||||
|
@ -778,7 +778,7 @@ getmac==0.9.4
|
||||
gios==4.0.0
|
||||
|
||||
# homeassistant.components.glances
|
||||
glances-api==0.6.0
|
||||
glances-api==0.7.0
|
||||
|
||||
# homeassistant.components.goalzero
|
||||
goalzero==0.2.2
|
||||
|
@ -38,8 +38,9 @@ async def test_entry_deprecated_version(
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
mock_api.return_value.get_ha_sensor_data.side_effect = [
|
||||
GlancesApiNoDataAvailable("endpoint: 'all' is not valid"),
|
||||
HA_SENSOR_DATA,
|
||||
GlancesApiNoDataAvailable("endpoint: 'all' is not valid"), # fail v4
|
||||
GlancesApiNoDataAvailable("endpoint: 'all' is not valid"), # fail v3
|
||||
HA_SENSOR_DATA, # success v2
|
||||
HA_SENSOR_DATA,
|
||||
]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user