Not sure if this is by design? with the Ecobee weather card, but it appears to be missing the forecast icons between the day and the high/low tempature.
Not sure if this is by design? with the Ecobee weather card, but it appears to be missing the forecast icons between the day and the high/low tempature.
No idea how to fix but I have also had this issue since I set up the ecobee component.
I have the same issue. Did you figure out how to fix it?
I just noticed this too. I think the problem is the ecobee weather component needs to massage the conditions it returns. Where I am, it’s currently returning partly cloudy overnight
instead of partlycloudy
.
I’ve pasted the start of a fix at the end of this comment, you need to replace homeassistant/components/weather/ecobee.py
with the code.
I say start because I’ve only been able to map Ecobee to Home Assistant weather that is actually happening where I live. If you use the new code you can tell what weather isn’t mapped by looking in the logs or, for docker, you can also run this command:
docker logs home-assistant 2>&1 | grep unhandled-cond
And you’ll see output like this:
2019-02-26 11:10:11 INFO (MainThread) [eweather] unhandled-cond=light snow (< 1 in.) in the evening.
2019-02-26 11:10:11 INFO (MainThread) [eweather] unhandled-cond=light snow (< 1 in.) in the evening.
After I map a few more weather descriptions and, assuming this is the correct fix, I’ll create a pull request to get this into the official release.
"""
Support for displaying weather info from Ecobee API.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/weather.ecobee/
"""
import logging
from datetime import datetime
from homeassistant.components import ecobee
from homeassistant.components.weather import (
ATTR_FORECAST_CONDITION, ATTR_FORECAST_TEMP, ATTR_FORECAST_TEMP_LOW,
ATTR_FORECAST_TIME, ATTR_FORECAST_WIND_SPEED, WeatherEntity)
from homeassistant.const import TEMP_FAHRENHEIT
_LOGGER = logging.getLogger('eweather')
DEPENDENCIES = ['ecobee']
ATTR_FORECAST_TEMP_HIGH = 'temphigh'
ATTR_FORECAST_PRESSURE = 'pressure'
ATTR_FORECAST_VISIBILITY = 'visibility'
ATTR_FORECAST_HUMIDITY = 'humidity'
MISSING_DATA = -5002
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Ecobee weather component."""
if discovery_info is None:
return
dev = list()
data = ecobee.NETWORK
for index in range(len(data.ecobee.thermostats)):
thermostat = data.ecobee.get_thermostat(index)
if 'weather' in thermostat:
dev.append(EcobeeWeather(thermostat['name'], index))
add_entities(dev, True)
class EcobeeWeather(WeatherEntity):
"""Representation of Ecobee weather data."""
def __init__(self, name, index):
"""Initialize the Ecobee weather platform."""
self._name = name
self._index = index
self.weather = None
def get_forecast(self, index, param):
"""Retrieve forecast parameter."""
try:
forecast = self.weather['forecasts'][index]
return forecast[param]
except (ValueError, IndexError, KeyError):
raise ValueError
@property
def name(self):
"""Return the name of the sensor."""
return self._name
@property
def condition(self):
"""Return the current condition."""
try:
return ew_to_ha( self.get_forecast(0, 'condition') )
except ValueError:
return None
@property
def temperature(self):
"""Return the temperature."""
try:
return float(self.get_forecast(0, 'temperature')) / 10
except ValueError:
return None
@property
def temperature_unit(self):
"""Return the unit of measurement."""
return TEMP_FAHRENHEIT
@property
def pressure(self):
"""Return the pressure."""
try:
return int(self.get_forecast(0, 'pressure'))
except ValueError:
return None
@property
def humidity(self):
"""Return the humidity."""
try:
return int(self.get_forecast(0, 'relativeHumidity'))
except ValueError:
return None
@property
def visibility(self):
"""Return the visibility."""
try:
return int(self.get_forecast(0, 'visibility'))/1000
except ValueError:
return None
@property
def wind_speed(self):
"""Return the wind speed."""
try:
return int(self.get_forecast(0, 'windSpeed'))
except ValueError:
return None
@property
def wind_bearing(self):
"""Return the wind direction."""
try:
return int(self.get_forecast(0, 'windBearing'))
except ValueError:
return None
@property
def attribution(self):
"""Return the attribution."""
if self.weather:
station = self.weather.get('weatherStation', "UNKNOWN")
time = self.weather.get('timestamp', "UNKNOWN")
return "Ecobee weather provided by {} at {}".format(station, time)
return None
@property
def forecast(self):
"""Return the forecast array."""
try:
forecasts = []
for day in self.weather['forecasts']:
date_time = datetime.strptime(day['dateTime'],
'%Y-%m-%d %H:%M:%S').isoformat()
forecast = {
ATTR_FORECAST_TIME: date_time,
ATTR_FORECAST_CONDITION: ew_to_ha(day['condition']),
ATTR_FORECAST_TEMP: float(day['tempHigh']) / 10,
}
if day['tempHigh'] == MISSING_DATA:
break
if day['tempLow'] != MISSING_DATA:
forecast[ATTR_FORECAST_TEMP_LOW] = \
float(day['tempLow']) / 10
if day['pressure'] != MISSING_DATA:
forecast[ATTR_FORECAST_PRESSURE] = int(day['pressure'])
if day['windSpeed'] != MISSING_DATA:
forecast[ATTR_FORECAST_WIND_SPEED] = int(day['windSpeed'])
if day['visibility'] != MISSING_DATA:
forecast[ATTR_FORECAST_WIND_SPEED] = int(day['visibility'])/1000
if day['relativeHumidity'] != MISSING_DATA:
forecast[ATTR_FORECAST_HUMIDITY] = \
int(day['relativeHumidity'])
forecasts.append(forecast)
return forecasts
except (ValueError, IndexError, KeyError):
return None
def update(self):
"""Get the latest state of the sensor."""
data = ecobee.NETWORK
data.update()
thermostat = data.ecobee.get_thermostat(self._index)
self.weather = thermostat.get('weather', None)
def ew_to_ha( cond ):
cond = cond.lower()
_LOGGER.info( 'cond=' + cond )
if cond.startswith('snow') or cond.startswith('light snow'):
return 'snowy'
if cond.startswith('partly cloudy'):
return 'partlycloudy'
if cond.startswith('mostly cloudy'):
return 'cloudy'
if cond.startswith('breezy'):
return 'windy'
if cond.startswith('clear'):
return 'clear-night'
_LOGGER.info( 'unhandled-cond=' + cond )
return cond
I hate to revive an old thread but many updates along and I still have this problem, is this the only official fix currently? I would LOVE to have my icons back
Looks like this has been corrected in 0.101.1. I now have the icons displaying.