mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-12 19:56:29 +00:00
Add OTBR discovery (#4040)
* Add OTBR discovery * Fix typo * Move constants to correct file * Drop Web Service port * Use existing port constant
This commit is contained in:
parent
e48e024bb3
commit
1f7199cf00
13
supervisor/discovery/services/otbr.py
Normal file
13
supervisor/discovery/services/otbr.py
Normal file
@ -0,0 +1,13 @@
|
||||
"""Discovery service for OpenThread Border Router."""
|
||||
import voluptuous as vol
|
||||
|
||||
from ...validate import network_port
|
||||
from ..const import ATTR_HOST, ATTR_PORT
|
||||
|
||||
# pylint: disable=no-value-for-parameter
|
||||
SCHEMA = vol.Schema(
|
||||
{
|
||||
vol.Required(ATTR_HOST): str,
|
||||
vol.Required(ATTR_PORT): network_port,
|
||||
}
|
||||
)
|
22
tests/discovery/test_otbr.py
Normal file
22
tests/discovery/test_otbr.py
Normal file
@ -0,0 +1,22 @@
|
||||
"""Test OTBR discovery."""
|
||||
|
||||
import pytest
|
||||
import voluptuous as vol
|
||||
|
||||
from supervisor.discovery.validate import valid_discovery_config
|
||||
|
||||
|
||||
def test_good_config():
|
||||
"""Test good OTBR config."""
|
||||
|
||||
valid_discovery_config(
|
||||
"otbr",
|
||||
{"host": "test", "port": 3812},
|
||||
)
|
||||
|
||||
|
||||
def test_bad_config():
|
||||
"""Test bad OTBR config."""
|
||||
|
||||
with pytest.raises(vol.Invalid):
|
||||
valid_discovery_config("otbr", {"host": "test"})
|
Loading…
x
Reference in New Issue
Block a user