Remove deprecated yaml config from nuki (#62470)
This commit is contained in:
parent
d60540d4f5
commit
d73081f875
4 changed files with 1 additions and 59 deletions
|
@ -1,7 +1,5 @@
|
||||||
"""Doorsensor Support for the Nuki Lock."""
|
"""Doorsensor Support for the Nuki Lock."""
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from pynuki import STATE_DOORSENSOR_OPENED
|
from pynuki import STATE_DOORSENSOR_OPENED
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
|
@ -12,8 +10,6 @@ from homeassistant.components.binary_sensor import (
|
||||||
from . import NukiEntity
|
from . import NukiEntity
|
||||||
from .const import ATTR_NUKI_ID, DATA_COORDINATOR, DATA_LOCKS, DOMAIN as NUKI_DOMAIN
|
from .const import ATTR_NUKI_ID, DATA_COORDINATOR, DATA_LOCKS, DOMAIN as NUKI_DOMAIN
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry, async_add_entities):
|
async def async_setup_entry(hass, entry, async_add_entities):
|
||||||
"""Set up the Nuki lock binary sensor."""
|
"""Set up the Nuki lock binary sensor."""
|
||||||
|
|
|
@ -59,10 +59,6 @@ class NukiConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
self.discovery_schema = {}
|
self.discovery_schema = {}
|
||||||
self._data = {}
|
self._data = {}
|
||||||
|
|
||||||
async def async_step_import(self, user_input=None):
|
|
||||||
"""Handle a flow initiated by import."""
|
|
||||||
return await self.async_step_validate(user_input)
|
|
||||||
|
|
||||||
async def async_step_user(self, user_input=None):
|
async def async_step_user(self, user_input=None):
|
||||||
"""Handle a flow initiated by the user."""
|
"""Handle a flow initiated by the user."""
|
||||||
return await self.async_step_validate(user_input)
|
return await self.async_step_validate(user_input)
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
"""Nuki.io lock platform."""
|
"""Nuki.io lock platform."""
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
import logging
|
|
||||||
|
|
||||||
from pynuki import MODE_OPENER_CONTINUOUS
|
from pynuki import MODE_OPENER_CONTINUOUS
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.lock import PLATFORM_SCHEMA, SUPPORT_OPEN, LockEntity
|
from homeassistant.components.lock import SUPPORT_OPEN, LockEntity
|
||||||
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_TOKEN
|
|
||||||
from homeassistant.helpers import config_validation as cv, entity_platform
|
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||||
|
|
||||||
from . import NukiEntity
|
from . import NukiEntity
|
||||||
|
@ -18,28 +16,10 @@ from .const import (
|
||||||
DATA_COORDINATOR,
|
DATA_COORDINATOR,
|
||||||
DATA_LOCKS,
|
DATA_LOCKS,
|
||||||
DATA_OPENERS,
|
DATA_OPENERS,
|
||||||
DEFAULT_PORT,
|
|
||||||
DOMAIN as NUKI_DOMAIN,
|
DOMAIN as NUKI_DOMAIN,
|
||||||
ERROR_STATES,
|
ERROR_STATES,
|
||||||
)
|
)
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|
||||||
{
|
|
||||||
vol.Required(CONF_HOST): cv.string,
|
|
||||||
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
|
|
||||||
vol.Required(CONF_TOKEN): cv.string,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
|
||||||
"""Set up the Nuki lock platform."""
|
|
||||||
_LOGGER.warning(
|
|
||||||
"Loading Nuki by lock platform configuration is deprecated and will be removed in the future"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry, async_add_entities):
|
async def async_setup_entry(hass, entry, async_add_entities):
|
||||||
"""Set up the Nuki lock platform."""
|
"""Set up the Nuki lock platform."""
|
||||||
|
|
|
@ -51,36 +51,6 @@ async def test_form(hass):
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
async def test_import(hass):
|
|
||||||
"""Test that the import works."""
|
|
||||||
|
|
||||||
with patch(
|
|
||||||
"homeassistant.components.nuki.config_flow.NukiBridge.info",
|
|
||||||
return_value=MOCK_INFO,
|
|
||||||
), patch(
|
|
||||||
"homeassistant.components.nuki.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.nuki.async_setup_entry",
|
|
||||||
return_value=True,
|
|
||||||
) as mock_setup_entry:
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
|
||||||
DOMAIN,
|
|
||||||
context={"source": config_entries.SOURCE_IMPORT},
|
|
||||||
data={"host": "1.1.1.1", "port": 8080, "token": "test-token"},
|
|
||||||
)
|
|
||||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
|
||||||
assert result["title"] == 123456789
|
|
||||||
assert result["data"] == {
|
|
||||||
"host": "1.1.1.1",
|
|
||||||
"port": 8080,
|
|
||||||
"token": "test-token",
|
|
||||||
}
|
|
||||||
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
|
||||||
|
|
||||||
|
|
||||||
async def test_form_invalid_auth(hass):
|
async def test_form_invalid_auth(hass):
|
||||||
"""Test we handle invalid auth."""
|
"""Test we handle invalid auth."""
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue