Add unique ID for NOAA Tides sensor (#137988)

This commit is contained in:
jdelaney72 2025-02-09 13:32:11 -08:00 committed by GitHub
parent 7678f8fddd
commit e8e4d2a83c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View 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()}"

View File

@ -22,6 +22,8 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from homeassistant.util.unit_system import METRIC_SYSTEM
from .helpers import get_station_unique_id
if TYPE_CHECKING:
from pandas import Timestamp
@ -105,6 +107,7 @@ class NOAATidesAndCurrentsSensor(SensorEntity):
self._unit_system = unit_system
self._station = station
self.data: NOAATidesData | None = None
self._attr_unique_id = f"{get_station_unique_id(station_id)}_summary"
@property
def name(self) -> str: