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:
Rob Bierbooms
2020-07-24 01:49:46 +02:00
committed by GitHub
parent eb1970c015
commit 0e0f61764a
3 changed files with 70 additions and 12 deletions

View File

@@ -65,7 +65,7 @@ async def async_setup_entry(
return isinstance(event, (ControlEvent, SensorEvent))
entities = []
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)
@@ -73,7 +73,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)
)
for data_type in set(event.values) & set(DATA_TYPES):
data_id = (*device_id, data_type)
if data_id in data_ids:
@@ -169,9 +171,6 @@ class RfxtrxSensor(RfxtrxEntity):
@callback
def _handle_event(self, event, device_id):
"""Check if event applies to me and update."""
if not isinstance(event, SensorEvent):
return
if device_id != self._device_id:
return