Fix updates of Rssi for control devices in rfxtrx (#38131)
* Change entity to entity_info * Fix bug in RSSI for Control devices
This commit is contained in:
1 parent
eb1970c015
commit
0e0f61764a
3 files changed
+70
-12
No files matched your search
@@ -48,7 +48,7 @@ async def async_setup_entry(
|
||||
def supported(event):
|
||||
return isinstance(event, rfxtrxmod.ControlEvent)
|
||||
|
||||
for packet_id, entity in discovery_info[CONF_DEVICES].items():
|
||||
for packet_id, entity_info in discovery_info[CONF_DEVICES].items():
|
||||
event = get_rfx_object(packet_id)
|
||||
if event is None:
|
||||
_LOGGER.error("Invalid device: %s", packet_id)
|
||||
@@ -56,7 +56,9 @@ async def async_setup_entry(
|
||||
if not supported(event):
|
||||
continue
|
||||
|
||||
device_id = get_device_id(event.device, data_bits=entity.get(CONF_DATA_BITS))
|
||||
device_id = get_device_id(
|
||||
event.device, data_bits=entity_info.get(CONF_DATA_BITS)
|
||||
)
|
||||
if device_id in device_ids:
|
||||
continue
|
||||
device_ids.add(device_id)
|
||||
@@ -68,11 +70,11 @@ async def async_setup_entry(
|
||||
device = RfxtrxBinarySensor(
|
||||
event.device,
|
||||
device_id,
|
||||
entity.get(CONF_DEVICE_CLASS),
|
||||
entity.get(CONF_OFF_DELAY),
|
||||
entity.get(CONF_DATA_BITS),
|
||||
entity.get(CONF_COMMAND_ON),
|
||||
entity.get(CONF_COMMAND_OFF),
|
||||
entity_info.get(CONF_DEVICE_CLASS),
|
||||
entity_info.get(CONF_OFF_DELAY),
|
||||
entity_info.get(CONF_DATA_BITS),
|
||||
entity_info.get(CONF_COMMAND_ON),
|
||||
entity_info.get(CONF_COMMAND_OFF),
|
||||
)
|
||||
sensors.append(device)
|
||||
|
||||
|
||||
Reference in new issue
Block a user