OH3 MQTT Command Topic Please Help

I have OH3 up and running. I’ve added all my things and they are publishing their state changes.

I’m trying to configure a MQTT command in OH3 using the GUI but I can’t find any examples for this.
The Thing I’m attempting to control is a ESP12e with a relay attached to it running ESPEasy.
I can successfully control the relay using MQTT.fx commands but I’m not sure if I have it correct in OH?
Here is a successful command from MQTT.fx

Here is my best guess at the formatting in OH3 GUI configuration.

I’m not able to confirm if it works from OH because I’m attempting to follow the Getting Started tutorial to migrate away from my OH2 setup and I don’t have any pages configured yet since I’m still on the Adding Things section. My OH2 setup was using HTTP commands and I wanted to see if MQTT was a better option.
Can someone tell me if my command looks correct?

Nearly correct.

Remove the

Pulse,5,1,500

from the command topic, and instead put it further down the page (you may need to tick the Show Advanced button) into the custom on/off fields.

Also remove the subsequent trailing colon from the command topic.

Hi @hafniumzinc thanks for the fast reply. I read your reply several times and it wasn’t until I submitted my response that I noticed you said to put the Pulse,5,1,500 in the Custom On/Off Value so please disregard my previous message.
Here is what I’ve actually done.

Does that look correct or do I need the MQTT payload in both the Custom On and Custom Off?

Possibly - you’ll have to experiment with the quote marks I guess.

You also don’t need the Is Command turned on - that’s only for received data.

Have you tried this setup?

1 Like

I haven’t verified through OH that it works because I’m just getting started with OH3 and I’m trying to set my system up from scratch. I’m following along with the Getting Started Tutorial and it showed adding things first then working on the Model then start adding Items and then Pages.

Does it matter if I don’t have all my things and channels configured before I start working on my Model?

No, it doesn’t matter. In fact, I would recommend just setting up a single Thing and then add that into your Model so that you can go through all the steps in one go. The way you’re doing it there could be a tonne of mistakes in your Thing configurations which you might not find out until much later.

1 Like

Hi @hafniumzinc

It works thanks so much, now I feel like I’m getting somewhere. It has left me with another question.
In OH2 I had this device configured as a momentary push button so in OH pages it just had a button that said GO. Not a toggle like a light switch.image
Here is my OH2 sitemap config if I remember correctly it has something to do with the mappings.

 Switch item=Garage_Door mappings=[ON="GO!"]

Is that something that will be fixed when I start setting up my pages?

After some additional testing I’ve noticed something strange in the logs that I believe to be connected to this problem.
Since this should be a momentary switch and does the same command every time you push it. It shouldn’t have a on/off state. And I know in OH2 I had to disable the prediction but I’m not sure how that is done in OH3.

Not entirely clear what you want fixing. Guessing you want a “button” in the UI, it’s up to you to configure for that (like you did using mappings=) perhaps oh-button?

The feature is called “autoupdate” and you disable it in similar fashion,by adding a property to the Item

Correct in OH2 the item type was a Switch but on the basicui it was a button.
image

Here is my sitemap code.

 Frame label="Door Sensor State"{
          Switch item=Garage_Relay mappings=[ON="GO!"]
          Text item=ESP_B11D0D   //AKA Garage Door

I don’t remember customizing that to be a button but my setup has been evolving for years.
I looked at my transform files en.map, onoff.map weather_en.map and didn’t see anything that looked relevant.
Can you guide me to the default location for mappings in OH3. The documentation looks to be about Sitemaps but I was thinking sitemaps were no longer used in OH3.

Sitemaps still exist in OH3. You can use them as before from your configuration files.

1 Like

Almost self-evidently it was by this part that you included -

with a clue in the text shown on the button.

mappings= is the same in sitemaps for OH3 as it was for OH2.

There are no mappings= in MainUI because that doesn’t use sitemaps.

The approach to configuring MainUI is very different.
Example with lots of buttons -

this one is somewhat simpler -

I moved my home.sitemap file and all my OH2 Transform files but I’m still seeing a toggle switch in the UI.
Should that be a button like it was on the basic UI?

No,that is MainUI and it does not use your sitemaps.

You can use BasicUI as you did before.