Rule if error

What goes on in the sitemap does not affect the contents of the Item.

What you put in the formatter [ ] in the real Item definition can sometimes affect the Item state.
If it’s a UoM Item, Number:xxxx, it will use whatever is found in [ ] and looks appropriate as the default unit for this Item.
Otherwise there are system defaults, or bindings can override those.
So there are always units.

Can I set up an item so that it does not have a dimension, but need to be displayed in basicui with a need for an icon and dimension?

All this in order to work with items without dimension, but to display for the user with dimension (%, ppm, mmHg, etc.)

That would be a Number type.
Binding channels may need to be linked to dimensioned Items, and may not work with plain Number.

It is impossible to deduce dimension in sitemap for the item.
It was not possible to compare the state of the item as a number, the rules for the comparison of the state of the item and the number do not work in the rules.

Settings:
/var/lib/openhab2/jsondb/org.eclipse.smarthome.core.items.Item.json

  "Temperature_8302000000000000": {
    "class": "org.eclipse.smarthome.core.items.ManagedItemProvider$PersistedItem",
    "value": {
      "groupNames": [
        "gHome"
      ],
      "itemType": "Number:Dimensionless",
      "tags": [],
      "label": "Bedroom",
      "category": "temperature"
    }
  },

/etc/openhab2/sitemaps/my.sitemap

sitemap my label="My home automation" {

    // Спальня
    Frame label="Спальня сенсоры" {
       // Text   item=Temperature_8302000000000000 label="Bedroom [%.1f °C]" valuecolor=[Mobile1_LastUpdate=="Uninitialized"="gray",>=25="orange", >=15="green", 0="white", <15="blue"]
       // Text   item=Temperature_8302000000000000 valuecolor=[Mobile1_LastUpdate=="Uninitialized"="gray",>=25="orange", >=15="green", 0="white", <15="blue"]
          Text   item=Temperature_8302000000000000 label="Bedroom1 [%s °C]"
        Text   item=Humidity_8302000000000000 valuecolor=[Mobile1_LastUpdate=="Uninitialized"="gray",>=25="orange", >=15="green", 0="white", <15="blue"]
        Text   item=PPM_8502000000000000 valuecolor=[Mobile4_LastUpdate=="Uninitialized"="gray",>=25="orange", >=15="green", 0="white", <15="blue"]

                Text   item=Voltage_8502000000000000 labelcolor=[LowPower_8502000000000000==ON="red"] valuecolor=[LowPower_8502000000000000==OFF="green"]
                Text   item=Mobile4_LastUpdate valuecolor=[Mobile4_LastUpdate=="Uninitialized"="gray",>=25="orange", >=15="green", 0="white", <15="blue"]
                //Switch item=LowPower_8502000000000000

                Text   item=Voltage_8302000000000000  labelcolor=[LowPower_8302000000000000==ON="red"] valuecolor=[LowPower_8502000000000000==OFF="green"]
                Text   item=Mobile1_LastUpdate valuecolor=[Mobile1_LastUpdate=="Uninitialized"="gray",>=25="orange", >=15="green", 0="white", <15="blue"]
                //Switch item=LowPower_8302000000000000
    }
}

/etc/openhab2/rules/my.rules

rule "Records when device mobile1 was last seen"
when
  Item Temperature_8302000000000000 received update or
  Item Humidity_8302000000000000 received update or
  Item Voltage_8302000000000000 received update
then
 logInfo("Records when device mobile1 was last seen", "Temperature_8302000000000000.state=" + Temperature_8302000000000000.state)
  postUpdate(Mobile1_LastUpdate, new DateTimeType())
 if (Temperature_8302000000000000.state < 40){
  logInfo("Records when device mobile1 was last seen", "Temperature_8302000000000000.state=" + Temperature_8302000000000000.state , " IF")
}
end

/var/log/openhab2/openhab.log

2019-07-05 10:42:53.583 [INFO ] [ds when device mobile1 was last seen] - BEGIN
2019-07-05 10:42:53.584 [INFO ] [ds when device mobile1 was last seen] - Temperature_8302000000000000.state=16.0
2019-07-05 10:42:53.585 [INFO ] [ds when device mobile1 was last seen] - END

From the log you can see that the comparison test does not work

if (Temperature_8302000000000000.state <40)

