OpenHab2 mqtt rr4j arduino

Hi,
I’m trying to send temperature for arduito to openhab2 with mqtt, but openHab2 doesn’t refresh item value.
Arduino works correctly (proved with MQTTfx). The Arduino code:

    float temp;
    char buffer[10];
    temp = sensors.getTempC(insideThermometer);
    dtostrf(temp,0, 2, buffer);
    psClient.publish("casa/insideTemp", buffer);
    temp = sensors.getTempC(outsideThermometer);
    dtostrf(temp,0, 2, buffer);
    psClient.publish("casa/outsideTemp", buffer);

in openHab2, demo.items:

Group gMqtt
Number inTemp     "Inside Temp [%.1f °C]" <temperature> (gMqtt) {mqtt="<[broker:casa/insideTemp:state:default]"}
Number outTemp "Outside Temp" <temperature> (gMqtt) {mqtt="<[broker:casa/outsideTemp:state:default]"}

in openHab2, demo.sitemap

    Frame label="Persistece Test temps" {
        Text item=inTemp
        Text item=outTemp
    }

and rr4j.persist

Strategies {
    everyMinute : "0 * * * * ?"
    everyHour     : "0 0 * * * ?"
    everyDay    : "0 0 0 * * ?"
    default = everyChange
}
Items {
    // persist everything when the value is updated, just a default, and restore them from database on startup
    * : strategy = everyChange, restoreOnStartup

    inTemp : strategy = everyMinute
    outTemp : strategy = everyMinute
}

In HABmin, sitemaps, Inside Temp is allways “NULL”. No change

Any Idea?
Thanks

Have you got MQTT binding installed? If yes, what does your MQTT.cfq file look like?

Yes, it’s installed.
The config file:

borker.url=tcp://localhost:1883
broker.clientId=openhab2

I thinkg openhab2 connect with mqtt, but it doesn’t suscribe the items. It’s possible to check that?

Thanks

So what software are you running as an MQTT broker? In your code the Arduino is publishing to a broker and Openhab2 should subscribe to get data. I use mosquitto running on my RPI as the broker and various Arduino’s publish to the mosquitto broker (and also subscribe for data openhab2 to Arduino) and Openhab2 subscribes to Arduino (and publishes data to send to Arduino).

See http://www.homeautomationforgeeks.com/mosquitto.shtml

The use of the function ‘dtostrf’ has caused problems for another user. It sometimes formats the string in a way that Openhab ignores.

Try the following first:

psClient.publish("casa/outsideTemp", "23");

If that works then it is probably ‘dtostrf’. See here for the other thread and a solution.

For you it would be:

psClient.publish("casa/outsideTemp", String(temp).c_str());

Thanks.
Mosquitto seems to work ok. I’ve suscribed casa/insideTemp with MQTTfx and data is arriving correcty.
I think the problem that openHab2 doesn’t suscribe the items (I don’t see any suscription message in the log option the MQTTfx cliente sw).

Solved. I’ve installed mqtt persistence but not mqtt binding.
Basic error form a beginner. Sorry.
It works now.
Fernando