Hi out there,
after having used influxdb and grafana for some time with ready-to-use data sources, I am now struggling with a python script to write my self-retrieved data to a bucket. Of course, it would be possible to use one of the existing solutions, but for some reasons I wanted to take the challenge to write it by myself.
The data come in from a pv-inverter (Huawei SUN2000). I wrote my own script to extract the register values. Despite some obstacles my script is doing fairly well. The TCP/IP interface of the SUN2000 is rather sensitive, and from time to time I get timeout or other errors. Therefore I am gathering the desired values in a kind of repeating try/except loop, and it is possible that it takes some 20-30 seconds until all the data are read.
I have a structure in mind of the way I want the data to be stored, for example:
SUN2000 - pv - string1 - module1 values
. .
. .
- module n .
- string2 [same as string1] .
- grid - power .
- energy ... .
- battery - soc ... .
<btw: I have no idea, why some of this text appears in italic!? That’s was not intended!>
As far as now, I managed to write some points and I tried to write a dictionary, but I was not able to create the desired structure. It seems that my understanding of measurement / tag / field is inadequate.
So the questions are:
- is it generally possible to have a different number of tags e.g. for pv values more than for grid values?
- as the data come in sequentially, would it be better to write them in one statement so that they have the same timestamp?
- what would be more adequate: write point / line / dict?
Thank you so far.
Emilio