mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-27 19:28:54 +02:00
Sensor environment selection #68
This commit is contained in:
parent
53e95c9d57
commit
97faa3f617
1 changed files with 13 additions and 1 deletions
|
@ -43,6 +43,8 @@ from .const import (
|
|||
DEFAULT_SENSOR_NAT,
|
||||
CONF_SENSOR_SCRIPTS,
|
||||
DEFAULT_SENSOR_SCRIPTS,
|
||||
CONF_SENSOR_ENVIRONMENT,
|
||||
DEFAULT_SENSOR_ENVIRONMENT,
|
||||
)
|
||||
from .exceptions import ApiEntryNotFound
|
||||
from .helper import parse_api
|
||||
|
@ -201,6 +203,16 @@ class MikrotikControllerData:
|
|||
CONF_SENSOR_SCRIPTS, DEFAULT_SENSOR_SCRIPTS
|
||||
)
|
||||
|
||||
# ---------------------------
|
||||
# option_sensor_environment
|
||||
# ---------------------------
|
||||
@property
|
||||
def option_sensor_environment(self):
|
||||
"""Config entry option to not track ARP."""
|
||||
return self.config_entry.options.get(
|
||||
CONF_SENSOR_ENVIRONMENT, DEFAULT_SENSOR_ENVIRONMENT
|
||||
)
|
||||
|
||||
# ---------------------------
|
||||
# option_scan_interval
|
||||
# ---------------------------
|
||||
|
@ -491,7 +503,7 @@ class MikrotikControllerData:
|
|||
if self.api.connected() and self.option_sensor_simple_queues:
|
||||
await self.hass.async_add_executor_job(self.get_queue)
|
||||
|
||||
if self.api.connected():
|
||||
if self.api.connected() and self.option_sensor_environment:
|
||||
await self.hass.async_add_executor_job(self.get_environment)
|
||||
|
||||
async_dispatcher_send(self.hass, self.signal_update)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue