mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-13 19:04:30 +02:00
Format with black
This commit is contained in:
parent
44fe6a626b
commit
5650d7f5ca
17 changed files with 48 additions and 27 deletions
|
@ -1,4 +1,5 @@
|
|||
"""Mikrotik Router integration."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import voluptuous as vol
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""API parser for JSON APIs."""
|
||||
|
||||
from datetime import datetime
|
||||
from logging import getLogger
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for the Mikrotik Router binary sensor service."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from logging import getLogger
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Definitions for Mikrotik Router binary sensor entities."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for the Mikrotik Router buttons."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from logging import getLogger
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Definitions for Mikrotik Router button entities."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Constants used by the Mikrotik Router component and platforms."""
|
||||
|
||||
from homeassistant.const import Platform
|
||||
|
||||
PLATFORMS = [
|
||||
|
|
|
@ -186,13 +186,13 @@ class MikrotikTrackerCoordinator(DataUpdateCoordinator[None]):
|
|||
"Ping host: %s", self.coordinator.ds["host"][uid]["address"]
|
||||
)
|
||||
|
||||
self.coordinator.ds["host"][uid][
|
||||
"available"
|
||||
] = await self.hass.async_add_executor_job(
|
||||
self.coordinator.ds["host"][uid]["available"] = (
|
||||
await self.hass.async_add_executor_job(
|
||||
self.api.arp_ping,
|
||||
self.coordinator.ds["host"][uid]["address"],
|
||||
tmp_interface,
|
||||
)
|
||||
)
|
||||
|
||||
# Update last seen
|
||||
if self.coordinator.ds["host"][uid]["available"]:
|
||||
|
@ -532,7 +532,9 @@ class MikrotikCoordinator(DataUpdateCoordinator[None]):
|
|||
self.support_capsman = False
|
||||
self._wifimodule = "wifi"
|
||||
|
||||
elif (self.major_fw_version == 7 and self.minor_fw_version >= 13) or self.major_fw_version > 7:
|
||||
elif (
|
||||
self.major_fw_version == 7 and self.minor_fw_version >= 13
|
||||
) or self.major_fw_version > 7:
|
||||
self.support_capsman = False
|
||||
self._wifimodule = "wifi"
|
||||
|
||||
|
@ -540,7 +542,8 @@ class MikrotikCoordinator(DataUpdateCoordinator[None]):
|
|||
self.support_capsman = True
|
||||
self.support_wireless = bool(self.minor_fw_version < 13)
|
||||
|
||||
_LOGGER.debug("Mikrotik %s wifi module=%s",
|
||||
_LOGGER.debug(
|
||||
"Mikrotik %s wifi module=%s",
|
||||
self.host,
|
||||
self._wifimodule,
|
||||
)
|
||||
|
@ -1589,7 +1592,7 @@ class MikrotikCoordinator(DataUpdateCoordinator[None]):
|
|||
self.host,
|
||||
self.major_fw_version,
|
||||
self.minor_fw_version,
|
||||
full_version
|
||||
full_version,
|
||||
)
|
||||
except Exception:
|
||||
_LOGGER.error(
|
||||
|
@ -1988,7 +1991,9 @@ class MikrotikCoordinator(DataUpdateCoordinator[None]):
|
|||
def get_capsman_hosts(self) -> None:
|
||||
"""Get CAPS-MAN hosts data from Mikrotik"""
|
||||
|
||||
if self.major_fw_version > 7 or (self.major_fw_version == 7 and self.minor_fw_version >= 13):
|
||||
if self.major_fw_version > 7 or (
|
||||
self.major_fw_version == 7 and self.minor_fw_version >= 13
|
||||
):
|
||||
registration_path = "/interface/wifi/registration-table"
|
||||
|
||||
else:
|
||||
|
@ -2262,9 +2267,9 @@ class MikrotikCoordinator(DataUpdateCoordinator[None]):
|
|||
# Resolve manufacturer
|
||||
if vals["manufacturer"] == "detect" and vals["mac-address"] != "unknown":
|
||||
try:
|
||||
self.ds["host"][uid][
|
||||
"manufacturer"
|
||||
] = await self.async_mac_lookup.lookup(vals["mac-address"])
|
||||
self.ds["host"][uid]["manufacturer"] = (
|
||||
await self.async_mac_lookup.lookup(vals["mac-address"])
|
||||
)
|
||||
except Exception:
|
||||
self.ds["host"][uid]["manufacturer"] = ""
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for the Mikrotik Router device tracker."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from logging import getLogger
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Definitions for Mikrotik Router device tracker entities."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Diagnostics support for Mikrotik Router."""
|
||||
|
||||
from __future__ import annotations
|
||||
from typing import Any
|
||||
from homeassistant.components.diagnostics import async_redact_data
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Mikrotik HA shared entity model"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Mikrotik sensor platform."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from logging import getLogger
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Definitions for sensor entities."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for the Mikrotik Router switches."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from logging import getLogger
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Definitions for Mikrotik Router switch entities."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Definitions for Mikrotik Router update entities."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue