I installed a sensor for monitoring AC status. It gives me a value of 1 or 0 when the AC is on or off. So, I log that value(0/1) in the database using the transaction group. I want to calculate the total working hours and non-working hours when the AC is on or off. Also, AC data is required to be reported.
How to calculate the working time and non-working time of AC?
I want to log data at specific scheduled times. For example (21:00 PM to 8:00 AM)log time. At this point, the sensor data should be logged into the database.
So, how to log data using transaction group a by specific time?
Use your database's lead() or lag() function to pull a value from the adjacent row for you to compute time deltas (right in the SQL), then sum the time deltas that correspond to on-time.