[solved] Item not updating correctly

Hello everyone,

this is my first post here and I’d like to thank openhab creators and contributors on such a great concept and execution!

I’m starting to test OH. here is my initial test setup:

OH + mosquitto installed on a cubieboard+debian
and arduino yún using the mosquitto library as a client to post a temperature reading to the mosquitto broker

temperature is sent to the broker every 5 seconds.

if I SSH to the cubieboard and subscribe to the topic in the broker I can see every message is being received from the arduino.

on the OH sitemap I have a temperature which shows the following item:

Number Temp_1 “Temp_1 [%d]” {mqtt="<[mosquitto:home/temperature1:state:default]"}

When looking at the OH UI using a browser (tried Chrome and IE) I can see the item with the temperature value only refreshing randomly, sometimes the value disappears, sometimes it updates faster, but I loose most of the readings.

This also happens with OH client for android. same behaviour.

Is there anything I might be doing wrong?

thanks in advance,
òscar.

Is the MQTT message on the topic home/temperature1 always being published as a properly formatted number, with no whitespace on either side, a “.” to separate the decimal bit if any, no thousands separator character? If the number parses correctly from the message, it ought to update the item. If it doesn’t parse properly as a number, the currently released binding will send a StringType update to the NumberItem, which will not be accepted. The MQTT binding in 1.8 will also fail without a properly formatted number, but internally it has a different code path.

hello watou,

thanks for the fast response.

I checked the formatting and it has no decimals nor whitespaces…

I made a simple test without the arduino: I SSH from my laptop to the OH server and subscribed to the mosquitto browser. I opened another SSH session to the server and started publishing data to the item’s topic.

on another window I could see when the item updated.

please see the screenshot attached… I highlighted the values that got updated on the OH interface… i did the test with lots of values and none got the same pattern for refreshing… it seems random.

items file:
Number Temp_1 “Temp_1 [%d]” {mqtt="<[mosquitto:home/temperature1:state:default]"}

sitemap:
sitemap casa label=“Casa”
{
Frame label=“Temperatures”
{
Text item=Temp_1
}
}

greetings,
òscar.

I don’t see anything wrong with your configuration. I’ve not seen missed messages before. If there is nothing MQTT-related in your openhab.log, turn on DEBUG logging for the MQTT binding (similar to described here for another binding). If that still doesn’t show anything suspicious, please paste your MQTT binding config lines from openhab.cfg.

I found what was the problem.

as you suggested, I started in debug mode and saw that every 10 seconds the model kept refreshing. this made system to be non responsive while refreshing.

the problem wasn’t with mosquitto. I found this post which led me to the solution. the server had a wrong date (2010) and this made models refresh every 10 seconds infinately, since every file (items, sitemaps…) was always edited in the “future”.
the openhab.cfg file:
folder:items=10,items
folder:sitemaps=10,sitemap
folder:rules=10,rules
folder:scripts=10,script
folder:persistence=10,persist

when changing the server datetime everything started working fine.

thanks again for your help!

best regards,
òscar.