Continuously read data from .csv file

Hi guys,
on my server where HA is running I have set up several cron jobs which monitor the internet connection, both connectivity itself as well as speeds. It will be written out as CSV file.

What I would like to have is that this data is shown as diagram in home assistant which is regularly updated.

Can this be done? Googling for it I mainly find solutions where only a single import is done, and are rather complicated.

Hi Patrick,

A quick google led me to this

More importantly the sensor platform where you can write a value_template to extract the values that you need to assign to a sensor.


Alternatively if you’re outside of HA you could write scripts to tail the csv and post to mqtt, set up sensors from the mqtt subsubsciption

Either way it’s a bit of coding involved I’m afraid

Thanks for the answer.

Actually I have just changed my approach in that I have removed the cron jobs, and instead set up command_line sensors in HA with the appropriate intervals, which record a single actual value each. I have then enabled recorder/history for those 3 sensors exclusively, so I would be able to use the history graph card to show all the values in a diagram.

Seems to work well, and its probably a more HA-solution than reading CSV files.

Only thing thats a bit weird is that, although I have defined timeouts of several minutes for each sensor, HA prints this upon startup:

hass[8574]: 2021-03-25 10:03:21 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform command_line is taking over 10 seconds.

Not a big issue though.

OK cool

My limited understanding of HA is that on startup the sensors reach out to their endpoints.
Maybe your sensor endpoint is not ready at this initialisation stage.

Well, the sensors issue shell commands, namely ping as well as speedtest-cli (python package), where the latter takes around 20s to finish. So this is to be expected, that each update of the sensor takes some time, thats why I increased the timeout value from default.

It just seems like this parameter is ignored at least for the startup of HA.