mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-03 22:14:32 +02:00
Sensor scripts selection #68
This commit is contained in:
parent
3efe6d451b
commit
d07b6c3004
1 changed files with 13 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_SCRIPTS,
|
||||||
|
DEFAULT_SENSOR_SCRIPTS,
|
||||||
)
|
)
|
||||||
from .exceptions import ApiEntryNotFound
|
from .exceptions import ApiEntryNotFound
|
||||||
from .helper import parse_api
|
from .helper import parse_api
|
||||||
|
@ -179,6 +181,16 @@ class MikrotikControllerData:
|
||||||
CONF_SENSOR_SIMPLE_QUEUES, DEFAULT_SENSOR_SIMPLE_QUEUES
|
CONF_SENSOR_SIMPLE_QUEUES, DEFAULT_SENSOR_SIMPLE_QUEUES
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# ---------------------------
|
||||||
|
# option_sensor_scripts
|
||||||
|
# ---------------------------
|
||||||
|
@property
|
||||||
|
def option_sensor_scripts(self):
|
||||||
|
"""Config entry option to not track ARP."""
|
||||||
|
return self.config_entry.options.get(
|
||||||
|
CONF_SENSOR_SCRIPTS, DEFAULT_SENSOR_SCRIPTS
|
||||||
|
)
|
||||||
|
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# option_scan_interval
|
# option_scan_interval
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
|
@ -317,7 +329,7 @@ class MikrotikControllerData:
|
||||||
if self.api.connected():
|
if self.api.connected():
|
||||||
await self.hass.async_add_executor_job(self.get_system_health)
|
await self.hass.async_add_executor_job(self.get_system_health)
|
||||||
|
|
||||||
if self.api.connected():
|
if self.api.connected() and self.option_sensor_scripts:
|
||||||
await self.hass.async_add_executor_job(self.get_script)
|
await self.hass.async_add_executor_job(self.get_script)
|
||||||
|
|
||||||
if self.api.connected():
|
if self.api.connected():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue