[SOLVED] Node Red configuration with mqtt 2.5

Hi, I use the following configuration :

Platform information:
Hardware: Raspberry Pi 3 B
OS: Habian
openHAB version: 2.5 SNAPSHOT

As I’m new (but already spent a lot of time trying to understand), I decided to go with latest version. Mqqt broker + generic mqqt thing with item link to channel.

I can see and change item value (Number) thru HABPanel or Mqqt Action.

image

image

In Node Red, I try to configure Mqqt node to be able to communicate and change value, is working inside Node Red but is not changing anything into Openhab, I’m pretty sure something wrong with ClientID or Topic definition.

image

I tried to use Mqqt.fx to understand better, but I’m not sure of what ClientID need to be enter.

After few days beeing stuck on this, any help will be apreciate.
Many thanks
Pef

I don’t know NodeRed, but I do know that each client must have a unique clientid. But as long as they are unique, they can be anything.

Is your broker thing showing as connected?

Thank you Rich, you are right ClientID was not defined into Node Red now this done, but still not changing value.

And yes both Broker and generic are showing online

image
image

image

Is there any documentation specific to this or may be a full and detail exemple from soneone ?

Many thanks
Pef

What is the correct clienID in openhab2 with generic thing ?

MyBroker or MyBroker/MyMqtt or something else ?

The client is not relevant for openHAB. Only for the broker. openHAB only revceives topic changes.

The publishing topic in node-red is:
myMqtt/Cuisine/Capteur

And your subcribing topic in openHAB is state

See the difference?

Great thanks both of you, I’m sure It might seems stupid mistake for you, but I’ve been stuck on this for the last 4 days looking and trying differents configurations…

Do you think it will be usefull for others if I put screenshots of working configuration ?

Many thanks
Pef

Of course, go ahead, anything that will help someone else is welcome

My mistake here was mainly due to I was thinking I had to define full path into topic Node red configuration, but in fact you only have to put what you define into you channel configuration

MQTT state topic & MQTT command topic (ie “State” is only for testing, I guess when you have multiple channels you need to be more organized and specific) in my case both has to be identical (I tried for instance State and Set but could not make it work in Node Red)

Mqtt Input config

image

Mqtt Output config

image

Other misstake I made earlier was inject number instead of string

image

So now I can change and receive value of my number from HapPanel <-> Node Red thru Mqtt

Cheers,
Pef

3 Likes