mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-08-15 23:18:06 +02:00
cleanup integration init
This commit is contained in:
parent
d96dac86a4
commit
123044fceb
1 changed files with 0 additions and 26 deletions
|
@ -1,16 +1,10 @@
|
||||||
"""Mikrotik Router integration."""
|
"""Mikrotik Router integration."""
|
||||||
|
|
||||||
import logging
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
|
|
||||||
from homeassistant.const import (
|
|
||||||
CONF_NAME,
|
|
||||||
CONF_HOST,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
PLATFORMS,
|
PLATFORMS,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
|
@ -19,8 +13,6 @@ from .const import (
|
||||||
)
|
)
|
||||||
from .mikrotik_controller import MikrotikControllerData
|
from .mikrotik_controller import MikrotikControllerData
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
SCRIPT_SCHEMA = vol.Schema(
|
SCRIPT_SCHEMA = vol.Schema(
|
||||||
{vol.Required("router"): cv.string, vol.Required("script"): cv.string}
|
{vol.Required("router"): cv.string, vol.Required("script"): cv.string}
|
||||||
)
|
)
|
||||||
|
@ -69,24 +61,6 @@ async def async_setup_entry(hass, config_entry) -> bool:
|
||||||
DOMAIN, RUN_SCRIPT_COMMAND, controller.run_script, schema=SCRIPT_SCHEMA
|
DOMAIN, RUN_SCRIPT_COMMAND, controller.run_script, schema=SCRIPT_SCHEMA
|
||||||
)
|
)
|
||||||
|
|
||||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
|
||||||
device_registry.async_get_or_create(
|
|
||||||
config_entry_id=config_entry.entry_id,
|
|
||||||
connections={(DOMAIN, f"{controller.data['routerboard']['serial-number']}")},
|
|
||||||
manufacturer=controller.data["resource"]["platform"],
|
|
||||||
model=controller.data["routerboard"]["model"],
|
|
||||||
name=f"{config_entry.data[CONF_NAME]} {controller.data['routerboard']['model']}",
|
|
||||||
sw_version=controller.data["resource"]["version"],
|
|
||||||
configuration_url=f"http://{config_entry.data[CONF_HOST]}",
|
|
||||||
identifiers={
|
|
||||||
DOMAIN,
|
|
||||||
"serial-number",
|
|
||||||
f"{controller.data['routerboard']['serial-number']}",
|
|
||||||
"sensor",
|
|
||||||
f"{config_entry.data[CONF_NAME]} {controller.data['routerboard']['model']}",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue