From cee14afc03d9b229b27c63b904415d5634c71b37 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 11 Sep 2024 16:08:12 +0200 Subject: [PATCH] Move shared constant in zabbix (#125744) --- homeassistant/components/zabbix/__init__.py | 3 ++- homeassistant/components/zabbix/const.py | 3 +++ homeassistant/components/zabbix/sensor.py | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 homeassistant/components/zabbix/const.py diff --git a/homeassistant/components/zabbix/__init__.py b/homeassistant/components/zabbix/__init__.py index 851af54da32..924903b241d 100644 --- a/homeassistant/components/zabbix/__init__.py +++ b/homeassistant/components/zabbix/__init__.py @@ -34,13 +34,14 @@ from homeassistant.helpers.entityfilter import ( ) from homeassistant.helpers.typing import ConfigType +from .const import DOMAIN + _LOGGER = logging.getLogger(__name__) CONF_PUBLISH_STATES_HOST = "publish_states_host" DEFAULT_SSL = False DEFAULT_PATH = "zabbix" -DOMAIN = "zabbix" TIMEOUT = 5 RETRY_DELAY = 20 diff --git a/homeassistant/components/zabbix/const.py b/homeassistant/components/zabbix/const.py new file mode 100644 index 00000000000..5f710381f38 --- /dev/null +++ b/homeassistant/components/zabbix/const.py @@ -0,0 +1,3 @@ +"""Constants for Zabbix.""" + +DOMAIN = "zabbix" diff --git a/homeassistant/components/zabbix/sensor.py b/homeassistant/components/zabbix/sensor.py index 2187deb22e8..7cf1ed43cd9 100644 --- a/homeassistant/components/zabbix/sensor.py +++ b/homeassistant/components/zabbix/sensor.py @@ -19,7 +19,7 @@ import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType, StateType -from .. import zabbix +from .const import DOMAIN _LOGGER = logging.getLogger(__name__) @@ -52,7 +52,7 @@ def setup_platform( """Set up the Zabbix sensor platform.""" sensors: list[ZabbixTriggerCountSensor] = [] - if not (zapi := hass.data[zabbix.DOMAIN]): + if not (zapi := hass.data[DOMAIN]): _LOGGER.error("Zabbix integration hasn't been loaded? zapi is None") return