}
}
+# insert missing sensor readings
+$dbh->do( qq{
+
+create temporary table nl_received as select _id,json->'received' as received from nodelog where json->'received' is not null;
+
+create temporary table eg_received as select _id,json->'received' as received from eg5120 where json->'received' is not null;
+
+create temporary table nl_new as select * from nl_received where received not in (select received from eg_received) ;
+
+select to_timestamp((json->>'received')::int8/1000), time,mac,addr,"nodeId",json,_id,sensor_type from nodelog where _id in (select _id from nl_new);
+
+insert into eg5120 select to_timestamp((json->>'received')::int8/1000) as time,mac,addr,"nodeId",json,sensor_type from nodelog where _id in (select _id from nl_new);
+
+} );