mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-08 00:14:31 +02:00
added support for overriding zone name in device_tracker
This commit is contained in:
parent
6129e18cc3
commit
873d18e60a
4 changed files with 32 additions and 1 deletions
|
@ -9,6 +9,7 @@ from homeassistant.components.device_tracker.const import SOURCE_TYPE_ROUTER
|
|||
from homeassistant.const import (
|
||||
CONF_NAME,
|
||||
ATTR_ATTRIBUTION,
|
||||
STATE_NOT_HOME,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
|
@ -300,6 +301,13 @@ class MikrotikControllerHostDeviceTracker(MikrotikControllerDeviceTracker):
|
|||
return "mdi:lan-connect"
|
||||
return "mdi:lan-disconnect"
|
||||
|
||||
@property
|
||||
def state(self) -> str:
|
||||
"""Return the state of the device."""
|
||||
if self.is_connected:
|
||||
return self._ctrl.option_zone
|
||||
return STATE_NOT_HOME
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self) -> Dict[str, Any]:
|
||||
"""Return the state attributes."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue