From 1f0e235b993c64dff9b3eac68e88ff891bd75590 Mon Sep 17 00:00:00 2001 From: disforw Date: Thu, 1 Jun 2023 10:13:07 -0400 Subject: [PATCH] Move QNAP constants (#93918) * Create const.py * Update sensor.py * Add docstring * Update sensor.py * Update homeassistant/components/qnap/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/qnap/const.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> --- homeassistant/components/qnap/const.py | 6 ++++++ homeassistant/components/qnap/sensor.py | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 homeassistant/components/qnap/const.py diff --git a/homeassistant/components/qnap/const.py b/homeassistant/components/qnap/const.py new file mode 100644 index 00000000000..b5a0aef3dbc --- /dev/null +++ b/homeassistant/components/qnap/const.py @@ -0,0 +1,6 @@ +"""The Qnap constants.""" + +DEFAULT_PORT = 8080 +DEFAULT_TIMEOUT = 5 + +DOMAIN = "qnap" diff --git a/homeassistant/components/qnap/sensor.py b/homeassistant/components/qnap/sensor.py index 66fc5631718..ca81b2763fa 100644 --- a/homeassistant/components/qnap/sensor.py +++ b/homeassistant/components/qnap/sensor.py @@ -35,6 +35,8 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.util import Throttle +from .const import DEFAULT_PORT, DEFAULT_TIMEOUT + _LOGGER = logging.getLogger(__name__) ATTR_DRIVE = "Drive" @@ -56,9 +58,6 @@ ATTR_VOLUME_SIZE = "Volume Size" CONF_DRIVES = "drives" CONF_NICS = "nics" CONF_VOLUMES = "volumes" -DEFAULT_NAME = "QNAP" -DEFAULT_PORT = 8080 -DEFAULT_TIMEOUT = 5 MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=1)