How best to injest sensor data into database

Is it better to:

  1. set up sensors in HA and let HA save those states to InfluxDB or
  2. set up something like telegraf that listens to MQTT (and other data sources) directly and inserts the sensor data directly?

Im worries about the unnecessary event handling HA must do when all sensor updates go thorugh HA. Seems like (2) would be a cleaner solution. Not sure how HA would then be able to trigger automations based off the data though.

Does anyone have any experiencing in managing sensor data and large datasets?
Would be interesting to know how you went about it.

If all you are doing with the sensor data is sending it to influxdb, then it makes sense not use HA at all.

But you normally are using the sensor data to trigger automations, and if you have the data in HA anyway, it adds very little processing to send the data to influxdb from HA.

Yeah sensors in HA is the way to go. The reason I ask is because I want to track some data that is not directly useful but becomes useful when evaluated with template sensors and such.