1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00

Expose if HTTP is configured for SSL (#64940)

This commit is contained in:
Paulus Schoutsen 2022-01-26 00:34:48 -08:00 committed by GitHub
parent 149cd8e319
commit 9cbdd36082
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -21,6 +21,7 @@ from homeassistant.components.google_assistant import helpers as google_helpers
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.http.data_validator import RequestDataValidator
from homeassistant.components.websocket_api import const as ws_const
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.util.location import async_detect_location_info
@ -288,7 +289,7 @@ async def websocket_cloud_status(hass, connection, msg):
"""
cloud = hass.data[DOMAIN]
connection.send_message(
websocket_api.result_message(msg["id"], await _account_data(cloud))
websocket_api.result_message(msg["id"], await _account_data(hass, cloud))
)
@ -414,7 +415,7 @@ async def websocket_hook_delete(hass, connection, msg):
connection.send_message(websocket_api.result_message(msg["id"]))
async def _account_data(cloud):
async def _account_data(hass: HomeAssistant, cloud: Cloud):
"""Generate the auth data JSON response."""
if not cloud.is_logged_in:
@ -445,6 +446,7 @@ async def _account_data(cloud):
"remote_certificate": certificate,
"remote_connected": remote.is_connected,
"remote_domain": remote.instance_domain,
"http_use_ssl": hass.config.api.use_ssl,
}
@ -457,7 +459,7 @@ async def websocket_remote_connect(hass, connection, msg):
"""Handle request for connect remote."""
cloud = hass.data[DOMAIN]
await cloud.client.prefs.async_update(remote_enabled=True)
connection.send_result(msg["id"], await _account_data(cloud))
connection.send_result(msg["id"], await _account_data(hass, cloud))
@websocket_api.require_admin
@ -469,7 +471,7 @@ async def websocket_remote_disconnect(hass, connection, msg):
"""Handle request for disconnect remote."""
cloud = hass.data[DOMAIN]
await cloud.client.prefs.async_update(remote_enabled=False)
connection.send_result(msg["id"], await _account_data(cloud))
connection.send_result(msg["id"], await _account_data(hass, cloud))
@websocket_api.require_admin

View File

@ -427,6 +427,7 @@ async def test_websocket_status(
"remote_domain": None,
"remote_connected": False,
"remote_certificate": None,
"http_use_ssl": False,
}