@@ -38,17 +38,13 @@ def __init__(self, coordinator, hass, name, data_type, unit_of_measurement, icon
3838 self ._data_type = data_type
3939 self ._unit_of_measurement = unit_of_measurement
4040 self ._icon = icon
41+ self ._attr_unique_id = f"o2_{ self ._client .number } _{ self ._attr_name .lower ().replace (' ' , '_' )} "
4142
4243 self .entity_id = generate_entity_id (
43- "sensor.{}" , f"o2_ { self ._client . number } _ { self . _attr_name . lower (). replace ( ' ' , '_' ) } " , hass = hass )
44+ "sensor.{}" , self ._attr_unique_id , hass = hass )
4445
4546 self ._attr_device_info = self ._client .get_device_info ()
4647
47- @property
48- def unique_id (self ) -> str :
49- """Return the unique ID of the sensor."""
50- return self .entity_id
51-
5248 @property
5349 def native_value (self ):
5450 """Get value from data returned from API by coordinator"""
@@ -89,17 +85,13 @@ def __init__(self, coordinator, hass):
8985 super ().__init__ (coordinator = coordinator )
9086
9187 self ._client = hass .data [DOMAIN ][DATA_APICLIENT ]
88+ self ._attr_unique_id = f"o2_{ self ._client .number } _{ self ._attr_name .lower ().replace (' ' , '_' )} "
9289
9390 self .entity_id = generate_entity_id (
94- "sensor.{}" , f"o2_ { self ._client . number } _ { self . _attr_name . lower (). replace ( ' ' , '_' ) } " , hass = hass )
91+ "sensor.{}" , self ._attr_unique_id , hass = hass )
9592
9693 self ._attr_device_info = self ._client .get_device_info ()
9794
98- @property
99- def unique_id (self ) -> str :
100- """Return the unique ID of the sensor."""
101- return self .entity_id
102-
10395 @property
10496 def state (self ):
10597 """Return the state."""
0 commit comments