If you add a comparison with the dimension:

if (Temperature_8302000000000000.state <40 | ° C)

I get the error:

2019-07-05 10: 35: 48.644 [ERROR] [ntime.internal.engine.RuleEngineImpl] —Rule 'Records when the device mobile1 was last seen: Can not compare incompatible units

.

If the sitemap to use the transformation with the dimension, it stops working basicui

/etc/openhab2/sitemaps/my.sitemap

Text item=Temperature_8302000000000000 label="Bedroom [%.1f °C]" valuecolor=[Mobile1_LastUpdate=="Uninitialized"="gray",>=25="orange", >=15="green", 0="white", <15="blue"]

/var/log/openhab2/openhab.log

2019-07-05 10:43:54.246 [WARN ] [pse.smarthome.core.items.GenericItem] - failed notifying listener 'org.eclipse.smarthome.io.rest.sitemap.internal.PageChangeListener@507f0a6e' about state update of item Mobile1_LastUpdate: null
java.lang.NullPointerException: null
at org.eclipse.smarthome.ui.internal.items.ItemUIRegistryImpl.convertStateToWidgetUnit(ItemUIRegistryImpl.java:431) ~[?:?]
at org.eclipse.smarthome.ui.internal.items.ItemUIRegistryImpl.getLabel(ItemUIRegistryImpl.java:404) ~[?:?]
at org.eclipse.smarthome.io.rest.sitemap.internal.PageChangeListener.constructSitemapEvents(PageChangeListener.java:229) ~[?:?]
at org.eclipse.smarthome.io.rest.sitemap.internal.PageChangeListener.constructSitemapEvents(PageChangeListener.java:216) ~[?:?]
at org.eclipse.smarthome.io.rest.sitemap.internal.PageChangeListener.constructAndSendEvents(PageChangeListener.java:174) ~[?:?]
at org.eclipse.smarthome.io.rest.sitemap.internal.PageChangeListener.stateChanged(PageChangeListener.java:188) ~[?:?]
at org.eclipse.smarthome.core.items.GenericItem$1.run(GenericItem.java:251) [102:org.eclipse.smarthome.core:0.10.0.oh240]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]

I think this is as simple as a typo. There should be no space character inside the unit °C

The error complains about Item Mobile1_LastUpdate, so I guess you mean the valuecolor= part.
I cannot see what is wrong with your sitemap line.

There are working examples of using valuecolor with Number:Temperature Items, so it is not a general problem

I cleared valuecolor, it did not help:
Text item = Temperature_8302000000000000 label = "Bedroom1 [% s ° C]"

2019-07-05 10:52:46.989 [WARN ] [org.eclipse.jetty.server.HttpChannel] - /basicui/app
java.lang.NullPointerException: null
        at org.eclipse.smarthome.ui.internal.items.ItemUIRegistryImpl.convertStateToWidgetUnit(ItemUIRegistryImpl.java:431) ~[?:?]
        at org.eclipse.smarthome.ui.internal.items.ItemUIRegistryImpl.getLabel(ItemUIRegistryImpl.java:404) ~[?:?]
        at org.eclipse.smarthome.ui.basic.internal.render.AbstractWidgetRenderer.preprocessSnippet(AbstractWidgetRenderer.java:121) ~[?:?]
        at org.eclipse.smarthome.ui.basic.internal.render.TextRenderer.renderWidget(TextRenderer.java:61) ~[?:?]
        at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.renderWidget(PageRenderer.java:194) ~[?:?]
        at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processChildren(PageRenderer.java:160) ~[?:?]
        at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processChildren(PageRenderer.java:181) ~[?:?]
        at org.eclipse.smarthome.ui.basic.internal.render.PageRenderer.processPage(PageRenderer.java:124) ~[?:?]
        at org.eclipse.smarthome.ui.basic.internal.servlet.WebAppServlet.service(WebAppServlet.java:189) ~[?:?]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[29:javax.servlet-api:3.1.0]
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865) ~[?:?]
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535) ~[?:?]
        at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) ~[?:?]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) ~[?:?]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1317) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
        at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293) ~[?:?]
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) ~[?:?]
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1219) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
        at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) ~[?:?]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
        at org.eclipse.jetty.server.Server.handle(Server.java:531) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352) [84:org.eclipse.jetty.server:9.4.11.v20180605]
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) [84:org.eclipse.jetty.server:9.4.11.v20180605]
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281) [75:org.eclipse.jetty.io:9.4.11.v20180605]
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) [75:org.eclipse.jetty.io:9.4.11.v20180605]
        at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) [75:org.eclipse.jetty.io:9.4.11.v20180605]
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333) [87:org.eclipse.jetty.util:9.4.11.v20180605]
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310) [87:org.eclipse.jetty.util:9.4.11.v20180605]
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) [87:org.eclipse.jetty.util:9.4.11.v20180605]
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126) [87:org.eclipse.jetty.util:9.4.11.v20180605]
        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366) [87:org.eclipse.jetty.util:9.4.11.v20180605]
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:762) [87:org.eclipse.jetty.util:9.4.11.v20180605]
        at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:680) [87:org.eclipse.jetty.util:9.4.11.v20180605]
        at java.lang.Thread.run(Thread.java:748) [?:?]

