mirror of
https://github.com/home-assistant/core.git
synced 2025-07-12 15:57:06 +00:00
Clean up AsusWRT if check (#54896)
This commit is contained in:
parent
3a2afb8bde
commit
e5f914bbdb
@ -49,12 +49,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
def _is_file(value) -> bool:
|
def _is_file(value) -> bool:
|
||||||
"""Validate that the value is an existing file."""
|
"""Validate that the value is an existing file."""
|
||||||
file_in = os.path.expanduser(str(value))
|
file_in = os.path.expanduser(str(value))
|
||||||
|
return os.path.isfile(file_in) and os.access(file_in, os.R_OK)
|
||||||
if not os.path.isfile(file_in):
|
|
||||||
return False
|
|
||||||
if not os.access(file_in, os.R_OK):
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def _get_ip(host):
|
def _get_ip(host):
|
||||||
|
@ -161,7 +161,6 @@ class AsusWrtSensor(CoordinatorEntity, SensorEntity):
|
|||||||
"""Return current state."""
|
"""Return current state."""
|
||||||
descr = self.entity_description
|
descr = self.entity_description
|
||||||
state = self.coordinator.data.get(descr.key)
|
state = self.coordinator.data.get(descr.key)
|
||||||
if state is not None:
|
if state is not None and descr.factor and isinstance(state, Number):
|
||||||
if descr.factor and isinstance(state, Number):
|
return round(state / descr.factor, descr.precision)
|
||||||
return round(state / descr.factor, descr.precision)
|
|
||||||
return state
|
return state
|
||||||
|
Loading…
x
Reference in New Issue
Block a user