Remove default name prefix of HomePods from Suggested Area in Apple TV integration (#109489)

This commit is contained in:
Cody C 2024-02-05 05:22:22 +13:00 committed by GitHub
parent 8a9478b714
commit 2c91b31233
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,7 +40,8 @@ from .const import CONF_CREDENTIALS, CONF_IDENTIFIERS, CONF_START_OFF, DOMAIN
_LOGGER = logging.getLogger(__name__)
DEFAULT_NAME = "Apple TV"
DEFAULT_NAME_TV = "Apple TV"
DEFAULT_NAME_HP = "HomePod"
BACKOFF_TIME_LOWER_LIMIT = 15 # seconds
BACKOFF_TIME_UPPER_LIMIT = 300 # Five minutes
@ -358,7 +359,11 @@ class AppleTVManager(DeviceListener):
ATTR_MANUFACTURER: "Apple",
ATTR_NAME: self.config_entry.data[CONF_NAME],
}
attrs[ATTR_SUGGESTED_AREA] = attrs[ATTR_NAME].removesuffix(f" {DEFAULT_NAME}")
attrs[ATTR_SUGGESTED_AREA] = (
attrs[ATTR_NAME]
.removesuffix(f" {DEFAULT_NAME_TV}")
.removesuffix(f" {DEFAULT_NAME_HP}")
)
if self.atv:
dev_info = self.atv.device_info