mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-24 20:44:30 +02:00
changed string formatting according to development guidelines
This commit is contained in:
parent
7af3ef0bb3
commit
8ec4f9ade5
7 changed files with 31 additions and 39 deletions
|
@ -80,8 +80,8 @@ def update_items(inst, mikrotik_controller, async_add_entities, tracked):
|
|||
|
||||
for uid in mikrotik_controller.data["interface"]:
|
||||
if mikrotik_controller.data["interface"][uid]["type"] == "ether":
|
||||
item_id = "{}-{}".format(
|
||||
inst, mikrotik_controller.data["interface"][uid]["default-name"]
|
||||
item_id = (
|
||||
f"{inst}-{mikrotik_controller.data['interface'][uid]['default-name']}"
|
||||
)
|
||||
if item_id in tracked:
|
||||
if tracked[item_id].enabled:
|
||||
|
@ -143,12 +143,12 @@ class MikrotikControllerPortDeviceTracker(ScannerEntity):
|
|||
@property
|
||||
def name(self):
|
||||
"""Return the name of the port."""
|
||||
return "{} {}".format(self._inst, self._data["default-name"])
|
||||
return f"{self._inst} {self._data['default-name']}"
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return a unique identifier for this port."""
|
||||
return "{}-{}".format(self._inst.lower(), self._data["port-mac-address"])
|
||||
return f"{self._inst.lower()}-{self._data['port-mac-address']}"
|
||||
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue