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:
parent
61fc01915f
commit
92408bb893
9
supervisor/discovery/services/esphome.py
Normal file
9
supervisor/discovery/services/esphome.py
Normal 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}
|
||||
)
|
25
tests/discovery/test_esphome.py
Normal file
25
tests/discovery/test_esphome.py
Normal 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})
|
Loading…
Reference in New Issue
Block a user