Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaae committed Nov 5, 2023
1 parent 593aca5 commit 80bae0c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions custom_components/mikrotik_router/binary_sensor_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"comment",
]


@dataclass
class MikrotikBinarySensorEntityDescription(BinarySensorEntityDescription):
"""Class describing mikrotik entities."""
Expand Down
3 changes: 2 additions & 1 deletion custom_components/mikrotik_router/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ async def async_step_sensor_select(self, user_input=None):
vol.Optional(
CONF_SENSOR_NETWATCH_TRACKER,
default=self.config_entry.options.get(
CONF_SENSOR_NETWATCH_TRACKER, DEFAULT_SENSOR_NETWATCH_TRACKER
CONF_SENSOR_NETWATCH_TRACKER,
DEFAULT_SENSOR_NETWATCH_TRACKER,
),
): bool,
vol.Optional(
Expand Down
10 changes: 7 additions & 3 deletions custom_components/mikrotik_router/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
CONF_SENSOR_SCRIPTS,
DEFAULT_SENSOR_SCRIPTS,
CONF_SENSOR_ENVIRONMENT,
DEFAULT_SENSOR_ENVIRONMENT, CONF_SENSOR_NETWATCH_TRACKER, DEFAULT_SENSOR_NETWATCH_TRACKER,
DEFAULT_SENSOR_ENVIRONMENT,
CONF_SENSOR_NETWATCH_TRACKER,
DEFAULT_SENSOR_NETWATCH_TRACKER,
)
from .exceptions import ApiEntryNotFound
from .apiparser import parse_api
Expand Down Expand Up @@ -258,7 +260,7 @@ def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry):
"environment": {},
"ups": {},
"gps": {},
"netwatch": {}
"netwatch": {},
}

self.notified_flags = []
Expand Down Expand Up @@ -393,7 +395,9 @@ def option_sensor_kidcontrol(self):
@property
def option_sensor_netwatch(self):
"""Config entry option to not track ARP."""
return self.config_entry.options.get(CONF_SENSOR_NETWATCH_TRACKER, DEFAULT_SENSOR_NETWATCH_TRACKER)
return self.config_entry.options.get(
CONF_SENSOR_NETWATCH_TRACKER, DEFAULT_SENSOR_NETWATCH_TRACKER
)

# ---------------------------
# option_sensor_ppp
Expand Down
7 changes: 2 additions & 5 deletions custom_components/mikrotik_router/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,8 @@ def _skip_sensor(config_entry, entity_description, data, uid) -> bool:
):
return True

if (
entity_description.data_path == "netwatch"
and not config_entry.options.get(
CONF_SENSOR_NETWATCH_TRACKER, DEFAULT_SENSOR_NETWATCH_TRACKER
)
if entity_description.data_path == "netwatch" and not config_entry.options.get(
CONF_SENSOR_NETWATCH_TRACKER, DEFAULT_SENSOR_NETWATCH_TRACKER
):
return True

Expand Down

0 comments on commit 80bae0c

Please sign in to comment.