mirror of
https://github.com/home-assistant/core.git
synced 2026-07-07 14:56:25 +01:00
d766aae436
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: frenck <195327+frenck@users.noreply.github.com>
18 lines
548 B
Python
18 lines
548 B
Python
"""Utils for CO2 signal."""
|
|
|
|
from collections.abc import Mapping
|
|
from typing import Any
|
|
|
|
from homeassistant.const import CONF_COUNTRY_CODE, CONF_LATITUDE, CONF_LONGITUDE
|
|
|
|
|
|
def get_extra_name(config: Mapping[str, Any]) -> str | None:
|
|
"""Return the extra name describing the location if not home."""
|
|
if CONF_COUNTRY_CODE in config:
|
|
return config[CONF_COUNTRY_CODE] # type: ignore[no-any-return]
|
|
|
|
if CONF_LATITUDE in config:
|
|
return f"{round(config[CONF_LATITUDE], 2)}, {round(config[CONF_LONGITUDE], 2)}"
|
|
|
|
return None
|