From 8e6240f4350b309985f98002d57317610b9d06db Mon Sep 17 00:00:00 2001 From: dougiteixeira <31328123+dougiteixeira@users.noreply.github.com> Date: Sun, 12 Nov 2023 16:23:51 -0300 Subject: [PATCH] Update __init__.py --- custom_components/proxmoxve/__init__.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/custom_components/proxmoxve/__init__.py b/custom_components/proxmoxve/__init__.py index 1d26684..8f42234 100644 --- a/custom_components/proxmoxve/__init__.py +++ b/custom_components/proxmoxve/__init__.py @@ -50,6 +50,7 @@ DEFAULT_REALM, DEFAULT_VERIFY_SSL, DOMAIN, + INTEGRATION_TITLE, LOGGER, PROXMOX_CLIENT, VERSION_REMOVE_YAML, @@ -132,7 +133,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: severity=IssueSeverity.WARNING, translation_key="yaml_deprecated", translation_placeholders={ - "integration": "Proxmox VE", + "integration": INTEGRATION_TITLE, "platform": DOMAIN, "version": VERSION_REMOVE_YAML, }, @@ -147,7 +148,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: severity=IssueSeverity.ERROR, translation_key="import_invalid_port", translation_placeholders={ - "integration": "Proxmox VE", + "integration": INTEGRATION_TITLE, "platform": DOMAIN, "host": conf.get[CONF_HOST], "port": conf.get[CONF_PORT], @@ -364,11 +365,11 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b severity=IssueSeverity.ERROR, translation_key="resource_nonexistent", translation_placeholders={ - "integration": "Proxmox VE", + "integration": INTEGRATION_TITLE, "platform": DOMAIN, "host": config_entry.data[CONF_HOST], "port": config_entry.data[CONF_PORT], - "resource_type": "Node", + "resource_type": ProxmoxType.Node.capitalize(), "resource": node, }, ) @@ -400,11 +401,11 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b severity=IssueSeverity.ERROR, translation_key="resource_nonexistent", translation_placeholders={ - "integration": "Proxmox VE", + "integration": INTEGRATION_TITLE, "platform": DOMAIN, "host": config_entry.data[CONF_HOST], "port": config_entry.data[CONF_PORT], - "resource_type": ProxmoxType.QEMU, + "resource_type": ProxmoxType.QEMU.upper(), "resource": vm_id, }, ) @@ -436,11 +437,11 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b severity=IssueSeverity.ERROR, translation_key="resource_nonexistent", translation_placeholders={ - "integration": "Proxmox VE", + "integration": INTEGRATION_TITLE, "platform": DOMAIN, "host": config_entry.data[CONF_HOST], "port": config_entry.data[CONF_PORT], - "resource_type": ProxmoxType.LXC, + "resource_type": ProxmoxType.LXC.upper(), "resource": container_id, }, ) @@ -472,11 +473,11 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b severity=IssueSeverity.ERROR, translation_key="resource_nonexistent", translation_placeholders={ - "integration": "Proxmox VE", + "integration": INTEGRATION_TITLE, "platform": DOMAIN, "host": config_entry.data[CONF_HOST], "port": config_entry.data[CONF_PORT], - "resource_type": ProxmoxType.Storage, + "resource_type": ProxmoxType.Storage.capitalize(), "resource": storage_id, }, ) @@ -579,8 +580,8 @@ def device_info( model_processor = coordinator_data.model proxmox_version = f"Proxmox {coordinator_data.version}" - name = f"{api_category.capitalize()} {node}" - identifier = f"{config_entry.entry_id}_{api_category.upper()}_{node}" + name = f"{ProxmoxType.Node.capitalize()} {node}" + identifier = f"{config_entry.entry_id}_{ProxmoxType.Node.upper()}_{node}" url = f"https://{host}:{port}/#v1:0:=node/{node}" via_device = ("", "") model = model_processor