From 9e32b230163a26d79ac958fe6d053e21474f8970 Mon Sep 17 00:00:00 2001 From: Jake Colman Date: Fri, 18 Aug 2023 00:53:07 +0000 Subject: [PATCH 01/12] Add indoor sensors to Honeywell integration --- homeassistant/components/honeywell/const.py | 7 +++-- homeassistant/components/honeywell/sensor.py | 31 ++++++++++++++++---- tests/components/honeywell/test_climate.py | 2 +- tests/components/honeywell/test_init.py | 12 ++++++-- tests/components/honeywell/test_sensor.py | 29 ++++++++++++++++++ 5 files changed, 69 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/honeywell/const.py b/homeassistant/components/honeywell/const.py index 94455d569cb9ca..874b4a14d2cdd7 100644 --- a/homeassistant/components/honeywell/const.py +++ b/homeassistant/components/honeywell/const.py @@ -9,7 +9,8 @@ DEFAULT_HEAT_AWAY_TEMPERATURE = 61 CONF_DEV_ID = "thermostat" CONF_LOC_ID = "location" -TEMPERATURE_STATUS_KEY = "outdoor_temperature" -HUMIDITY_STATUS_KEY = "outdoor_humidity" - +OUTDOOR_TEMPERATURE_STATUS_KEY = "outdoor_temperature" +OUTDOOR_HUMIDITY_STATUS_KEY = "outdoor_humidity" +CURRENT_TEMPERATURE_STATUS_KEY = "current_temperature" +CURRENT_HUMIDITY_STATUS_KEY = "current_humidity" _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/honeywell/sensor.py b/homeassistant/components/honeywell/sensor.py index c1f70bbdd1fbf3..ad1aecaa015b22 100644 --- a/homeassistant/components/honeywell/sensor.py +++ b/homeassistant/components/honeywell/sensor.py @@ -20,8 +20,13 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import StateType -from . import HoneywellData -from .const import DOMAIN, HUMIDITY_STATUS_KEY, TEMPERATURE_STATUS_KEY +from .const import ( + CURRENT_HUMIDITY_STATUS_KEY, + CURRENT_TEMPERATURE_STATUS_KEY, + DOMAIN, + OUTDOOR_HUMIDITY_STATUS_KEY, + OUTDOOR_TEMPERATURE_STATUS_KEY, +) def _get_temperature_sensor_unit(device: Device) -> str: @@ -48,7 +53,7 @@ class HoneywellSensorEntityDescription( SENSOR_TYPES: tuple[HoneywellSensorEntityDescription, ...] = ( HoneywellSensorEntityDescription( - key=TEMPERATURE_STATUS_KEY, + key=OUTDOOR_TEMPERATURE_STATUS_KEY, translation_key="outdoor_temperature", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, @@ -56,13 +61,29 @@ class HoneywellSensorEntityDescription( unit_fn=_get_temperature_sensor_unit, ), HoneywellSensorEntityDescription( - key=HUMIDITY_STATUS_KEY, + key=OUTDOOR_HUMIDITY_STATUS_KEY, translation_key="outdoor_humidity", device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, value_fn=lambda device: device.outdoor_humidity, unit_fn=lambda device: PERCENTAGE, ), + HoneywellSensorEntityDescription( + key=CURRENT_TEMPERATURE_STATUS_KEY, + translation_key="current_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + value_fn=lambda device: device.current_temperature, + unit_fn=_get_temperature_sensor_unit, + ), + HoneywellSensorEntityDescription( + key=CURRENT_HUMIDITY_STATUS_KEY, + translation_key="current_humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + value_fn=lambda device: device.current_humidity, + unit_fn=lambda device: PERCENTAGE, + ), ) @@ -89,7 +110,7 @@ class HoneywellSensor(SensorEntity): entity_description: HoneywellSensorEntityDescription _attr_has_entity_name = True - def __init__(self, device, description): + def __init__(self, device, description) -> None: """Initialize the outdoor temperature sensor.""" self._device = device self.entity_description = description diff --git a/tests/components/honeywell/test_climate.py b/tests/components/honeywell/test_climate.py index 4d6989d79e8829..1ebb34ada923b8 100644 --- a/tests/components/honeywell/test_climate.py +++ b/tests/components/honeywell/test_climate.py @@ -54,7 +54,7 @@ async def test_no_thermostat_options( """Test the setup of the climate entities when there are no additional options available.""" device._data = {} await init_integration(hass, config_entry) - assert len(hass.states.async_all()) == 1 + assert len(hass.states.async_all()) == 2 async def test_static_attributes( diff --git a/tests/components/honeywell/test_init.py b/tests/components/honeywell/test_init.py index 36c94c83f318ea..f7629fa958e887 100644 --- a/tests/components/honeywell/test_init.py +++ b/tests/components/honeywell/test_init.py @@ -27,7 +27,9 @@ async def test_setup_entry(hass: HomeAssistant, config_entry: MockConfigEntry) - await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() assert config_entry.state is ConfigEntryState.LOADED - assert hass.states.async_entity_ids_count() == 1 + assert ( + hass.states.async_entity_ids_count() == 3 + ) # 1 climate entity; 2 sensor entities async def test_setup_multiple_thermostats( @@ -39,7 +41,9 @@ async def test_setup_multiple_thermostats( await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() assert config_entry.state is ConfigEntryState.LOADED - assert hass.states.async_entity_ids_count() == 2 + assert ( + hass.states.async_entity_ids_count() == 6 + ) # 2 climate entities; 4 sensor entities async def test_setup_multiple_thermostats_with_same_deviceid( @@ -58,7 +62,9 @@ async def test_setup_multiple_thermostats_with_same_deviceid( await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() assert config_entry.state is ConfigEntryState.LOADED - assert hass.states.async_entity_ids_count() == 1 + assert ( + hass.states.async_entity_ids_count() == 3 + ) # 1 climate entity; 2 sensor entities assert "Platform honeywell does not generate unique IDs" not in caplog.text diff --git a/tests/components/honeywell/test_sensor.py b/tests/components/honeywell/test_sensor.py index c40c90131a8003..bc4b022185ad82 100644 --- a/tests/components/honeywell/test_sensor.py +++ b/tests/components/honeywell/test_sensor.py @@ -33,3 +33,32 @@ async def test_outdoor_sensor( assert humidity_state assert temperature_state.state == temp assert humidity_state.state == "25" + + +@pytest.mark.parametrize(("unit", "temp"), [("C", "5"), ("F", "-15")]) +async def test_indoor_sensor( + hass: HomeAssistant, + config_entry: MockConfigEntry, + location: Location, + device_with_outdoor_sensor: Device, + unit, + temp, +) -> None: + """Test indoor temperature sensor.""" + device_with_outdoor_sensor.temperature_unit = unit + device_with_outdoor_sensor.current_temperature = 5 + device_with_outdoor_sensor.current_humidity = 25 + location.devices_by_id[ + device_with_outdoor_sensor.deviceid + ] = device_with_outdoor_sensor + config_entry.add_to_hass(hass) + await hass.config_entries.async_setup(config_entry.entry_id) + await hass.async_block_till_done() + + temperature_state = hass.states.get("sensor.device1_temperature") + humidity_state = hass.states.get("sensor.device1_humidity") + + assert temperature_state + assert humidity_state + assert temperature_state.state == temp + assert humidity_state.state == "25" From 9e8cb34110e0c2f3649b0158aab416e1de2efc96 Mon Sep 17 00:00:00 2001 From: Jake Colman Date: Sun, 20 Aug 2023 02:54:40 +0000 Subject: [PATCH 02/12] Add test for specific entities --- tests/components/honeywell/test_climate.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/components/honeywell/test_climate.py b/tests/components/honeywell/test_climate.py index 1ebb34ada923b8..c78da3b4152b20 100644 --- a/tests/components/honeywell/test_climate.py +++ b/tests/components/honeywell/test_climate.py @@ -54,7 +54,10 @@ async def test_no_thermostat_options( """Test the setup of the climate entities when there are no additional options available.""" device._data = {} await init_integration(hass, config_entry) - assert len(hass.states.async_all()) == 2 + assert len(hass.states.async_all()) == 3 # 1 climate sensor; 2 indoor sensors + assert hass.states.get("climate.device1") + assert hass.states.get("sensor.device1_temperature") + assert hass.states.get("sensor.device1_humidity") async def test_static_attributes( From fdf24cc20e9a1a7c979fdc47775151ab77e38e5c Mon Sep 17 00:00:00 2001 From: Jake Colman Date: Sun, 20 Aug 2023 13:04:21 +0000 Subject: [PATCH 03/12] Improve the indoor sensors test --- tests/components/honeywell/conftest.py | 21 +++++++++++++++++- tests/components/honeywell/test_climate.py | 1 - tests/components/honeywell/test_sensor.py | 25 ++++++++++++---------- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/tests/components/honeywell/conftest.py b/tests/components/honeywell/conftest.py index bedd42909443f1..d745c239f1e270 100644 --- a/tests/components/honeywell/conftest.py +++ b/tests/components/honeywell/conftest.py @@ -121,7 +121,7 @@ def device_with_outdoor_sensor(): "hasFan": False, } mock_device.system_mode = "off" - mock_device.name = "device1" + mock_device.name = "device3" mock_device.current_temperature = CURRENTTEMPERATURE mock_device.mac_address = "macaddress1" mock_device.temperature_unit = "C" @@ -130,6 +130,25 @@ def device_with_outdoor_sensor(): return mock_device +@pytest.fixture +def device_with_indoor_sensors_only(): + """Mock a somecomfort.Device.""" + mock_device = create_autospec(aiosomecomfort.device.Device, instance=True) + mock_device.deviceid = 1234567 + mock_device._data = { + "canControlHumidification": False, + "hasFan": False, + } + mock_device.system_mode = "off" + mock_device.name = "device4" + mock_device.current_temperature = CURRENTTEMPERATURE + mock_device.mac_address = "macaddress1" + mock_device.temperature_unit = "C" + mock_device.outdoor_temperature = None + mock_device.outdoor_humidity = None + return mock_device + + @pytest.fixture def another_device(): """Mock a somecomfort.Device.""" diff --git a/tests/components/honeywell/test_climate.py b/tests/components/honeywell/test_climate.py index c78da3b4152b20..db390ddc2c3756 100644 --- a/tests/components/honeywell/test_climate.py +++ b/tests/components/honeywell/test_climate.py @@ -54,7 +54,6 @@ async def test_no_thermostat_options( """Test the setup of the climate entities when there are no additional options available.""" device._data = {} await init_integration(hass, config_entry) - assert len(hass.states.async_all()) == 3 # 1 climate sensor; 2 indoor sensors assert hass.states.get("climate.device1") assert hass.states.get("sensor.device1_temperature") assert hass.states.get("sensor.device1_humidity") diff --git a/tests/components/honeywell/test_sensor.py b/tests/components/honeywell/test_sensor.py index bc4b022185ad82..541d62210ef827 100644 --- a/tests/components/honeywell/test_sensor.py +++ b/tests/components/honeywell/test_sensor.py @@ -26,8 +26,8 @@ async def test_outdoor_sensor( await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() - temperature_state = hass.states.get("sensor.device1_outdoor_temperature") - humidity_state = hass.states.get("sensor.device1_outdoor_humidity") + temperature_state = hass.states.get("sensor.device3_outdoor_temperature") + humidity_state = hass.states.get("sensor.device3_outdoor_humidity") assert temperature_state assert humidity_state @@ -40,23 +40,26 @@ async def test_indoor_sensor( hass: HomeAssistant, config_entry: MockConfigEntry, location: Location, - device_with_outdoor_sensor: Device, + device_with_indoor_sensors_only: Device, unit, temp, ) -> None: - """Test indoor temperature sensor.""" - device_with_outdoor_sensor.temperature_unit = unit - device_with_outdoor_sensor.current_temperature = 5 - device_with_outdoor_sensor.current_humidity = 25 + """Test indoor temperature sensor with no outdoor sensors.""" + device_with_indoor_sensors_only.temperature_unit = unit + device_with_indoor_sensors_only.current_temperature = 5 + device_with_indoor_sensors_only.current_humidity = 25 location.devices_by_id[ - device_with_outdoor_sensor.deviceid - ] = device_with_outdoor_sensor + device_with_indoor_sensors_only.deviceid + ] = device_with_indoor_sensors_only config_entry.add_to_hass(hass) await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() - temperature_state = hass.states.get("sensor.device1_temperature") - humidity_state = hass.states.get("sensor.device1_humidity") + assert hass.states.get("sensor.device4_outdoor_temperature") is None + assert hass.states.get("sensor.device4_outdoor_humidity") is None + + temperature_state = hass.states.get("sensor.device4_temperature") + humidity_state = hass.states.get("sensor.device4_humidity") assert temperature_state assert humidity_state From 0de0f4fa6f78f4d290c016a89f146878f649d0e0 Mon Sep 17 00:00:00 2001 From: Jake Colman Date: Sun, 20 Aug 2023 21:51:32 +0000 Subject: [PATCH 04/12] Removed extraneous mock device --- tests/components/honeywell/conftest.py | 19 ------------------- tests/components/honeywell/test_sensor.py | 20 +++++++++----------- 2 files changed, 9 insertions(+), 30 deletions(-) diff --git a/tests/components/honeywell/conftest.py b/tests/components/honeywell/conftest.py index d745c239f1e270..8406d76803a330 100644 --- a/tests/components/honeywell/conftest.py +++ b/tests/components/honeywell/conftest.py @@ -130,25 +130,6 @@ def device_with_outdoor_sensor(): return mock_device -@pytest.fixture -def device_with_indoor_sensors_only(): - """Mock a somecomfort.Device.""" - mock_device = create_autospec(aiosomecomfort.device.Device, instance=True) - mock_device.deviceid = 1234567 - mock_device._data = { - "canControlHumidification": False, - "hasFan": False, - } - mock_device.system_mode = "off" - mock_device.name = "device4" - mock_device.current_temperature = CURRENTTEMPERATURE - mock_device.mac_address = "macaddress1" - mock_device.temperature_unit = "C" - mock_device.outdoor_temperature = None - mock_device.outdoor_humidity = None - return mock_device - - @pytest.fixture def another_device(): """Mock a somecomfort.Device.""" diff --git a/tests/components/honeywell/test_sensor.py b/tests/components/honeywell/test_sensor.py index 541d62210ef827..b286132a40f1af 100644 --- a/tests/components/honeywell/test_sensor.py +++ b/tests/components/honeywell/test_sensor.py @@ -40,26 +40,24 @@ async def test_indoor_sensor( hass: HomeAssistant, config_entry: MockConfigEntry, location: Location, - device_with_indoor_sensors_only: Device, + device: Device, unit, temp, ) -> None: """Test indoor temperature sensor with no outdoor sensors.""" - device_with_indoor_sensors_only.temperature_unit = unit - device_with_indoor_sensors_only.current_temperature = 5 - device_with_indoor_sensors_only.current_humidity = 25 - location.devices_by_id[ - device_with_indoor_sensors_only.deviceid - ] = device_with_indoor_sensors_only + device.temperature_unit = unit + device.current_temperature = 5 + device.current_humidity = 25 + location.devices_by_id[device.deviceid] = device config_entry.add_to_hass(hass) await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() - assert hass.states.get("sensor.device4_outdoor_temperature") is None - assert hass.states.get("sensor.device4_outdoor_humidity") is None + assert hass.states.get("sensor.device1_outdoor_temperature") is None + assert hass.states.get("sensor.device1_outdoor_humidity") is None - temperature_state = hass.states.get("sensor.device4_temperature") - humidity_state = hass.states.get("sensor.device4_humidity") + temperature_state = hass.states.get("sensor.device1_temperature") + humidity_state = hass.states.get("sensor.device1_humidity") assert temperature_state assert humidity_state From 41d8f2b209e49031f8031e674bf685465e53072b Mon Sep 17 00:00:00 2001 From: Jake Colman Date: Mon, 21 Aug 2023 22:37:08 +0000 Subject: [PATCH 05/12] Fix ruff and mypy error --- homeassistant/components/honeywell/sensor.py | 1 + 1 file changed, 1 insertion(+) diff --git a/homeassistant/components/honeywell/sensor.py b/homeassistant/components/honeywell/sensor.py index ad1aecaa015b22..19d90a496456bd 100644 --- a/homeassistant/components/honeywell/sensor.py +++ b/homeassistant/components/honeywell/sensor.py @@ -20,6 +20,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import StateType +from . import HoneywellData from .const import ( CURRENT_HUMIDITY_STATUS_KEY, CURRENT_TEMPERATURE_STATUS_KEY, From 1d8468eac01c8514863c9871791d1fccf33f947f Mon Sep 17 00:00:00 2001 From: Jake Colman Date: Tue, 22 Aug 2023 13:36:12 -0400 Subject: [PATCH 06/12] Update homeassistant/components/honeywell/sensor.py Co-authored-by: Robert Resch --- homeassistant/components/honeywell/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/honeywell/sensor.py b/homeassistant/components/honeywell/sensor.py index 19d90a496456bd..7a396686bf4cb0 100644 --- a/homeassistant/components/honeywell/sensor.py +++ b/homeassistant/components/honeywell/sensor.py @@ -55,7 +55,7 @@ class HoneywellSensorEntityDescription( SENSOR_TYPES: tuple[HoneywellSensorEntityDescription, ...] = ( HoneywellSensorEntityDescription( key=OUTDOOR_TEMPERATURE_STATUS_KEY, - translation_key="outdoor_temperature", + translation_key=OUTDOOR_TEMPERATURE_STATUS_KEY, device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, value_fn=lambda device: device.outdoor_temperature, From 1e321e989d91eedd135994d334bdef0441b91ff5 Mon Sep 17 00:00:00 2001 From: Jake Colman Date: Tue, 22 Aug 2023 13:36:23 -0400 Subject: [PATCH 07/12] Update homeassistant/components/honeywell/sensor.py Co-authored-by: Robert Resch --- homeassistant/components/honeywell/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/honeywell/sensor.py b/homeassistant/components/honeywell/sensor.py index 7a396686bf4cb0..00c5c6fd6abd40 100644 --- a/homeassistant/components/honeywell/sensor.py +++ b/homeassistant/components/honeywell/sensor.py @@ -63,7 +63,7 @@ class HoneywellSensorEntityDescription( ), HoneywellSensorEntityDescription( key=OUTDOOR_HUMIDITY_STATUS_KEY, - translation_key="outdoor_humidity", + translation_key=OUTDOOR_HUMIDITY_STATUS_KEY, device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, value_fn=lambda device: device.outdoor_humidity, From cd49ca4815df6d8bfd1f8c6f77c97924ac369211 Mon Sep 17 00:00:00 2001 From: Jake Colman Date: Tue, 22 Aug 2023 13:36:35 -0400 Subject: [PATCH 08/12] Update homeassistant/components/honeywell/sensor.py Co-authored-by: Robert Resch --- homeassistant/components/honeywell/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/honeywell/sensor.py b/homeassistant/components/honeywell/sensor.py index 00c5c6fd6abd40..f90d15aa374632 100644 --- a/homeassistant/components/honeywell/sensor.py +++ b/homeassistant/components/honeywell/sensor.py @@ -71,7 +71,7 @@ class HoneywellSensorEntityDescription( ), HoneywellSensorEntityDescription( key=CURRENT_TEMPERATURE_STATUS_KEY, - translation_key="current_temperature", + translation_key=CURRENT_TEMPERATURE_STATUS_KEY, device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, value_fn=lambda device: device.current_temperature, From aad0ba7f23e5c4ef0f0ca3c501e962752536e118 Mon Sep 17 00:00:00 2001 From: Jake Colman Date: Tue, 22 Aug 2023 13:36:41 -0400 Subject: [PATCH 09/12] Update homeassistant/components/honeywell/sensor.py Co-authored-by: Robert Resch --- homeassistant/components/honeywell/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/honeywell/sensor.py b/homeassistant/components/honeywell/sensor.py index f90d15aa374632..c1f8dd1d48f8fc 100644 --- a/homeassistant/components/honeywell/sensor.py +++ b/homeassistant/components/honeywell/sensor.py @@ -79,7 +79,7 @@ class HoneywellSensorEntityDescription( ), HoneywellSensorEntityDescription( key=CURRENT_HUMIDITY_STATUS_KEY, - translation_key="current_humidity", + translation_key=CURRENT_HUMIDITY_STATUS_KEY, device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, value_fn=lambda device: device.current_humidity, From dcc5a7e1befbf5fff0f007e1247a0e080499e7ad Mon Sep 17 00:00:00 2001 From: Jake Colman Date: Tue, 22 Aug 2023 20:12:18 -0400 Subject: [PATCH 10/12] Update homeassistant/components/honeywell/sensor.py Co-authored-by: G Johansson --- homeassistant/components/honeywell/sensor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/homeassistant/components/honeywell/sensor.py b/homeassistant/components/honeywell/sensor.py index c1f8dd1d48f8fc..450a35d5debee2 100644 --- a/homeassistant/components/honeywell/sensor.py +++ b/homeassistant/components/honeywell/sensor.py @@ -71,7 +71,6 @@ class HoneywellSensorEntityDescription( ), HoneywellSensorEntityDescription( key=CURRENT_TEMPERATURE_STATUS_KEY, - translation_key=CURRENT_TEMPERATURE_STATUS_KEY, device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, value_fn=lambda device: device.current_temperature, From a7090185ddb5d17a3c157423361e48046020e864 Mon Sep 17 00:00:00 2001 From: Jake Colman Date: Tue, 22 Aug 2023 20:12:24 -0400 Subject: [PATCH 11/12] Update homeassistant/components/honeywell/sensor.py Co-authored-by: G Johansson --- homeassistant/components/honeywell/sensor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/homeassistant/components/honeywell/sensor.py b/homeassistant/components/honeywell/sensor.py index 450a35d5debee2..e0fdf4d3e1f0c6 100644 --- a/homeassistant/components/honeywell/sensor.py +++ b/homeassistant/components/honeywell/sensor.py @@ -78,7 +78,6 @@ class HoneywellSensorEntityDescription( ), HoneywellSensorEntityDescription( key=CURRENT_HUMIDITY_STATUS_KEY, - translation_key=CURRENT_HUMIDITY_STATUS_KEY, device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, value_fn=lambda device: device.current_humidity, From 805c2dc01bce6e408aaa3402074c350cc36a81f8 Mon Sep 17 00:00:00 2001 From: Jake Colman Date: Thu, 24 Aug 2023 00:13:12 +0000 Subject: [PATCH 12/12] Moved sensor-specific constants into the sensor file --- homeassistant/components/honeywell/const.py | 4 ---- homeassistant/components/honeywell/sensor.py | 13 ++++++------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/honeywell/const.py b/homeassistant/components/honeywell/const.py index 874b4a14d2cdd7..d5153a69f65a10 100644 --- a/homeassistant/components/honeywell/const.py +++ b/homeassistant/components/honeywell/const.py @@ -9,8 +9,4 @@ DEFAULT_HEAT_AWAY_TEMPERATURE = 61 CONF_DEV_ID = "thermostat" CONF_LOC_ID = "location" -OUTDOOR_TEMPERATURE_STATUS_KEY = "outdoor_temperature" -OUTDOOR_HUMIDITY_STATUS_KEY = "outdoor_humidity" -CURRENT_TEMPERATURE_STATUS_KEY = "current_temperature" -CURRENT_HUMIDITY_STATUS_KEY = "current_humidity" _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/honeywell/sensor.py b/homeassistant/components/honeywell/sensor.py index e0fdf4d3e1f0c6..9542648b996818 100644 --- a/homeassistant/components/honeywell/sensor.py +++ b/homeassistant/components/honeywell/sensor.py @@ -21,13 +21,12 @@ from homeassistant.helpers.typing import StateType from . import HoneywellData -from .const import ( - CURRENT_HUMIDITY_STATUS_KEY, - CURRENT_TEMPERATURE_STATUS_KEY, - DOMAIN, - OUTDOOR_HUMIDITY_STATUS_KEY, - OUTDOOR_TEMPERATURE_STATUS_KEY, -) +from .const import DOMAIN + +OUTDOOR_TEMPERATURE_STATUS_KEY = "outdoor_temperature" +OUTDOOR_HUMIDITY_STATUS_KEY = "outdoor_humidity" +CURRENT_TEMPERATURE_STATUS_KEY = "current_temperature" +CURRENT_HUMIDITY_STATUS_KEY = "current_humidity" def _get_temperature_sensor_unit(device: Device) -> str: