We are working with Azure IoT Hub which sends the data to Azure TSI, and we're utilizing the TSI Rest APIs to get the data from it.
Format of data-
Raw telemetry looks like -
{"status":0, "timestamp":123456, plc_id:1}
{"status":0, "timestamp":123456, plc_id:1}
{"status":0, "timestamp":123456, plc_id:1}
{"status":0, "timestamp":123456, plc_id:1}
{"status":1, "timestamp":123456, plc_id:1}
{"status":1, "timestamp":123456, plc_id:1}
{"status":1, "timestamp":123456, plc_id:1}
{"status":1, "timestamp":123456, plc_id:1}
{"status":0, "timestamp":123456, plc_id:1}
I used 123456 just for example in timestamp.
I need to calculate the downtime ( last occurrence of 0 - first occurrence of 0 ), and then ignore status 1, again calculate the downtime for next 0s after 1.
And we need to do it using TSI Rest APIs only. Any idea?