mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-12 18:34:30 +02:00
PM8 code optimization
This commit is contained in:
parent
f0b4c5e723
commit
7ccaf0d9c3
10 changed files with 557 additions and 536 deletions
|
@ -2,20 +2,13 @@
|
|||
import logging
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.const import (CONF_NAME, ATTR_ATTRIBUTION)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
|
||||
from homeassistant.const import (
|
||||
CONF_NAME,
|
||||
ATTR_ATTRIBUTION,
|
||||
)
|
||||
from .const import (
|
||||
DOMAIN,
|
||||
DATA_CLIENT,
|
||||
ATTRIBUTION,
|
||||
)
|
||||
from .const import (DOMAIN, DATA_CLIENT, ATTRIBUTION)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -192,7 +185,8 @@ class MikrotikControllerPortSwitch(MikrotikControllerSwitch):
|
|||
def device_info(self):
|
||||
"""Return a port description for device registry."""
|
||||
info = {
|
||||
"connections": {(CONNECTION_NETWORK_MAC, self._data["port-mac-address"])},
|
||||
"connections": {
|
||||
(CONNECTION_NETWORK_MAC, self._data["port-mac-address"])},
|
||||
"manufacturer": self._ctrl.data["resource"]["platform"],
|
||||
"model": self._ctrl.data["resource"]["board-name"],
|
||||
"name": self._data["default-name"],
|
||||
|
@ -362,7 +356,8 @@ class MikrotikControllerScriptSwitch(MikrotikControllerSwitch):
|
|||
|
||||
async def async_added_to_hass(self):
|
||||
"""Script switch entity created."""
|
||||
_LOGGER.debug("New script switch %s (%s)", self._inst, self._data["name"])
|
||||
_LOGGER.debug("New script switch %s (%s)", self._inst,
|
||||
self._data["name"])
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue