Add if subscription is active to cloud status (#68266)

pull/68293/head
Paulus Schoutsen 2022-03-17 01:51:07 -07:00 committed by GitHub
parent d021222d6d
commit aabfa08834
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -420,7 +420,11 @@ async def _account_data(hass: HomeAssistant, cloud: Cloud):
"""Generate the auth data JSON response."""
if not cloud.is_logged_in:
return {"logged_in": False, "cloud": STATE_DISCONNECTED}
return {
"logged_in": False,
"cloud": STATE_DISCONNECTED,
"http_use_ssl": hass.config.api.use_ssl,
}
claims = cloud.claims
client = cloud.client
@ -457,6 +461,7 @@ async def _account_data(hass: HomeAssistant, cloud: Cloud):
"remote_connected": remote.is_connected,
"remote_domain": remote.instance_domain,
"http_use_ssl": hass.config.api.use_ssl,
"active_subscription": not cloud.subscription_expired,
}

View File

@ -430,6 +430,7 @@ async def test_websocket_status(
"remote_connected": False,
"remote_certificate": None,
"http_use_ssl": False,
"active_subscription": False,
}
@ -438,7 +439,11 @@ async def test_websocket_status_not_logged_in(hass, hass_ws_client):
client = await hass_ws_client(hass)
await client.send_json({"id": 5, "type": "cloud/status"})
response = await client.receive_json()
assert response["result"] == {"logged_in": False, "cloud": "disconnected"}
assert response["result"] == {
"logged_in": False,
"cloud": "disconnected",
"http_use_ssl": False,
}
async def test_websocket_subscription_info(