mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-15 11:54:30 +02:00
correctly report all entities as unavailable in UI when mikrotik is offline
This commit is contained in:
parent
270c7f8274
commit
06727236da
3 changed files with 7 additions and 7 deletions
|
@ -112,9 +112,9 @@ class MikrotikControllerBinarySensor(BinarySensorDevice):
|
||||||
return "{}-{}".format(self._inst.lower(), self._sensor.lower())
|
return "{}-{}".format(self._inst.lower(), self._sensor.lower())
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def available(self):
|
def available(self) -> bool:
|
||||||
"""Return True if entity is available."""
|
"""Return if controller is available."""
|
||||||
return bool(self._ctrl.data)
|
return self._ctrl.connected()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self):
|
||||||
|
|
|
@ -145,7 +145,7 @@ class MikrotikControllerPortDeviceTracker(ScannerEntity):
|
||||||
return "{}-{}".format(self._inst.lower(), self._data['port-mac-address'])
|
return "{}-{}".format(self._inst.lower(), self._data['port-mac-address'])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def available(self):
|
def available(self) -> bool:
|
||||||
"""Return if controller is available."""
|
"""Return if controller is available."""
|
||||||
return self._ctrl.connected()
|
return self._ctrl.connected()
|
||||||
|
|
||||||
|
|
|
@ -199,9 +199,9 @@ class MikrotikControllerSensor(Entity):
|
||||||
return self._type[ATTR_UNIT]
|
return self._type[ATTR_UNIT]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def available(self):
|
def available(self) -> bool:
|
||||||
"""Return True if entity is available."""
|
"""Return if controller is available."""
|
||||||
return bool(self._ctrl.data)
|
return self._ctrl.connected()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue