Item value not updating if value stays the same

I’ve got 10 temperatures sensors around the house, Arduino based with DS18B20 temperature sensors. Evey 5 mins I’m sending the temperature to OH2 using mqtt.

I’ve found a problem in that if the temperature value doesn’t change, the Arduino sends the value to OH2 but OH2 does not log it. At least I"m not seeing anything in the events.log

This value has not changed for 20 mins:

2017-10-15 10:11:06.815 [ItemStateChangedEvent ] - LoungeTemp changed from 22.13 to 22.00

Two problems I have with this.

  1. I have expiry timers set so get alerts when temperatures have not updated in 15 mins
  2. Have started to graph this with grafana and finding gaps in the graphs. So only value changes are graphed.

I’m fairly sure this is a setting on OH2 but have no idea where to change this. I can see from network dumps the value is being sent to OH2

Is this a items config or a mqtt config issue.

lounge.items

Number LoungeTemp "Lounge [%.1f °C][" <temperature>  {mqtt="<[mosquitto:lounge/temperature:state:default]"}

mqtt.cfg

mosquitto.url=tcp://localhost:1883
mosquitto.clientId=openhab
mosquitto.retain=true
mosquitto.async=false

I think this is a choice made in the binding, some bindings have updateunchangeditems or similar options - since you can’t please everyone and some would object to the spam. I do not know mqtt.

I would expect this to work. First, are you certain that the same are indeed sending every five minutes?

I send mqtt messages more frequently than five minutes but I guess they are always sending a different state.

You can try using command instead of state. Even if the binding is filtering out same states, it would be incorrect for it to filter out same commands.

I’ve done some more testing on this. Setup a bash script to send the same value every 5 mins and it does not get logged. As The previous poster said I think this is a feature.

I also found another post where someone had the same query and turned out to be OH not logging the same value.

My expiry script had a error in so its now working. So even though the events.log is not updating if the value stays the system is receiving value. My timers don’t expire so assume that it is.

I think this is then more a query with grafana. Still learning how to configure this as I"m seeing gaps in my graph. I thought it was my sensors not sending the data every 5 mins but turns out not.

Update:
Thanks for the tip on command. I’ve changed the state to command and its now logging the unchanged value evey 5 mins to the events.log.

In grafana you can set up a fill in the data field selection page. I find linear, last value and zero to be the most useful, depending on what the data represents.

You can also set up your persistence to save the state every five minutes in addition to on every change or update to fill in some of those gaps. However, this can give you erroneous results if you are using calls like sumSince in your rules.