From 0f6a0f6bcdde52a5f312fb2e5e85dc977003f79f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 12 Jul 2021 04:30:54 -1000 Subject: [PATCH] Add the Trane brand to nexia (#52805) --- homeassistant/components/nexia/config_flow.py | 20 +++++++++++++++---- homeassistant/components/nexia/const.py | 3 ++- homeassistant/components/nexia/manifest.json | 4 ++-- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/nexia/config_flow.py b/homeassistant/components/nexia/config_flow.py index 18c20a8f92a..4e48123a5de 100644 --- a/homeassistant/components/nexia/config_flow.py +++ b/homeassistant/components/nexia/config_flow.py @@ -1,7 +1,7 @@ """Config flow for Nexia integration.""" import logging -from nexia.const import BRAND_ASAIR, BRAND_NEXIA +from nexia.const import BRAND_ASAIR, BRAND_NEXIA, BRAND_TRANE from nexia.home import NexiaHome from requests.exceptions import ConnectTimeout, HTTPError import voluptuous as vol @@ -9,7 +9,13 @@ import voluptuous as vol from homeassistant import config_entries, core, exceptions from homeassistant.const import CONF_PASSWORD, CONF_USERNAME -from .const import BRAND_ASAIR_NAME, BRAND_NEXIA_NAME, CONF_BRAND, DOMAIN +from .const import ( + BRAND_ASAIR_NAME, + BRAND_NEXIA_NAME, + BRAND_TRANE_NAME, + CONF_BRAND, + DOMAIN, +) from .util import is_invalid_auth_code _LOGGER = logging.getLogger(__name__) @@ -19,7 +25,11 @@ DATA_SCHEMA = vol.Schema( vol.Required(CONF_USERNAME): str, vol.Required(CONF_PASSWORD): str, vol.Required(CONF_BRAND, default=BRAND_NEXIA): vol.In( - {BRAND_NEXIA: BRAND_NEXIA_NAME, BRAND_ASAIR: BRAND_ASAIR_NAME} + { + BRAND_NEXIA: BRAND_NEXIA_NAME, + BRAND_ASAIR: BRAND_ASAIR_NAME, + BRAND_TRANE: BRAND_TRANE_NAME, + } ), } ) @@ -31,7 +41,9 @@ async def validate_input(hass: core.HomeAssistant, data): Data has the keys from DATA_SCHEMA with values provided by the user. """ - state_file = hass.config.path(f"nexia_config_{data[CONF_USERNAME]}.conf") + state_file = hass.config.path( + f"{data[CONF_BRAND]}_config_{data[CONF_USERNAME]}.conf" + ) try: nexia_home = NexiaHome( username=data[CONF_USERNAME], diff --git a/homeassistant/components/nexia/const.py b/homeassistant/components/nexia/const.py index d6e3e5f8008..22b24c3b764 100644 --- a/homeassistant/components/nexia/const.py +++ b/homeassistant/components/nexia/const.py @@ -33,4 +33,5 @@ SIGNAL_ZONE_UPDATE = "NEXIA_CLIMATE_ZONE_UPDATE" SIGNAL_THERMOSTAT_UPDATE = "NEXIA_CLIMATE_THERMOSTAT_UPDATE" BRAND_NEXIA_NAME = "Nexia" -BRAND_ASAIR_NAME = "American Standard" +BRAND_ASAIR_NAME = "American Standard Home" +BRAND_TRANE_NAME = "Trane Home" diff --git a/homeassistant/components/nexia/manifest.json b/homeassistant/components/nexia/manifest.json index ed1247ee9e3..eb471597ec6 100644 --- a/homeassistant/components/nexia/manifest.json +++ b/homeassistant/components/nexia/manifest.json @@ -1,7 +1,7 @@ { "domain": "nexia", - "name": "Nexia/American Standard", - "requirements": ["nexia==0.9.7"], + "name": "Nexia/American Standard/Trane", + "requirements": ["nexia==0.9.9"], "codeowners": ["@bdraco"], "documentation": "https://www.home-assistant.io/integrations/nexia", "config_flow": true, diff --git a/requirements_all.txt b/requirements_all.txt index 64473042f2b..2c5f5995925 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1018,7 +1018,7 @@ nettigo-air-monitor==1.0.0 neurio==0.3.1 # homeassistant.components.nexia -nexia==0.9.7 +nexia==0.9.9 # homeassistant.components.nextcloud nextcloudmonitor==1.1.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index b38a2b4fd18..5cf667419a2 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -572,7 +572,7 @@ netdisco==2.9.0 nettigo-air-monitor==1.0.0 # homeassistant.components.nexia -nexia==0.9.7 +nexia==0.9.9 # homeassistant.components.notify_events notify-events==1.0.4