changed only one line in sitemaps, others did not touch.

If you do not use the transformation, then there is no error:
Text item=Temperature_8302000000000000 label=“Bedroom1”

There should be no space in % s , I guess the error is illegal format.

They call the part in [ ] the formatter, transformation is something else.

Initially, I am worried about the possibility of working with an item value without dimension. This also did not work for the rule:
if (Temperature_8302000000000000.state <40) {
logInfo (“Records when device mobile1 was last seen”, “Temperature_8302000000000000.state =” + Temperature_830200000000000000.state, “IF”)
}

That’s right, if you do this:
Text item = Temperature_8302000000000000 label = “Bedroom1 [% .1f]”

Then the value for the item will be displayed in the basicUI, but there will be no “° C” dimension.
For example, it did not work:
Text item = Temperature_8302000000000000 label = “Bedroom1 [% .1f] ° C”

That is working as intended.
The formatter [ ] is you describing how you want to display the value.

“Bedroom1 [%.1f]” says “show me one decimal point and no units”.

“Bedroom1 [%.1f] ° C” is I think broken because you put the formatter in the middle of the label text

“Bedroom1 [%.1f °C]” should work and force text °C

“Bedroom1 [%.1f %unit%]” should display in the default units of your Item.

You keep adding unwanted spaces - is this a cyrillic keyboard thing?
You didn’t look at that Weather map link which includes examples of all this.

This does not work:

Text item = Temperature_8302000000000000 label = "Bedroom1 [% .1f ° C]"

In the logs:

2019-07-05 14: 19: 56.120 [WARN] [org.eclipse.jetty.server.HttpChannel] - / basicui / app
java.lang.NullPointerException: null

in basicui:

HTTP ERROR 500

Problem accessing / basicui / app. Reason:

     Server error

Caused by:

java.lang.NullPointerException

Powered by Jetty: // 9.4.11.v20180605

Of course it doesn’t work. Once again spaces have been aďded. We’ve already done this part.
[% .1f] is broken, there should not be a space between % and the . dot
[%.1f] is correct

You need to figure out why you keep getting extra spaces.

Without an example, it was not clear. Now I understand you, it was necessary to do this:
Text item=Temperature_8302000000000000 label=“Bedroom1 [%.1f°C]”

no space in conversation code.

The main question remains, because of which everything was started.

You are allowed spaces in the [ format ] but not in the special control parts with a %
Example
[%.1f degrees centi]
Those spaces are just part of some text.

What was the great question? There have been so many.

Here is the main question, without a solution.

Okay, a guessing game.

I will guess that you mean the very first problem in this post thread?

(Temperature_28a06224020000e1.state as Number < 40)
is simply bad syntax. as Number < 40 is not a valid type casting.

Try
((Temperature_28a06224020000e1.state as Number) < 40)
to cast as Number type, and then do a comparison.

It works, but why can I not use the item’s item without conversion to Number?

Item has no dimension:

   "Temperature_8302000000000000": {
     "class": "org.eclipse.smarthome.core.items.ManagedItemProvider $ PersistedItem",
     "value": {
       "groupNames": [
         "gHome"
       ],
       "itemType": "Number: Dimensionless",
       "tags": [],
       "label": "Bedroom",
       "category": "temperature"
     }
   },