Provide unique id for enocean devices (#71774)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
rhadamantys 2022-05-17 13:43:36 +02:00 committed by GitHub
parent 7d2deae592
commit c67bbd06d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 8 deletions

View file

@ -1,6 +1,7 @@
"""Support for EnOcean binary sensors."""
from __future__ import annotations
from enocean.utils import combine_hex
import voluptuous as vol
from homeassistant.components.binary_sensor import (
@ -57,6 +58,7 @@ class EnOceanBinarySensor(EnOceanEntity, BinarySensorEntity):
self._device_class = device_class
self.which = -1
self.onoff = -1
self._attr_unique_id = f"{combine_hex(dev_id)}-{device_class}"
@property
def name(self):