How do I create my own item?

I need a SetPoint Item that does not have a numeric range. Instead of digits, it will offer defined words according to a table or file. Can it be done in Openhab?
Thank you
Jiri

Sounds like an Item of String type.

https://docs.openhab.org/configuration/items.html#type

What about selection https://docs.openhab.org/configuration/sitemaps.html#element-type-selection
You have to define in the sitemap and can select one option.

Sting isn’t for input.

I’m sorry, didn’t understand you were working on the UI side. If you’re still in the Sitemap world, I suggest you investigate HABPanel. Very flexible!

Please don’t mix up terms. :slight_smile:

Setpoint is a widget type. Setpoint is Number only.

But you could offer a String Item to a Selection Widget.

my.items:

String myString "My String [%s]"

my.sitemap

sitemap my label="My Sitemap" {
    Frame {
        Selection item=myString mappings=["String 1"="First option","String 2"="Second option","String 3"="Third option",Stringwithoutspaces="Fourth option"]
    }
}

As you can see, there is a pairing between real value and displayed option. As these are Strings, you will have to use quotation marks around the value on the left side if there are spaces within the string. the right side of the pair has always to be quoted.

If you don’t need the string itself as a value, you can also use a number item (even with setpoint widget) and use a myvalues.map with a mapping number = text, if using integer numbers, the setpoint widget can be used to switch between the values.

Thanks for the anwers. My problem is:
I have an Arduino and a code that contains enum {“OFF”, “ON”, “TIMER”, “STEP1”, “STEP2”, “STEP3”, “HEAT”, “COOL”
Each of these key words represents a value of 0,1,2,3,4,5,6 … 100
On the mobile phone display, I need to select the selected keyword by the same principle as the Set Point option. Instead of digits I want to display the texts from the enum.

And I would ask if I have a Set Point with a step of 0.1, so when I set up I will display correctly 1.1 1.2 … but then 1.9000001 and then 2.0.
In Sitemaps I have: Setpoint item = set1 label = “SET1 [% .1f ° C]” minValue = 0 maxValue = 20 step = 0.1