Add unique_id to Wirelesstag entities. (#95631)
* Add unique_id to Wirelesstag entities. * Update homeassistant/components/wirelesstag/binary_sensor.py Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io> * Update homeassistant/components/wirelesstag/sensor.py Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io> * Update homeassistant/components/wirelesstag/switch.py Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io> --------- Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
parent
c6210b68bd
commit
982a52b91d
3 changed files with 3 additions and 0 deletions
|
@ -100,6 +100,7 @@ class WirelessTagBinarySensor(WirelessTagBaseSensor, BinarySensorEntity):
|
|||
super().__init__(api, tag)
|
||||
self._sensor_type = sensor_type
|
||||
self._name = f"{self._tag.name} {self.event.human_readable_name}"
|
||||
self._attr_unique_id = f"{self.tag_id}_{self._sensor_type}"
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register callbacks."""
|
||||
|
|
|
@ -100,6 +100,7 @@ class WirelessTagSensor(WirelessTagBaseSensor, SensorEntity):
|
|||
self._sensor_type = description.key
|
||||
self.entity_description = description
|
||||
self._name = self._tag.name
|
||||
self._attr_unique_id = f"{self.tag_id}_{self._sensor_type}"
|
||||
|
||||
# I want to see entity_id as:
|
||||
# sensor.wirelesstag_bedroom_temperature
|
||||
|
|
|
@ -82,6 +82,7 @@ class WirelessTagSwitch(WirelessTagBaseSensor, SwitchEntity):
|
|||
super().__init__(api, tag)
|
||||
self.entity_description = description
|
||||
self._name = f"{self._tag.name} {description.name}"
|
||||
self._attr_unique_id = f"{self.tag_id}_{description.key}"
|
||||
|
||||
def turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn on the switch."""
|
||||
|
|
Loading…
Add table
Reference in a new issue