From cd6b14c6c908ab67e3c7b7aaf4316243ffc10ba7 Mon Sep 17 00:00:00 2001 From: RogerSelwyn Date: Thu, 22 Dec 2022 12:32:26 +0000 Subject: [PATCH] Fix notify service name for converted accounts --- custom_components/o365/notify.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/custom_components/o365/notify.py b/custom_components/o365/notify.py index 3e57227..dd9e27d 100644 --- a/custom_components/o365/notify.py +++ b/custom_components/o365/notify.py @@ -20,6 +20,7 @@ CONF_ACCOUNT_NAME, CONF_CONFIG_TYPE, DOMAIN, + LEGACY_ACCOUNT_NAME, PERM_MAIL_SEND, PERM_MINIMUM_SEND, ) @@ -67,9 +68,12 @@ def __init__(self, account, hass, config): ) self._cleanup_files = [] self._hass = hass - if account_name := config.get(CONF_ACCOUNT_NAME, None): - account_name = f"_{account_name}" - self._account_name = account_name + self._account_name = config.get(CONF_ACCOUNT_NAME, None) + if self._account_name: + if self._account_name == LEGACY_ACCOUNT_NAME: + self._account_name = "" + else: + self._account_name = f"_{self._account_name}" @property def targets(self):