mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Clean up smhi redundant code (#50765)
This commit is contained in:
parent
6b34ba012c
commit
add594a44b
@ -2,12 +2,6 @@
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
# Have to import for config_flow to work even if they are not used here
|
|
||||||
from .config_flow import smhi_locations # noqa: F401
|
|
||||||
from .const import DOMAIN # noqa: F401
|
|
||||||
|
|
||||||
DEFAULT_NAME = "smhi"
|
|
||||||
|
|
||||||
PLATFORMS = ["weather"]
|
PLATFORMS = ["weather"]
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ from .const import DOMAIN, HOME_LOCATION_NAME
|
|||||||
def smhi_locations(hass: HomeAssistant) -> set[str]:
|
def smhi_locations(hass: HomeAssistant) -> set[str]:
|
||||||
"""Return configurations of SMHI component."""
|
"""Return configurations of SMHI component."""
|
||||||
return {
|
return {
|
||||||
(slugify(entry.data[CONF_NAME]))
|
slugify(entry.data[CONF_NAME])
|
||||||
for entry in hass.config_entries.async_entries(DOMAIN)
|
for entry in hass.config_entries.async_entries(DOMAIN)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,4 +12,3 @@ DOMAIN = "smhi"
|
|||||||
HOME_LOCATION_NAME = "Home"
|
HOME_LOCATION_NAME = "Home"
|
||||||
|
|
||||||
ENTITY_ID_SENSOR_FORMAT = WEATHER_DOMAIN + ".smhi_{}"
|
ENTITY_ID_SENSOR_FORMAT = WEATHER_DOMAIN + ".smhi_{}"
|
||||||
ENTITY_ID_SENSOR_FORMAT_HOME = ENTITY_ID_SENSOR_FORMAT.format(HOME_LOCATION_NAME)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user