Compare Meter Reading with InfluxDB Function

Hi,

I have a big problem. I am a newbie and would like to compare the total meter reading from the influxdb with the electricity meter. If the value of the electricity meter is 0 (because of a power failure, for example), all newly collected values ​​of the electricity meter should be added to the value from the InfluxDB.

Thanks in advance

Which bits of that do you not know how to do?

All :grinning:

I create a Node for Query for Read the "Total" Energy Consumption from the InfluxDB

Query Node is this:

msg.query='SELECT wh_total FROM "xx" ORDER BY time DESC LIMIT 1'
return msg;

Ok now i have the Query as an Array out of the Database.

Now i have to compare current Data from Shelly with InfluxDB Data

something like:

if (wh_total == 0)
{
Add Data from Influxdb and add actually wh_total data on top of this
}else
its ok do nothing
}

In order to do what you ask it is necessary to get the data from the query and that from the meter into one message. See this article in the cookbook for an example of how to join messages into one object.

However, there may be a better way of solving the problem. Can I ask a question? Why do you need to know the total consumption (since some arbitrary time in past, presumably)? Is it in fact the case that you don't need to know the absolute running total, but what you want to know is how much has been used today, or last year, or similar?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.