Batch Influxdb writes. Refactor code

Rather than write to Influxdb on every packet, batch series over 1 second duration (`influxWriteInterval`) . I've also tried to tidy the code a bit.