[SOLVED] How to filter the faulty temperature values

  • Platform information:

    • Hardware: CPUArchitecture/RAM/storage RPI 2
    • OS: what OS is used and which version Openhabian (latest)
    • openHAB version: 2
  • Issue of the topic:
    Please let me know how I should not consider/filter the faulty temperature values (e.g -1332) that are displayed (sometimes) in my sitemap and also processed in different rules. I’m using 1wire protocol to receive the temperature values form 3 DS18B22 sensors. For the moment I just check in a rule if the temperature value is lower than 0 Celsius degrees. But the negative values are still displayed in sitemap/openhab Android App.
    It is possible to miss those negative values before any processing step (before rules ) ?
    Thank you,

  • Please post configurations (if applicable):

    • Items configuration related to the issue
Number temp_Centrala "Temp. Centrala [%.1f °C]" <temperature>  { channel="onewiregpio:sensor:mysensor1:temperature" }
Number temp_Pufer "Temp. Pufer [%.1f °C]" <temperature>  { channel="onewiregpio:sensor:mysensor2:temperature" }
Number temp_Exterior "Temp. Exterior [%.1f °C]" <temperature>  { channel="onewiregpio:sensor:mysensor3:temperature" }
  • Sitemap configuration related to the issue
sitemap home label="Home"
	Frame label="Temperaturi" {
		Text item=temp_Centrala label="Temperatura Centrala" valuecolor=[>=60="red",<=60="blue"]
		Text item=temp_Pufer label="Temperatura Pufer" valuecolor=[>=40="red",<=40="blue"]
        Text item=temp_Exterior label="Temperatura Exterior" valuecolor=[>=10="red",<=10="blue"]
  • Rules code related to the issue

rule “Cand se modifica temperatura Centralei”
Item temp_Centrala changed
var Number v_prag_Centrala = prag_Centrala.state as DecimalType
var Number v_temp_Centrala = temp_Centrala.state as DecimalType
var Number v_prag_O_Centrala = prag_O_Centrala.state as DecimalType
var Number v_prag_P_Centrala = prag_P_Centrala.state as DecimalType
v_prag_O_Centrala= v_prag_Centrala - v_prag_O_Centrala
v_prag_P_Centrala= v_prag_Centrala + v_prag_P_Centrala
if((v_temp_Centrala <= v_prag_Centrala) && v_temp_Centrala > 0 && flag_c.state == 0) // prin " v_temp_Centrala > 0" se evita valorile eronate
sendBroadcastNotification("Temperatura Centralei a scazut sub pragul de: "+v_prag_Centrala);
Relay.sendCommand(ON); // Pentru ca este NORMAL CLOSE
Stare_Centrala.postUpdate(“OFF”); // se va opri centrala respectiv ventilatorul care ajuta arderea lemnelor.

                             if((v_temp_Centrala >= v_prag_Centrala +5) && flag_c.state == 1) { 
                            														trimite_n_centrala.postUpdate("Nu trimite_t");


  • Services configuration related to the issue
  • If logs where generated please post these here using code fences:


You will need to use proxy items:

Number temp_Centrala "Temp. Centrala [%.1f °C]" <temperature>  { channel="onewiregpio:sensor:mysensor1:temperature" }
Number temp_Centrala_Proxy "Temp. Centrala [%.1f °C]" <temperature>


rule "filter temp"
    Item temp_Centrala changed
    if ((temp_Centrala.state as Number) < -100) return; // Do nothing
    temp_Centrala_Proxy.postUpdate(temp_Centrala.state as Number)

Thanks a lot !!!