Add my component (#46058)
Co-authored-by: Franck Nijhof <git@frenck.dev> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>pull/46224/head
parent
48002f47f4
commit
6f446cf627
|
@ -287,6 +287,7 @@ homeassistant/components/motion_blinds/* @starkillerOG
|
||||||
homeassistant/components/mpd/* @fabaff
|
homeassistant/components/mpd/* @fabaff
|
||||||
homeassistant/components/mqtt/* @home-assistant/core @emontnemery
|
homeassistant/components/mqtt/* @home-assistant/core @emontnemery
|
||||||
homeassistant/components/msteams/* @peroyvind
|
homeassistant/components/msteams/* @peroyvind
|
||||||
|
homeassistant/components/my/* @home-assistant/core
|
||||||
homeassistant/components/myq/* @bdraco
|
homeassistant/components/myq/* @bdraco
|
||||||
homeassistant/components/mysensors/* @MartinHjelmare @functionpointer
|
homeassistant/components/mysensors/* @MartinHjelmare @functionpointer
|
||||||
homeassistant/components/mystrom/* @fabaff
|
homeassistant/components/mystrom/* @fabaff
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
"map",
|
"map",
|
||||||
"media_source",
|
"media_source",
|
||||||
"mobile_app",
|
"mobile_app",
|
||||||
|
"my",
|
||||||
"person",
|
"person",
|
||||||
"scene",
|
"scene",
|
||||||
"script",
|
"script",
|
||||||
|
|
|
@ -58,8 +58,9 @@ SSL_INTERMEDIATE = "intermediate"
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
DEFAULT_DEVELOPMENT = "0"
|
DEFAULT_DEVELOPMENT = "0"
|
||||||
# To be able to load custom cards.
|
# Cast to be able to load custom cards.
|
||||||
DEFAULT_CORS = "https://cast.home-assistant.io"
|
# My to be able to check url and version info.
|
||||||
|
DEFAULT_CORS = ["https://cast.home-assistant.io", "https://my.home-assistant.io"]
|
||||||
NO_LOGIN_ATTEMPT_THRESHOLD = -1
|
NO_LOGIN_ATTEMPT_THRESHOLD = -1
|
||||||
|
|
||||||
MAX_CLIENT_SIZE: int = 1024 ** 2 * 16
|
MAX_CLIENT_SIZE: int = 1024 ** 2 * 16
|
||||||
|
@ -80,7 +81,7 @@ HTTP_SCHEMA = vol.All(
|
||||||
vol.Optional(CONF_SSL_CERTIFICATE): cv.isfile,
|
vol.Optional(CONF_SSL_CERTIFICATE): cv.isfile,
|
||||||
vol.Optional(CONF_SSL_PEER_CERTIFICATE): cv.isfile,
|
vol.Optional(CONF_SSL_PEER_CERTIFICATE): cv.isfile,
|
||||||
vol.Optional(CONF_SSL_KEY): cv.isfile,
|
vol.Optional(CONF_SSL_KEY): cv.isfile,
|
||||||
vol.Optional(CONF_CORS_ORIGINS, default=[DEFAULT_CORS]): vol.All(
|
vol.Optional(CONF_CORS_ORIGINS, default=DEFAULT_CORS): vol.All(
|
||||||
cv.ensure_list, [cv.string]
|
cv.ensure_list, [cv.string]
|
||||||
),
|
),
|
||||||
vol.Inclusive(CONF_USE_X_FORWARDED_FOR, "proxy"): cv.boolean,
|
vol.Inclusive(CONF_USE_X_FORWARDED_FOR, "proxy"): cv.boolean,
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
"""Support for my.home-assistant.io redirect service."""
|
||||||
|
|
||||||
|
DOMAIN = "my"
|
||||||
|
URL_PATH = "_my_redirect"
|
||||||
|
|
||||||
|
|
||||||
|
async def async_setup(hass, config):
|
||||||
|
"""Register hidden _my_redirect panel."""
|
||||||
|
hass.components.frontend.async_register_built_in_panel(
|
||||||
|
DOMAIN, frontend_url_path=URL_PATH
|
||||||
|
)
|
||||||
|
return True
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"domain": "my",
|
||||||
|
"name": "My Home Assistant",
|
||||||
|
"documentation": "https://www.home-assistant.io/integrations/my",
|
||||||
|
"dependencies": ["frontend"],
|
||||||
|
"codeowners": ["@home-assistant/core"]
|
||||||
|
}
|
|
@ -242,7 +242,10 @@ async def test_cors_defaults(hass):
|
||||||
assert await async_setup_component(hass, "http", {})
|
assert await async_setup_component(hass, "http", {})
|
||||||
|
|
||||||
assert len(mock_setup.mock_calls) == 1
|
assert len(mock_setup.mock_calls) == 1
|
||||||
assert mock_setup.mock_calls[0][1][1] == ["https://cast.home-assistant.io"]
|
assert mock_setup.mock_calls[0][1][1] == [
|
||||||
|
"https://cast.home-assistant.io",
|
||||||
|
"https://my.home-assistant.io",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
async def test_storing_config(hass, aiohttp_client, aiohttp_unused_port):
|
async def test_storing_config(hass, aiohttp_client, aiohttp_unused_port):
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
"""Tests for the my component."""
|
|
@ -0,0 +1,17 @@
|
||||||
|
"""Test the my init."""
|
||||||
|
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
|
from homeassistant.components.my import URL_PATH
|
||||||
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
|
|
||||||
|
async def test_setup(hass):
|
||||||
|
"""Test setup."""
|
||||||
|
with mock.patch(
|
||||||
|
"homeassistant.components.frontend.async_register_built_in_panel"
|
||||||
|
) as mock_register_panel:
|
||||||
|
assert await async_setup_component(hass, "my", {"foo": "bar"})
|
||||||
|
assert mock_register_panel.call_args == mock.call(
|
||||||
|
hass, "my", frontend_url_path=URL_PATH
|
||||||
|
)
|
Loading…
Reference in New Issue