MQTT Setup - did it change

Hello - I have been running OH2 for well over a year and everything has just been a breeze.
I decided to upgrade my system form a Rpi 3B to the 3B + , and while I am at it upgrade OH2 to the newest IMAGE.
I can not get the MQTT binding to work at all. Al the other times I did not have a single issue but this time I don’t know. I have gone through a lot of the threads but some are for an existing system that now has a bug of sorts.

So here is what my mqqt.conf looks like.

URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883


and for Items this is the format :
Switch relay1_1 “Bedroom 1 Light” (MH_Bed1, Lights) { mqtt="<[broker:domogik/out/relay/r1:state:MAP(],>[broker:domogik/in/relay/r1:command:ON:1],>[broker:domogik/in/relay/r1:command:OFF:0],>[broker:domogik/in/relay/r1:command:TOGGLE:2]" }

and a Solar Item
Number solarwatt “Solar Watts [%.2f w]” { mqtt="<[victron:N/f46eiab8a1e88/solarcharger/256/Yield/Power:state:JSONPATH($.value)]" }

This setup is running perfectly under my “Current” system but if I run the new Openhabian Image and install the MQTT binding it does not receive any of the info. Did the format of the settings change? Am I missing something?

Best regards

See the blog, second entry.

yes it did change.

Did you just upgrade or are you doing a new install?

I did an upgrade and my old MQTT way of working still works.
I did not change any scripts.

(I will upgrade when I have time)

Did you just upgrade or are you doing a new install? - I am starting with a new install so that I have a new fresh system.
Ok some questions, forgive me if I am missing some stuff here -

  • As 99% of my system runs off MQTT , of witch most of them was from custom design thus generic, will I need to capture every device on its own or will I be able to do it via text?
  • I noted the example of the mqtt.thing file. Will I be able to create a file as per example and OH2 will be able to detect the item as per usual? I assume that I will need to place the file in the /etc/openhab2/things folder?

Don’t quite know what you mean by capture?
Only mqtt device following the homie convention and HASS can be detected and added as things automatically by the paperUI.

Yes or the paperUI both work

Both correct

Thank you for the response! I started from scratch - as the main system is still running so I can learn the new format.
I managed to add the new MQTT connection with the new switch added. I also managed to add the switch to a new sitemap. So atleast I have managed to get that part to work. :smile:

More questions :

  • Where are the files located that is created by the paper UI and can I edit them directly or should it be moved to the default OH2 folders.
  • How can I apply a transformation to a switch state, the switch that uses reports the state in reverse so 1 = off and 0 = on. Previously I would add it the MQTT item but I can find the way to do it via the Paper UI.

See binding documentation. All mentioned options are available in Paper UI.

At the bottom of the switch thing setup after clicking SHOW MORE

Put 1 for OFF and 0 for ON
It’s a bit like the MAP transformation but more efficient

I have a similar issue here.
I receive mqtt data {device: {status: { set: 1}}} (which i am not able to change)

I have added JSONPATH:$.device.status.set
For the On/Open value I have added 1

Switch ErIsPost "Er is post" {mqtt="<[mqtt:topic:MQTTgeneric:postSchakelaar]"}

if I don’t add the 1 in the channel setting i get an error

2019-11-09 09:35:45.680 [WARN ] [eneric.internal.generic.ChannelState] - Command '1' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.1

with a 1 in it there are no errors but the switch didn’t change.

Can someone help me out.

Many thanks in advance

Was it already ON? And that’s why it didn’t change
You didn’t put a Off/Closed Value

It doesn’t matter if the switch is OFF or ON and it receives 1 nothing happens .
I am not using the Off value. The Switch Item is only visible if there is mail in my house-mailbox. With the switch I reset that the mailbox is empty and the switch disappear

Turn off the Is Command option

I have turned off the Is command switch no difference
There is also nothing in the log receiving the MQTT message

What is the topic?
You did not show the topic part in your screen shot

The topic on the device is openHAB/brievenbus

But on the channel it is different

Your channel set up looks correct
What is you item definition, please?

Can you show me this screen? Or your equivalent

my item definition is at my first post

and this is my item in the item file

Switch ErIsPost “Er is post” {mqtt="<[mqtt:topic:MQTTgeneric:postSchakelaar]"}

It is working I forgot Linked Items. Thanks a lot your picture helpt me out

That should do it:

Switch ErIsPost “Er is post” { channel="mqtt:topic:MQTTgeneric:postSchakelaar" }

This was all in the docs by the way:

Remove the link in paperUI
And do it with the item file as in the post just above. It is easier to maintain

Just adding Linked item that made it work
When i remove it in the paperUI it is not working