mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-12 18:34:30 +02:00
renamed _sid_data variable
This commit is contained in:
parent
ce77fb8085
commit
6c31c1e35e
1 changed files with 10 additions and 10 deletions
|
@ -167,10 +167,10 @@ class MikrotikControllerDeviceTracker(ScannerEntity):
|
||||||
|
|
||||||
def __init__(self, inst, uid, mikrotik_controller, config_entry, sid_data):
|
def __init__(self, inst, uid, mikrotik_controller, config_entry, sid_data):
|
||||||
"""Set up a device tracker."""
|
"""Set up a device tracker."""
|
||||||
self.sid_data = sid_data
|
self._sid_data = sid_data
|
||||||
self._inst = inst
|
self._inst = inst
|
||||||
self._ctrl = mikrotik_controller
|
self._ctrl = mikrotik_controller
|
||||||
self._data = mikrotik_controller.data[self.sid_data["sid"]][uid]
|
self._data = mikrotik_controller.data[self._sid_data["sid"]][uid]
|
||||||
self._config_entry = config_entry
|
self._config_entry = config_entry
|
||||||
|
|
||||||
self._attrs = {
|
self._attrs = {
|
||||||
|
@ -187,8 +187,8 @@ class MikrotikControllerDeviceTracker(ScannerEntity):
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"New device tracker %s (%s %s)",
|
"New device tracker %s (%s %s)",
|
||||||
self._inst,
|
self._inst,
|
||||||
self.sid_data["sid"],
|
self._sid_data["sid"],
|
||||||
self._data[self.sid_data["sid_uid"]],
|
self._data[self._sid_data["sid_uid"]],
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
|
@ -202,15 +202,15 @@ class MikrotikControllerDeviceTracker(ScannerEntity):
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
"""Return the name of the port."""
|
"""Return the name of the port."""
|
||||||
if self.sid_data["sid"] == "interface":
|
if self._sid_data["sid"] == "interface":
|
||||||
return f"{self._inst} {self._data[self.sid_data['sid_name']]}"
|
return f"{self._inst} {self._data[self._sid_data['sid_name']]}"
|
||||||
|
|
||||||
return f"{self._data[self.sid_data['sid_name']]}"
|
return f"{self._data[self._sid_data['sid_name']]}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self):
|
def unique_id(self):
|
||||||
"""Return a unique identifier for this port."""
|
"""Return a unique identifier for this port."""
|
||||||
return f"{self._inst.lower()}-{self.sid_data['sid']}-{self._data[self.sid_data['sid_ref']]}"
|
return f"{self._inst.lower()}-{self._sid_data['sid']}-{self._data[self._sid_data['sid_ref']]}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def available(self) -> bool:
|
def available(self) -> bool:
|
||||||
|
@ -222,11 +222,11 @@ class MikrotikControllerDeviceTracker(ScannerEntity):
|
||||||
"""Return a description for device registry."""
|
"""Return a description for device registry."""
|
||||||
info = {
|
info = {
|
||||||
"connections": {
|
"connections": {
|
||||||
(CONNECTION_NETWORK_MAC, self._data[self.sid_data["sid_ref"]])
|
(CONNECTION_NETWORK_MAC, self._data[self._sid_data["sid_ref"]])
|
||||||
},
|
},
|
||||||
"manufacturer": self._ctrl.data["resource"]["platform"],
|
"manufacturer": self._ctrl.data["resource"]["platform"],
|
||||||
"model": self._ctrl.data["resource"]["board-name"],
|
"model": self._ctrl.data["resource"]["board-name"],
|
||||||
"name": f"{self._inst} {self._data[self.sid_data['sid_name']]}",
|
"name": f"{self._inst} {self._data[self._sid_data['sid_name']]}",
|
||||||
}
|
}
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue