mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-27 11:06:32 +00:00
Add discovery support for new ozw integration (#1701)
This commit is contained in:
parent
b7b8e6c40e
commit
c605af6ccc
21
supervisor/discovery/services/zwave_mqtt.py
Normal file
21
supervisor/discovery/services/zwave_mqtt.py
Normal file
@ -0,0 +1,21 @@
|
||||
"""Discovery service for Zwave MQTT."""
|
||||
import voluptuous as vol
|
||||
|
||||
from supervisor.validate import network_port
|
||||
|
||||
from ..const import (
|
||||
ATTR_HOST,
|
||||
ATTR_PASSWORD,
|
||||
ATTR_PORT,
|
||||
ATTR_USERNAME,
|
||||
)
|
||||
|
||||
# pylint: disable=no-value-for-parameter
|
||||
SCHEMA = vol.Schema(
|
||||
{
|
||||
vol.Required(ATTR_HOST): vol.Coerce(str),
|
||||
vol.Required(ATTR_PORT): network_port,
|
||||
vol.Required(ATTR_USERNAME): vol.Coerce(str),
|
||||
vol.Required(ATTR_PASSWORD): vol.Coerce(str),
|
||||
}
|
||||
)
|
24
tests/discovery/test_zwave_mqtt.py
Normal file
24
tests/discovery/test_zwave_mqtt.py
Normal file
@ -0,0 +1,24 @@
|
||||
"""Test Zwave MQTT discovery."""
|
||||
|
||||
import voluptuous as vol
|
||||
import pytest
|
||||
|
||||
from supervisor.discovery.validate import valid_discovery_config
|
||||
|
||||
|
||||
def test_good_config():
|
||||
"""Test good zwave mqtt config."""
|
||||
|
||||
valid_discovery_config(
|
||||
"zwave_mqtt",
|
||||
{"host": "test", "port": 3812, "username": "bla", "password": "test"},
|
||||
)
|
||||
|
||||
|
||||
def test_bad_config():
|
||||
"""Test good zwave mqtt config."""
|
||||
|
||||
with pytest.raises(vol.Invalid):
|
||||
valid_discovery_config(
|
||||
"zwave_mqtt", {"host": "test", "username": "bla", "ssl": True}
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user