fix naming bug (#17976)

pull/18120/head
Tomas Hellström 2018-10-30 10:44:07 +01:00 committed by Paulus Schoutsen
parent afc70fda50
commit 5910161202
1 changed files with 3 additions and 3 deletions

View File

@ -19,7 +19,7 @@ from homeassistant.const import (
CONF_NAME, TEMP_CELSIUS)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import aiohttp_client
from homeassistant.util import dt, Throttle
from homeassistant.util import dt, slugify, Throttle
from homeassistant.components.weather import (
WeatherEntity, ATTR_FORECAST_CONDITION, ATTR_FORECAST_TEMP,
@ -73,11 +73,11 @@ async def async_setup_entry(hass: HomeAssistant,
config_entries) -> bool:
"""Add a weather entity from map location."""
location = config_entry.data
name = location[CONF_NAME]
name = slugify(location[CONF_NAME])
session = aiohttp_client.async_get_clientsession(hass)
entity = SmhiWeather(name, location[CONF_LATITUDE],
entity = SmhiWeather(location[CONF_NAME], location[CONF_LATITUDE],
location[CONF_LONGITUDE],
session=session)
entity.entity_id = ENTITY_ID_SENSOR_FORMAT.format(name)