From e5f914bbdbd1308e6be5ba69d0c9a33931ead1d5 Mon Sep 17 00:00:00 2001 From: ollo69 <60491700+ollo69@users.noreply.github.com> Date: Fri, 20 Aug 2021 12:20:39 +0200 Subject: [PATCH] Clean up AsusWRT if check (#54896) --- homeassistant/components/asuswrt/config_flow.py | 7 +------ homeassistant/components/asuswrt/sensor.py | 5 ++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/asuswrt/config_flow.py b/homeassistant/components/asuswrt/config_flow.py index 0ffa674e054..c48ea4d57fe 100644 --- a/homeassistant/components/asuswrt/config_flow.py +++ b/homeassistant/components/asuswrt/config_flow.py @@ -49,12 +49,7 @@ _LOGGER = logging.getLogger(__name__) def _is_file(value) -> bool: """Validate that the value is an existing file.""" file_in = os.path.expanduser(str(value)) - - if not os.path.isfile(file_in): - return False - if not os.access(file_in, os.R_OK): - return False - return True + return os.path.isfile(file_in) and os.access(file_in, os.R_OK) def _get_ip(host): diff --git a/homeassistant/components/asuswrt/sensor.py b/homeassistant/components/asuswrt/sensor.py index a9a005b9837..287ea3e8938 100644 --- a/homeassistant/components/asuswrt/sensor.py +++ b/homeassistant/components/asuswrt/sensor.py @@ -161,7 +161,6 @@ class AsusWrtSensor(CoordinatorEntity, SensorEntity): """Return current state.""" descr = self.entity_description state = self.coordinator.data.get(descr.key) - if state is not None: - if descr.factor and isinstance(state, Number): - return round(state / descr.factor, descr.precision) + if state is not None and descr.factor and isinstance(state, Number): + return round(state / descr.factor, descr.precision) return state -- GitLab