Add contents to connection_info handler in cloud client (#95059)
This commit is contained in:
parent
cd26de73b4
commit
db01aecb02
2 changed files with 25 additions and 2 deletions
|
@ -17,6 +17,7 @@ from homeassistant.components.alexa import (
|
||||||
smart_home as alexa_smart_home,
|
smart_home as alexa_smart_home,
|
||||||
)
|
)
|
||||||
from homeassistant.components.google_assistant import smart_home as ga
|
from homeassistant.components.google_assistant import smart_home as ga
|
||||||
|
from homeassistant.const import __version__ as HA_VERSION
|
||||||
from homeassistant.core import Context, HassJob, HomeAssistant, callback
|
from homeassistant.core import Context, HassJob, HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
from homeassistant.helpers.event import async_call_later
|
from homeassistant.helpers.event import async_call_later
|
||||||
|
@ -216,7 +217,14 @@ class CloudClient(Interface):
|
||||||
self, payload: dict[str, Any]
|
self, payload: dict[str, Any]
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
"""Process cloud connection info message to client."""
|
"""Process cloud connection info message to client."""
|
||||||
return {}
|
return {
|
||||||
|
"remote": {
|
||||||
|
"connected": self.cloud.remote.is_connected,
|
||||||
|
"enabled": self._prefs.remote_enabled,
|
||||||
|
"instance_domain": self.cloud.remote.instance_domain,
|
||||||
|
},
|
||||||
|
"version": HA_VERSION,
|
||||||
|
}
|
||||||
|
|
||||||
async def async_alexa_message(self, payload: dict[Any, Any]) -> dict[Any, Any]:
|
async def async_alexa_message(self, payload: dict[Any, Any]) -> dict[Any, Any]:
|
||||||
"""Process cloud alexa message to client."""
|
"""Process cloud alexa message to client."""
|
||||||
|
|
|
@ -18,7 +18,7 @@ from homeassistant.components.homeassistant.exposed_entities import (
|
||||||
ExposedEntities,
|
ExposedEntities,
|
||||||
async_expose_entity,
|
async_expose_entity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONTENT_TYPE_JSON
|
from homeassistant.const import CONTENT_TYPE_JSON, __version__ as HA_VERSION
|
||||||
from homeassistant.core import HomeAssistant, State
|
from homeassistant.core import HomeAssistant, State
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
@ -353,3 +353,18 @@ async def test_system_msg(hass: HomeAssistant) -> None:
|
||||||
|
|
||||||
assert response is None
|
assert response is None
|
||||||
assert cloud.client.relayer_region == "xx-earth-616"
|
assert cloud.client.relayer_region == "xx-earth-616"
|
||||||
|
|
||||||
|
|
||||||
|
async def test_cloud_connection_info(hass: HomeAssistant) -> None:
|
||||||
|
"""Test connection info msg."""
|
||||||
|
with patch("hass_nabucasa.Cloud.initialize"):
|
||||||
|
setup = await async_setup_component(hass, "cloud", {"cloud": {}})
|
||||||
|
assert setup
|
||||||
|
cloud = hass.data["cloud"]
|
||||||
|
|
||||||
|
response = await cloud.client.async_cloud_connection_info({})
|
||||||
|
|
||||||
|
assert response == {
|
||||||
|
"remote": {"connected": False, "enabled": False, "instance_domain": None},
|
||||||
|
"version": HA_VERSION,
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue