mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add unique ID for NOAA Tides sensor (#137988)
This commit is contained in:
parent
7678f8fddd
commit
e8e4d2a83c
6
homeassistant/components/noaa_tides/helpers.py
Normal file
6
homeassistant/components/noaa_tides/helpers.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
"""Helpers for NOAA Tides integration."""
|
||||||
|
|
||||||
|
|
||||||
|
def get_station_unique_id(station_id: str) -> str:
|
||||||
|
"""Convert a station ID to a unique ID."""
|
||||||
|
return f"{station_id.lower()}"
|
@ -22,6 +22,8 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
|||||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
from homeassistant.util.unit_system import METRIC_SYSTEM
|
from homeassistant.util.unit_system import METRIC_SYSTEM
|
||||||
|
|
||||||
|
from .helpers import get_station_unique_id
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from pandas import Timestamp
|
from pandas import Timestamp
|
||||||
|
|
||||||
@ -105,6 +107,7 @@ class NOAATidesAndCurrentsSensor(SensorEntity):
|
|||||||
self._unit_system = unit_system
|
self._unit_system = unit_system
|
||||||
self._station = station
|
self._station = station
|
||||||
self.data: NOAATidesData | None = None
|
self.data: NOAATidesData | None = None
|
||||||
|
self._attr_unique_id = f"{get_station_unique_id(station_id)}_summary"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user