Get Different Values and Times

Hello, I have this data:

2020-04-30T21:22:25.146Z 1 hallway_spotlight
2020-04-30T21:23:25.16Z 1 hallway_spotlight
2020-04-30T21:24:25.233Z 1 hallway_spotlight
2020-04-30T21:25:25.145Z 0 hallway_spotlight
2020-04-30T21:26:25.69Z 0 hallway_spotlight
2020-04-30T21:27:25.151Z 0 hallway_spotlight
2020-04-30T21:28:25.152Z 1 hallway_spotlight
2020-04-30T21:29:25.466Z 1 hallway_spotlight
2020-04-30T21:30:25.276Z 0 hallway_spotlight
2020-04-30T21:31:25.187Z 0 hallway_spotlight
2020-04-30T21:32:25.169Z 0 hallway_spotlight
2020-04-30T21:33:25.166Z 1 hallway_spotlight
2020-04-30T21:34:25.287Z 1 hallway_spotlight
2020-04-30T21:35:25.324Z 1 hallway_spotlight
2020-04-30T21:36:25.187Z 1 hallway_spotlight

I would like to get the variations in state and the time, like the ones in Bold. To know the time that it changed the state. The tag is hallway_spotlight taht is the device Id

Is this possible with influx and the current data structure?

Thank Tou