If I were you I would store every state change with database insertions;
From on to off
152311837, pump1, 1
152311838, pump1, 0
From off to on
152311837, pump1, 0
152311838, pump1, 1
And if you want to figure out how long pump1 has been working just use an integration query like this:
SELECT integral(value) FROM "yourdb"."yourmeasurement" WHERE "tag" = 'pump1' and time > x and time < y
If you query like this, you get a value which represents all the seconds your pump has been on, thus giving you a duration .