mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
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:
parent
b01b33c304
commit
5cc31a98e2
@ -220,6 +220,7 @@ omit =
|
|||||||
homeassistant/components/ecobee/__init__.py
|
homeassistant/components/ecobee/__init__.py
|
||||||
homeassistant/components/ecobee/binary_sensor.py
|
homeassistant/components/ecobee/binary_sensor.py
|
||||||
homeassistant/components/ecobee/climate.py
|
homeassistant/components/ecobee/climate.py
|
||||||
|
homeassistant/components/ecobee/humidifier.py
|
||||||
homeassistant/components/ecobee/notify.py
|
homeassistant/components/ecobee/notify.py
|
||||||
homeassistant/components/ecobee/sensor.py
|
homeassistant/components/ecobee/sensor.py
|
||||||
homeassistant/components/ecobee/weather.py
|
homeassistant/components/ecobee/weather.py
|
||||||
|
@ -10,7 +10,7 @@ from homeassistant.components.humidifier.const import (
|
|||||||
SUPPORT_MODES,
|
SUPPORT_MODES,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN, ECOBEE_MODEL_TO_NAME, MANUFACTURER
|
||||||
|
|
||||||
SCAN_INTERVAL = timedelta(minutes=3)
|
SCAN_INTERVAL = timedelta(minutes=3)
|
||||||
|
|
||||||
@ -43,6 +43,32 @@ class EcobeeHumidifier(HumidifierEntity):
|
|||||||
|
|
||||||
self.update_without_throttle = False
|
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):
|
async def async_update(self):
|
||||||
"""Get the latest state from the thermostat."""
|
"""Get the latest state from the thermostat."""
|
||||||
if self.update_without_throttle:
|
if self.update_without_throttle:
|
||||||
@ -84,11 +110,6 @@ class EcobeeHumidifier(HumidifierEntity):
|
|||||||
"""Return the current mode, e.g., off, auto, manual."""
|
"""Return the current mode, e.g., off, auto, manual."""
|
||||||
return self.thermostat["settings"]["humidifierMode"]
|
return self.thermostat["settings"]["humidifierMode"]
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Return the name of the ecobee thermostat."""
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
"""Return the list of supported features."""
|
"""Return the list of supported features."""
|
||||||
|
@ -27,6 +27,7 @@ from homeassistant.const import (
|
|||||||
SERVICE_TURN_OFF,
|
SERVICE_TURN_OFF,
|
||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
|
STATE_ON,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .common import setup_platform
|
from .common import setup_platform
|
||||||
@ -39,7 +40,7 @@ async def test_attributes(hass):
|
|||||||
await setup_platform(hass, HUMIDIFIER_DOMAIN)
|
await setup_platform(hass, HUMIDIFIER_DOMAIN)
|
||||||
|
|
||||||
state = hass.states.get(DEVICE_ID)
|
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_MIN_HUMIDITY) == DEFAULT_MIN_HUMIDITY
|
||||||
assert state.attributes.get(ATTR_MAX_HUMIDITY) == DEFAULT_MAX_HUMIDITY
|
assert state.attributes.get(ATTR_MAX_HUMIDITY) == DEFAULT_MAX_HUMIDITY
|
||||||
assert state.attributes.get(ATTR_HUMIDITY) == 40
|
assert state.attributes.get(ATTR_HUMIDITY) == 40
|
||||||
|
35
tests/fixtures/ecobee/ecobee-data.json
vendored
35
tests/fixtures/ecobee/ecobee-data.json
vendored
@ -1,6 +1,9 @@
|
|||||||
{
|
{
|
||||||
"thermostatList": [
|
"thermostatList": [
|
||||||
{"name": "ecobee",
|
{
|
||||||
|
"identifier": 8675309,
|
||||||
|
"name": "ecobee",
|
||||||
|
"modelNumber": "athenaSmart",
|
||||||
"program": {
|
"program": {
|
||||||
"climates": [
|
"climates": [
|
||||||
{"name": "Climate1", "climateRef": "c1"},
|
{"name": "Climate1", "climateRef": "c1"},
|
||||||
@ -9,6 +12,7 @@
|
|||||||
"currentClimateRef": "c1"
|
"currentClimateRef": "c1"
|
||||||
},
|
},
|
||||||
"runtime": {
|
"runtime": {
|
||||||
|
"connected": false,
|
||||||
"actualTemperature": 300,
|
"actualTemperature": 300,
|
||||||
"actualHumidity": 15,
|
"actualHumidity": 15,
|
||||||
"desiredHeat": 400,
|
"desiredHeat": 400,
|
||||||
@ -24,7 +28,7 @@
|
|||||||
"heatCoolMinDelta": 50,
|
"heatCoolMinDelta": 50,
|
||||||
"holdAction": "nextTransition",
|
"holdAction": "nextTransition",
|
||||||
"hasHumidifier": true,
|
"hasHumidifier": true,
|
||||||
"humidifierMode": "off",
|
"humidifierMode": "manual",
|
||||||
"humidity": "30"
|
"humidity": "30"
|
||||||
},
|
},
|
||||||
"equipmentStatus": "fan",
|
"equipmentStatus": "fan",
|
||||||
@ -37,7 +41,28 @@
|
|||||||
"endDate": "2022-01-01 10:00:00",
|
"endDate": "2022-01-01 10:00:00",
|
||||||
"startDate": "2022-02-02 11: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"
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user