diff --git a/.coveragerc b/.coveragerc index 9437f8943a3..c407c2ab373 100644 --- a/.coveragerc +++ b/.coveragerc @@ -220,6 +220,7 @@ omit = homeassistant/components/ecobee/__init__.py homeassistant/components/ecobee/binary_sensor.py homeassistant/components/ecobee/climate.py + homeassistant/components/ecobee/humidifier.py homeassistant/components/ecobee/notify.py homeassistant/components/ecobee/sensor.py homeassistant/components/ecobee/weather.py diff --git a/homeassistant/components/ecobee/humidifier.py b/homeassistant/components/ecobee/humidifier.py index 5067d5080cb..f39fb7acc68 100644 --- a/homeassistant/components/ecobee/humidifier.py +++ b/homeassistant/components/ecobee/humidifier.py @@ -10,7 +10,7 @@ from homeassistant.components.humidifier.const import ( SUPPORT_MODES, ) -from .const import DOMAIN +from .const import DOMAIN, ECOBEE_MODEL_TO_NAME, MANUFACTURER SCAN_INTERVAL = timedelta(minutes=3) @@ -43,6 +43,32 @@ class EcobeeHumidifier(HumidifierEntity): self.update_without_throttle = False + @property + def name(self): + """Return the name of the humidifier.""" + return self._name + + @property + def unique_id(self): + """Return unique_id for humidifier.""" + return f"{self.thermostat['identifier']}" + + @property + def device_info(self): + """Return device information for the ecobee humidifier.""" + try: + model = f"{ECOBEE_MODEL_TO_NAME[self.thermostat['modelNumber']]} Thermostat" + except KeyError: + # Ecobee model is not in our list + return None + + return { + "identifiers": {(DOMAIN, self.thermostat["identifier"])}, + "name": self.name, + "manufacturer": MANUFACTURER, + "model": model, + } + async def async_update(self): """Get the latest state from the thermostat.""" if self.update_without_throttle: @@ -84,11 +110,6 @@ class EcobeeHumidifier(HumidifierEntity): """Return the current mode, e.g., off, auto, manual.""" return self.thermostat["settings"]["humidifierMode"] - @property - def name(self): - """Return the name of the ecobee thermostat.""" - return self._name - @property def supported_features(self): """Return the list of supported features.""" diff --git a/tests/components/ecobee/test_humidifier.py b/tests/components/ecobee/test_humidifier.py index dd58decfb32..f8a83e4c905 100644 --- a/tests/components/ecobee/test_humidifier.py +++ b/tests/components/ecobee/test_humidifier.py @@ -27,6 +27,7 @@ from homeassistant.const import ( SERVICE_TURN_OFF, SERVICE_TURN_ON, STATE_OFF, + STATE_ON, ) from .common import setup_platform @@ -39,7 +40,7 @@ async def test_attributes(hass): await setup_platform(hass, HUMIDIFIER_DOMAIN) state = hass.states.get(DEVICE_ID) - assert state.state == STATE_OFF + assert state.state == STATE_ON assert state.attributes.get(ATTR_MIN_HUMIDITY) == DEFAULT_MIN_HUMIDITY assert state.attributes.get(ATTR_MAX_HUMIDITY) == DEFAULT_MAX_HUMIDITY assert state.attributes.get(ATTR_HUMIDITY) == 40 diff --git a/tests/fixtures/ecobee/ecobee-data.json b/tests/fixtures/ecobee/ecobee-data.json index 2727103c9b1..6e679616085 100644 --- a/tests/fixtures/ecobee/ecobee-data.json +++ b/tests/fixtures/ecobee/ecobee-data.json @@ -1,6 +1,9 @@ { "thermostatList": [ - {"name": "ecobee", + { + "identifier": 8675309, + "name": "ecobee", + "modelNumber": "athenaSmart", "program": { "climates": [ {"name": "Climate1", "climateRef": "c1"}, @@ -9,6 +12,7 @@ "currentClimateRef": "c1" }, "runtime": { + "connected": false, "actualTemperature": 300, "actualHumidity": 15, "desiredHeat": 400, @@ -24,7 +28,7 @@ "heatCoolMinDelta": 50, "holdAction": "nextTransition", "hasHumidifier": true, - "humidifierMode": "off", + "humidifierMode": "manual", "humidity": "30" }, "equipmentStatus": "fan", @@ -37,7 +41,28 @@ "endDate": "2022-01-01 10:00:00", "startDate": "2022-02-02 11:00:00" } - ]} + ], + "remoteSensors": [ + { + "id": "rs:100", + "name": "Remote Sensor 1", + "type": "ecobee3_remote_sensor", + "code": "WKRP", + "inUse": false, + "capability": [ + { + "id": "1", + "type": "temperature", + "value": "782" + }, { + "id": "2", + "type": "occupancy", + "value": "false" + } + ] + } + ] + } ] +} -} \ No newline at end of file