Analysis to find the last device to have sent data

Analysis to find the last device to have sent data

Hello, I'm working on an analysis  where I want to  find the last device to have sent data. I tried something where   I get all my device last input and I sort on the most recent. But it's a long process because I have more than 100 hundred device. I think I can use  a function from Tagoio SDK to get the device list filtred by last_input but unfortunetaly I can't run it. Can you help me please to find an easier way to do it.