I have a question which might be better asked in an InfluxDB or Grafana forum but I don’t have an account for either of those forums so I though I would ask it here since all of the data originates from the IotaWatt database. I have a 300 amp service at my house which was divided into 2 panels; a 200amp and a 100amp. I couldn’t monitor the 300amp service itself so I’ve got 2 clamps on each panel and I just add the 2 together to get totals for my IotaWatt graphs. I set up my InfluxDB uploader as shown below in order to monitor the load on both panels. I added the Amps-Tot measurement a week or so ago so I could show the the total amps from both panels in a Grafana panel. So, here’s my question(s).

Is there a way in Grafana to add 2 fields together so I don’t need an Amps-Tot field in InfluxDB and can use Amps-P1 + Amps-P2 instead? Or,

Is there a way in InfluxDB to add Amps-P1 + Amps-P2 into a new record with the same time stamp as the two Amps records I’m adding so I’ve got a history of my Amps-Tot in InfluxDB? I’ve included a partial InfluxDB data dump showing the time that I added the Amps-Tot value. So, if option 1 is not possible, I’m looking for a way to add 31.398 + 4.034 and put that value in a new record like:

philrob - I saw both of the references you made while trying to figure out how to make this work. I’m not an SQL expert so I didn’t really get the gist of what they were talking about. Anyway, I was successful in creating a query to sum the values I’m looking for but have not yet figured out the INTO function. The query I wrote to give me the correct Amps-Tot values is:

select sum(Amps) from iotawatt where time < ‘2022-01-31T23:56:20Z’ group by time(10s) limit 20

The “where time” clause it irrelevant in this case with the limit clause. I put it in there because that’s the time I first added the Amps-Tot values in the IotaWatt configuration. I’ll probably end up stopping the updater, backing up the database and mess around with the INTO function to see what happens.

I’m more used to SQL, I thing influxql is being replaced with flux in more recent versions of influxdb.

There doesn’t seem to be an easy way in influx. Looking at the influx forums there is an example of combining two measurements but I can’t see how to inset the summed measurement.

It might be that you need to write a python script to get time stamp, reading1, reading2, sum them and then write out the new data with time stamp.

I suspect that posting on the influx forums would be your best bet now.

I haven’t had time to mess with the INTO function yet to see exactly what that does. I’ll probably try that before I post to the Influx forum. Worst case is I just let it go with what I have. It would be nice to figure this out though, just in case there is ever a need to add something else that I would like see its history in Grafana. Thanks for your input.