mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-26 02:26:30 +00:00
Add support for homematic (#1690)
This commit is contained in:
parent
12cc163058
commit
9a2f025646
18
supervisor/discovery/services/homematic.py
Normal file
18
supervisor/discovery/services/homematic.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
"""Discovery service for HomeMatic."""
|
||||||
|
import voluptuous as vol
|
||||||
|
|
||||||
|
from supervisor.validate import network_port
|
||||||
|
|
||||||
|
from ..const import ATTR_HOST, ATTR_PORT
|
||||||
|
|
||||||
|
|
||||||
|
SCHEMA = vol.Schema(
|
||||||
|
{
|
||||||
|
vol.Coerce(str): vol.Schema(
|
||||||
|
{
|
||||||
|
vol.Required(ATTR_HOST): vol.Coerce(str),
|
||||||
|
vol.Required(ATTR_PORT): network_port,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
22
tests/discovery/test_homematic.py
Normal file
22
tests/discovery/test_homematic.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
"""Test HomeMatic discovery."""
|
||||||
|
|
||||||
|
import voluptuous as vol
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from supervisor.discovery.validate import valid_discovery_config
|
||||||
|
|
||||||
|
|
||||||
|
def test_good_config():
|
||||||
|
"""Test good homematic config."""
|
||||||
|
|
||||||
|
valid_discovery_config(
|
||||||
|
"homematic",
|
||||||
|
{"ip": {"host": "test", "port": 3812}, "rf": {"host": "test", "port": 3712}},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_bad_config():
|
||||||
|
"""Test good homematic config."""
|
||||||
|
|
||||||
|
with pytest.raises(vol.Invalid):
|
||||||
|
valid_discovery_config("homematic", {"test": {"bla": "test", "port": 8080}})
|
Loading…
x
Reference in New Issue
Block a user