diff --git a/homeassistant/components/ecobee/binary_sensor.py b/homeassistant/components/ecobee/binary_sensor.py index 0d3174cb5a6..b81a5e6bef6 100644 --- a/homeassistant/components/ecobee/binary_sensor.py +++ b/homeassistant/components/ecobee/binary_sensor.py @@ -80,6 +80,12 @@ class EcobeeBinarySensor(BinarySensorEntity): } return None + @property + def available(self): + """Return true if device is available.""" + thermostat = self.data.ecobee.get_thermostat(self.index) + return thermostat["runtime"]["connected"] + @property def is_on(self): """Return the status of the sensor.""" diff --git a/homeassistant/components/ecobee/humidifier.py b/homeassistant/components/ecobee/humidifier.py index fadaa83155a..984609c2f22 100644 --- a/homeassistant/components/ecobee/humidifier.py +++ b/homeassistant/components/ecobee/humidifier.py @@ -69,6 +69,11 @@ class EcobeeHumidifier(HumidifierEntity): "model": model, } + @property + def available(self): + """Return if device is available.""" + return self.thermostat["runtime"]["connected"] + async def async_update(self): """Get the latest state from the thermostat.""" if self.update_without_throttle: diff --git a/homeassistant/components/ecobee/sensor.py b/homeassistant/components/ecobee/sensor.py index 7cf04e12718..275db46ab0a 100644 --- a/homeassistant/components/ecobee/sensor.py +++ b/homeassistant/components/ecobee/sensor.py @@ -92,6 +92,12 @@ class EcobeeSensor(SensorEntity): } return None + @property + def available(self): + """Return true if device is available.""" + thermostat = self.data.ecobee.get_thermostat(self.index) + return thermostat["runtime"]["connected"] + @property def device_class(self): """Return the device class of the sensor.""" diff --git a/tests/components/ecobee/test_climate.py b/tests/components/ecobee/test_climate.py index cc394a1f63f..ec466197995 100644 --- a/tests/components/ecobee/test_climate.py +++ b/tests/components/ecobee/test_climate.py @@ -22,6 +22,7 @@ def ecobee_fixture(): "currentClimateRef": "c1", }, "runtime": { + "connected": True, "actualTemperature": 300, "actualHumidity": 15, "desiredHeat": 400, diff --git a/tests/fixtures/ecobee/ecobee-data.json b/tests/fixtures/ecobee/ecobee-data.json index 6e679616085..a4caa72798d 100644 --- a/tests/fixtures/ecobee/ecobee-data.json +++ b/tests/fixtures/ecobee/ecobee-data.json @@ -12,7 +12,7 @@ "currentClimateRef": "c1" }, "runtime": { - "connected": false, + "connected": true, "actualTemperature": 300, "actualHumidity": 15, "desiredHeat": 400,