File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,13 @@ def _map_readings_to_devices(
5858 device_identifier : Union [int , str ] = reading .device_id
5959 if device_identifier == 0 :
6060 device_identifier = reading .hilo_id
61- if device := self .find_device (device_identifier ):
61+ device = self .find_device (device_identifier )
62+ # If device_id was 0 and hilo_id lookup failed, this is likely
63+ # a gateway reading that arrives before GatewayValuesReceived
64+ # assigns the real ID. Fall back to the gateway device.
65+ if device is None and reading .device_id == 0 :
66+ device = next ((d for d in self .devices if d .type == "Gateway" ), None )
67+ if device :
6268 device .update_readings (reading )
6369 LOG .debug ("%s Received %s" , device , reading )
6470 if device not in updated_devices :
You can’t perform that action at this time.
0 commit comments