Add if subscription is active to cloud status (#68266)
parent
d021222d6d
commit
aabfa08834
|
@ -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,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue