Add Ecobee humidifier device_info and unique_id (#51504)

* Add Ecobee humidifier device_info and unique_id

Ecobee humidifier entity was not connected to the thermostat device.
This change will ensure the entitiy is properly connected.

This change also fills out the ecobee-data.json fixutre data a bit
to address failures in the test setup.

* Add Ecobee humidifier device_info and unique_id

Adjust test fixture data to increase pytest coverage
Clean up indenting in ecobee-data.json

* Add Ecobee humidifier device_info and unique_id

Update exception case in device_info to not
be included in codecov tests. This case has
been tested locally.

* Add Ecobee humidifier device_info and unique_id

Address pylint issue

* Add Ecobee humidifier device_info and unique_id

Remove no cover pragma and add ecobee humidifier.py to
.coveragerc
This commit is contained in:
Brent Petit 2021-06-11 10:39:57 -05:00 committed by GitHub
parent b01b33c304
commit 5cc31a98e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 59 additions and 11 deletions

View File

@ -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

View File

@ -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."""

View File

@ -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

View File

@ -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"
}
]
}
]
}
]
}