Attempt to set unique id of rfxtrx device (#37159)

This commit is contained in:
Joakim Plate authored and GitHub committed 2020-06-27 21:59:42 -07:00
1 parent 10f296ba17
commit 201dab93ff
3 files changed
+18

No files matched your search

@@ -197,6 +197,7 @@ 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(
@@ -255,6 +256,11 @@ class RfxtrxBinarySensor(BinarySensorEntity):
"""Return true if the sensor state is True."""
return self._state
@property
def unique_id(self):
"""Return unique identifier of remote device."""
return self._unique_id
def apply_cmd(self, cmd):
"""Apply a command for updating the state."""
if cmd == self.cmd_on: