1 """Connected Wi-Fi device scanners for TP-Link Omada access points."""
5 from tplink_omada_client.clients
import OmadaWirelessClient
12 from .
import OmadaConfigEntry
13 from .config_flow
import CONF_SITE
14 from .controller
import OmadaClientsCoordinator
16 _LOGGER = logging.getLogger(__name__)
21 config_entry: OmadaConfigEntry,
22 async_add_entities: AddEntitiesCallback,
24 """Set up device trackers and scanners."""
26 controller = config_entry.runtime_data
28 site_id = config_entry.data[CONF_SITE]
35 site_id, client.mac, client.name, controller.clients_coordinator
37 async
for client
in controller.omada_client.get_known_clients()
38 if isinstance(client, OmadaWirelessClient)
44 CoordinatorEntity[OmadaClientsCoordinator], ScannerEntity
46 """Entity for a client connected to the Omada network."""
48 _client_details: OmadaWirelessClient |
None =
None
55 coordinator: OmadaClientsCoordinator,
57 """Initialize the scanner."""
67 """When entity is added to hass."""
73 """Handle updated data from the coordinator."""
75 self.async_write_ha_state()
79 """Return the primary ip address of the device."""
84 """Return the mac address of the device."""
89 """Return hostname of the device."""
94 """Return true if the device is connected to the network."""
99 """Return the unique id of the device."""
100 return f
"scanner_{self._site_id}_{self._client_id}"
None __init__(self, str site_id, str client_id, str display_name, OmadaClientsCoordinator coordinator)
str|None mac_address(self)
None _handle_coordinator_update(self)
None async_added_to_hass(self)
str|None ip_address(self)
None async_setup_entry(HomeAssistant hass, OmadaConfigEntry config_entry, AddEntitiesCallback async_add_entities)