Thanks for the code Shmuel, sadly it's not quite what I need. I'm hoping to have each time category sandwiched by two time points. For time_cat = 0, I want to create an entry with time 00:00:00 and an entry at time 06:00:00. For time_cat = 1, an entry at the start with time 06:00:00 and one at the end at 10:00:00.. For time_cat = 2, one starting at 11:00:00AM and one ending at 15:00:00. For time_cat = 3, the first entry starting at 17:00:00 and one final entry ending at 21:00:00. In each case I'm hoping to create those entries and pull the sensor value that occurs closest to that time point.
... View more