[SOLVED] MQTT: How to filter implausible values on channel?

Thank you very much, that did the trick!
So my new JS transformation function “filter_ltminus100_gt100.js” which filters all values above 100 degrees and below -100 degrees now looks like this:

(function(i) {
	var val = parseFloat(i);
	if (val >= 100 || val <= -100 )
		{ return 'UNDEF'; }
	else
		{ return val; }
})(input)

and the channel definition in the .things file like this:

Type number :   TE_MJHTV1_5C8E  "TE_MJHTV1_5C8E "        [ stateTopic="OHAB/TE_MJHTV1_5C8E", transformationPattern="JS:filter_ltminus100_gt100.js" ]

Again thank you very much @rlkoshak , that solves my problem!

5 Likes