1
mirror of https://github.com/home-assistant/supervisor synced 2024-08-05 03:49:58 +02:00

Add support for ESPHome dashboard discovery (#4084)

This commit is contained in:
Franck Nijhof 2023-01-05 19:58:55 +01:00 committed by GitHub
parent 61fc01915f
commit 92408bb893
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,9 @@
"""Discovery service for the ESPHome Dashboard."""
import voluptuous as vol
from ...validate import network_port
from ..const import ATTR_HOST, ATTR_PORT
SCHEMA = vol.Schema(
{vol.Required(ATTR_HOST): str, vol.Required(ATTR_PORT): network_port}
)

View File

@ -0,0 +1,25 @@
"""Test ESPHome Dashboard discovery."""
import pytest
import voluptuous as vol
from supervisor.discovery.validate import valid_discovery_config
def test_good_config():
"""Test good ESPHome config."""
valid_discovery_config("esphome", {"host": "test", "port": 6052})
def test_bad_config():
"""Test bad ESPHome config."""
with pytest.raises(vol.Invalid):
valid_discovery_config("esphome", {"host": "test"})
with pytest.raises(vol.Invalid):
valid_discovery_config("esphome", {"port": 6052})
with pytest.raises(vol.Invalid):
valid_discovery_config("esphome", {"port": -1})