I get a CSV file from my home’s weather station on ten-minute intervals with records having the local date-time, and a series of weather metrics as of that time. I want these data in sensors. Loading the data is not the issue, the time-stamp is the issue.
How do I load a data value with its time-stamp into a sensor from a CSV or a JSON file so HA knows that value A was created at time D?
I see the File Sensor, but its examples omit date-times from the feed. I can turn the CSV into JSON if needed.
Thx
what do you mean ‘with it’s timestamp’? Are you saying that the filename has a timestamp on it or the data itself is paired inside the file with a timestamp?
Each record has local date-time, and a series of comma separated metrics as of that date time. I want to import the various metrics into HA with HA knowing that each value is as of the record’s date-time. It appears that if use a File sensor that the values are time-stamped as of when imported. I need to import:
{{date-time}}, {{value}} and have HA know that value is as-of date-time.
Here’s the CSV version (date, time, temp, humidity, etc):
3/29/2019,7:30 PM,71.00,51.50,0,73,51.00,51.00,43.00,30.24,45.0,0.00,1.24,0.58,0.00
I’m happy to reformat, but every 10 minutes another record is posted
This will be any value you want to peel out, just change the number 2 to any other index. 2 in the example you provided is the first number after 7:30pm, 71.00.
This is the only way to get the date into home assistant. As @nickrout said, it will not be usable inside your history or show up in your logs at that time.
Thank you both - wow, code and all on the fly. HA, and you guys, rock. Looks like I need to have some near realtime processing to get my metrics loaded near to their time-stamps.
ciao, ho visto questo post e fa proprio al caso mio, infatti io devo leggere dei dati presenti in un file in formato .csv solo che il file invece che in locale ce l’ho dentro un server web tipo: https://raw.githubusercontent.com/andamento.cvs
come faccio a connettermi a questo file ?