Add pjlink const (#91749)

* Add pjlink const

This is a precursor

* Use DOMAIN const in pjlink media player

* fixup! Add pjlink const
This commit is contained in:
Kevin McCormack 2023-04-20 13:27:44 -04:00 committed by GitHub
parent b3d50e67cd
commit 672fb44041
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View file

@ -0,0 +1,8 @@
"""Constants for the PJLink integration."""
CONF_ENCODING = "encoding"
DEFAULT_PORT = 4352
DEFAULT_ENCODING = "utf-8"
DOMAIN = "pjlink"

View file

@ -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: