MQTT - sending values to topics does not work

hi, I want to send values to an mqtt broker.
I defined an things, added channels and linked them to items, all using paperui.
The only thing that works is the display of a status end settings topic. but for the values to be send to topics, I do not have any input fields.
What i basically want to do is send a string, for example 2345, and this being a value which is read by an esp32 subscribing to the topic.
When i try to use a dimmer, or switch, the corresponding icon is shown, but when i just want to enter a number/string, i do have an input field ?
Anybody can help?
attached a screen copy of the config and the classicui (basicui is same, but i does not allow to show the complete text for the status and settings topics

thanks for every possible help

What broker are you using and have you looked at the mqtt action binding?

Nothing to do with MQTT. No, there are no general purpose “free text entry box” widgets in the sitemap based UIs.
You can enter numerics with a Setpoint widget, or choose from predefined strings with a Selection widget, or a Switch widget with mappings.

Sending a MQTT message is possible using a rule like:

val actionsBroker = getActions("mqtt",YourMQTTBroker) actionsBroker.publishMQTT( YourTopic, YourContent)

Thanks for the advice, but the problem is that i cannot enter the data.This is sending the YourContent, but I do not see where to enter it

There is no option Setpoint in the Type list

The rule could take the state of an item for example a SetPoint.

hi i user a mosquitto broker on my synology nas

??
A Setpoint is a widget that you specify on your sitemap, so that it offers a up/down “number setting gadget” in your UI
You would usually use it to set a Number type Item.

https://www.openhab.org/docs/configuration/sitemaps.html#element-type-setpoint

As already stated, there is no free text input field on sitemaps. You can only enter discrete and predefined values. This can be done using:

  • Setpoint: allows you to adjust a Number Item in predefined steps
  • Slider: allows you to adjust a Number using a slider
  • Selection: provides a list of Strings to select from
  • Switch with Mappings: Provides one or more buttons that send predefined values to a Switch, Number of String Item

If you have a limited number of values you want to send than one of the above should meet your needs. If you need to enter arbitrary text there is no way to support that using basic sitemap elements.

It is also possible to send a value from the console, but this might not be what you want ?

ssh openhab@myopenhab -p 8101
> smarthome:send myitem 'my text'

sorry for the delay, and thank you for your answers.
my problem is that I am confused with either using files to define things, and then to use the builder to define them.
I never know what has to be done where. I have very little experience with OpenHab so far.
Again, my objective is to send strings to a microcontroller using mqtt. The strings represent mainly digits, like time in the format 1210 for 10 past 12, or 1815 for quarter past 6 pm, or 20 for duration of 20 minutes, or 3450 which is another value.
so basically the strings represent numeric values, so a slider could be the best solution.
This slider than has to be available on the user interface and when I change it, the information should be send to a topic. I defined the topics, but the data input part is missing.
It would be nice to have a step by step tutorial, but I have not found one so far

Most recommend using PaperUI for creating the Thing and use files for your items. The important thing is to only create the Thing in one place, either via PaperUI or files, not both. The same goes for items and links.

First make sure OH can send the info and the device receives it. After that you can create a rule with a proxy item and use the proxy item (slider added to sitemap??) to update the value that needs to be sent to the device.

In addition to what @H102 just posted, once you have managed to send the values via a rule you could have a look into HABPanel. This other UI for openHAB can be configured to have input fields. I’m using such for a text input, numerical should be possible as well or even a timepicker. But stick to the suggested steb-by-step and start with using a rule to send the values!

1 Like