Next value in msg max 1 higher than last

Hi at first,
iam running an MQTT-Server where NodeRed fetches data. I want to filter a spicific msg that this stored value is maximum 1 higher than the last sended value.
Iam completely new to NodeRed so please be gently with me.

With bets wishes

Hi,
Welcome to the forum

Have a look at the filter node, this is capable of what you want.

Ive the problem that the first correct value is 5 points lower than the false, this my problem.
I dont want to change the filter every 2 day^^

Atm i dont know how to do this with the filter-node?!?

To get clear information iam reading out an electricity meter.

I get 2 values that nearly the same but only one of these 2 values is the actually Total-Consumed.

It is not clear what you are asking.
Show us real examples of the data that is coming and tell uswhat you want to get out.

There 2 values:

Val1: 8257 and Val2: 8254

Val 2 is the needed value, but this value will change because its my Total consumed Energy. Whats the second val i dont know.

Atm this is what my Node looks like. With first filter in total-line iam clearing some outputs from my electricity meter thats 100% incorrect because the tasmota-software isnt fully compatible with my meter^^

Do those arrive in successive messages or are they both in one message? If separate messages how are the good messages to be distinguished from the bad?

Feed the output of the zaehler node into a debug node and show us exactly what you get and tell us exactly what you want to get out.

They both comming in the exact same varibel: Total_in

This is my problem, with the first filter-node iam preventing that there values under 8000 and values over 12000 will be saved to the database. My electricity meter had multiple readings in 4 different display-modes.
But i need only 2 readings atm, and ive no idea how to filter out the higher value thats incorrect.

And at 6 AM i had a reading thats 30 kw/h higher than my actual total-consumption.

Is there a way to store the last correct value and add an defined value, and filter with this new value the readings?

I know theres a calculater-node and its in my palette, but how can i use this value for a filter?

I can only repeat my previous request, as you have not responded to it.

Look at the Ppicture in my last post. This is my filtered Output of ,,Total_in" that comes from my MQTT-Server. Iam only filtering out values that are to low (1000) or massive to high (1.000.000+).

The values are all in the same variabel that is ,,Total_in"!

What iam exactly looking for is to filter out the incoming value dynamicly. E.g:

Correct value is 8257.4 and the filter only let values pass thru that are 0.5 higher than this value.
Next time the value has changed due consumption now the correct value is 8257.6 and the filter should only pass thru values that are max 5258.1

I'll hope thats exact enought for what iam looking.

Why won't you show us what is coming out of the zaehler node?

Its all my Data belong to my Electricity-Meter, iam not so happy to share this. But why you need this Data?

The question is only to add 0.5 to the last correct value and than to filter with the next value. And this in an cycle that ive never had to adjust it manually.

If you can get me an good reason why i should share all my Data from my Electricity-Meter than i can send it to you via PM maybe. But in an Discussionboard ill never post Data like this.

Do you mean that you want to block unless the value is greater than the previous value passed on and is less then 0.5 greater than it?

Incoming value is 8247.3, this is correct. Than a node add 0.5 to this value and the value 8247.8 will be stored.
Next incoming value will be 8356.3, this is incorrect and will be blocked.
3 incoming value is 8247.6, this value is the correct value and can pass throught to my Database.
To the third value will be added 0.5 again and this will be used next time to filter.

Hope its easy to understand^^

How to add 0.5 iam knowing but how to compare 2 values iam not knowing atm.

A filter node set like this will do that

image

And that node will store tha value until the next correct value will pass throught?

That is what 'compared to last valid output value' means. It compares each incoming value with the value it last sent (which is the last "correct" value in your words) and blocks the message if it is greater than 0.5 difference from it.

How do you know what to use as the first correct value on startup?

Ok but i had to set last input, with last output it changes the value to the value that is incoming^^
I'll set this with an inject-node^^

That should not be correct. With it set to last input, if the current good value is 10 and then you get 20 followed by 20.1 it will pass on 20.1 (because it is less than 0.5 away from the last input, which was 20). I thought that after a good value of 10 you wanted that it would not let anything through until it got a value between 10 and 10.5.

[Edit] Reworded the last sentence to be clearer.

If it did not work for you with it at last output please supply a sequence of inputs that gives the wrong outputs.

Something isnt working correct.

These my Settings in the filter-node:
Unbenannt

And this is my complete Node with Debug:

I dont know why the 8262.9 value passes throught the database