mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-02 21:44:31 +02:00
Sensor nat selection #68
This commit is contained in:
parent
d07b6c3004
commit
53e95c9d57
1 changed files with 11 additions and 1 deletions
|
@ -39,6 +39,8 @@ from .const import (
|
||||||
DEFAULT_SENSOR_CLIENT_TRAFFIC,
|
DEFAULT_SENSOR_CLIENT_TRAFFIC,
|
||||||
CONF_SENSOR_SIMPLE_QUEUES,
|
CONF_SENSOR_SIMPLE_QUEUES,
|
||||||
DEFAULT_SENSOR_SIMPLE_QUEUES,
|
DEFAULT_SENSOR_SIMPLE_QUEUES,
|
||||||
|
CONF_SENSOR_NAT,
|
||||||
|
DEFAULT_SENSOR_NAT,
|
||||||
CONF_SENSOR_SCRIPTS,
|
CONF_SENSOR_SCRIPTS,
|
||||||
DEFAULT_SENSOR_SCRIPTS,
|
DEFAULT_SENSOR_SCRIPTS,
|
||||||
)
|
)
|
||||||
|
@ -181,6 +183,14 @@ class MikrotikControllerData:
|
||||||
CONF_SENSOR_SIMPLE_QUEUES, DEFAULT_SENSOR_SIMPLE_QUEUES
|
CONF_SENSOR_SIMPLE_QUEUES, DEFAULT_SENSOR_SIMPLE_QUEUES
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# ---------------------------
|
||||||
|
# option_sensor_nat
|
||||||
|
# ---------------------------
|
||||||
|
@property
|
||||||
|
def option_sensor_nat(self):
|
||||||
|
"""Config entry option to not track ARP."""
|
||||||
|
return self.config_entry.options.get(CONF_SENSOR_NAT, DEFAULT_SENSOR_NAT)
|
||||||
|
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# option_sensor_scripts
|
# option_sensor_scripts
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
|
@ -465,7 +475,7 @@ class MikrotikControllerData:
|
||||||
if self.api.connected():
|
if self.api.connected():
|
||||||
await self.hass.async_add_executor_job(self.process_interface_client)
|
await self.hass.async_add_executor_job(self.process_interface_client)
|
||||||
|
|
||||||
if self.api.connected():
|
if self.api.connected() and self.option_sensor_nat:
|
||||||
await self.hass.async_add_executor_job(self.get_nat)
|
await self.hass.async_add_executor_job(self.get_nat)
|
||||||
|
|
||||||
if self.api.connected():
|
if self.api.connected():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue