I have an Arduino board connected by MQTT to my OpenHAB 1.8 installation.
The Arduino board receives some sensor data like the temperature of a 433MHz temperatur sender.
All is working well, but now one of my 433MHz sensors stopped working so the arduino didnt’ receive any new temperature from the sensor. Because the item didn’t change the state, the OpenHAB item keeps the last temperature showing which is not correct.
For that case I want to sent “Uninitialized” from Arduino to OpenHAB for a sensor which has not get an update for the last e.g. 10 Minutes. In OpenHAB I want to see “-” as temperature, like the value was not initialized.
I tried to send the value “Uninitialized” as state to the OpenHAB item, but I get the error
"[WARN ] [.c.i.events.EventPublisherImpl] - given new state is NULL, couldn't post update for 'ARDUINO_01_03_TEMP'"
The item is defines as
Number ARDUINO_01_03_TEMP "03 Temp [%.1f °C]" {mqtt="<[phc:/phc/FromArduino/BOARD/01/SENSOR/03/01/TEMP:state:REGEX((.*))]"}
For testing I have sent the MQTT message with
mosquitto_pub" -h rpi2 -t /phc/FromArduino/BOARD/01/SENSOR/03/01/TEMP -m Uninitialized
or
mosquitto_pub" -h rpi2 -t /phc/FromArduino/BOARD/01/SENSOR/03/01/TEMP -m -
How is it possible to set the state/value of an OpenHAB item to “Uninitialized” with MQTT?
Thanks Andreas