I get sometimes values back from a Z-wave sensor what is incorrect. Mostly related to temperature (zero value). I want to avoid this but are struggling to solve this.
Please advice if the approach below is ‘totally’ wrong and if not how to fix the syntax errors. I never used transform before. Sorry for the stupid question.
I created a div.js file in the transform folder with the following
if (i + 1 >= y) return (y);
if (i - 1 <= y) return (y);
The idea is that I call this function with the current temperature and the previous correct temperate. If the new received temperature is > previous + 1 or less than previous -1 I return the previous correct temperature what means ignore the new received value.
I want to call this from a rule as below.
rule “Temperatuur controle”
Item Temperatuur_gBGWoonkamer changed
// get multiple errors on the next line but don’t know how to solve it. Tried multiple ways to solve it without success.
Temperatuur_gBGWoonkamer.state = transform=“JS(div.js)”, “tempValue1”, “Temperatuur_gBGWoonkamer.state”)
tempValue1 = Temperatuur_gBGWoonkamer.state as Number