diff --git a/homeassistant/components/rfxtrx/__init__.py b/homeassistant/components/rfxtrx/__init__.py index 5f665a242ad..f817668156f 100644 --- a/homeassistant/components/rfxtrx/__init__.py +++ b/homeassistant/components/rfxtrx/__init__.py @@ -328,7 +328,7 @@ class RfxtrxDevice(Entity): self._event = event self._state = datas[ATTR_STATE] self._should_fire_event = datas[ATTR_FIRE_EVENT] - self._unique_id = f"{slugify(self._event.device.type_string.lower())}_{slugify(self._event.device.id_string.lower())}" + self._unique_id = f"{event.device.packettype:x}_{event.device.subtype:x}_{event.device.id_string}" @property def should_poll(self): diff --git a/homeassistant/components/rfxtrx/binary_sensor.py b/homeassistant/components/rfxtrx/binary_sensor.py index 1f756fe4487..13ba00af0bf 100644 --- a/homeassistant/components/rfxtrx/binary_sensor.py +++ b/homeassistant/components/rfxtrx/binary_sensor.py @@ -162,14 +162,15 @@ class RfxtrxBinarySensor(BinarySensorEntity): self._data_bits = data_bits self._cmd_on = cmd_on self._cmd_off = cmd_off - self._unique_id = f"{slugify(self.event.device.type_string.lower())}_{slugify(self.event.device.id_string.lower())}" if data_bits is not None: self._masked_id = get_pt2262_deviceid( event.device.id_string.lower(), data_bits ) + self._unique_id = f"{event.device.packettype:x}_{event.device.subtype:x}_{self._masked_id}" else: self._masked_id = None + self._unique_id = f"{event.device.packettype:x}_{event.device.subtype:x}_{event.device.id_string}" async def async_added_to_hass(self): """Restore RFXtrx switch device state (ON/OFF).""" diff --git a/homeassistant/components/rfxtrx/sensor.py b/homeassistant/components/rfxtrx/sensor.py index 1ba22ab5435..76b033aebee 100644 --- a/homeassistant/components/rfxtrx/sensor.py +++ b/homeassistant/components/rfxtrx/sensor.py @@ -119,7 +119,9 @@ class RfxtrxSensor(Entity): self.should_fire_event = should_fire_event self.data_type = data_type self._unit_of_measurement = DATA_TYPES.get(data_type, "") - self._unique_id = f"{slugify(device.type_string.lower())}_{slugify(device.id_string.lower())}_{slugify(data_type)}" + self._unique_id = ( + f"{device.packettype:x}_{device.subtype:x}_{device.id_string}_{data_type}" + ) async def async_added_to_hass(self): """Restore RFXtrx switch device state (ON/OFF)."""