diff --git a/homeassistant/components/pjlink/const.py b/homeassistant/components/pjlink/const.py new file mode 100644 index 00000000000..95e29e5bf23 --- /dev/null +++ b/homeassistant/components/pjlink/const.py @@ -0,0 +1,8 @@ +"""Constants for the PJLink integration.""" + +CONF_ENCODING = "encoding" + +DEFAULT_PORT = 4352 +DEFAULT_ENCODING = "utf-8" + +DOMAIN = "pjlink" diff --git a/homeassistant/components/pjlink/media_player.py b/homeassistant/components/pjlink/media_player.py index 3fb5facac5e..4bbf1225a92 100644 --- a/homeassistant/components/pjlink/media_player.py +++ b/homeassistant/components/pjlink/media_player.py @@ -19,11 +19,7 @@ import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType -CONF_ENCODING = "encoding" - -DEFAULT_PORT = 4352 -DEFAULT_ENCODING = "utf-8" -DEFAULT_TIMEOUT = 10 +from .const import CONF_ENCODING, DEFAULT_ENCODING, DEFAULT_PORT, DOMAIN ERR_PROJECTOR_UNAVAILABLE = "projector unavailable" @@ -51,9 +47,9 @@ def setup_platform( encoding = config.get(CONF_ENCODING) password = config.get(CONF_PASSWORD) - if "pjlink" not in hass.data: - hass.data["pjlink"] = {} - hass_data = hass.data["pjlink"] + if DOMAIN not in hass.data: + hass.data[DOMAIN] = {} + hass_data = hass.data[DOMAIN] device_label = f"{host}:{port}" if device_label in hass_data: