Rule if error

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"
     }
   },

Because of that Item type.
As we discussed before, Number:Dimensionless does have units of measurement, typically % percent.
The Items state is therefore something like 27%
You cannot compare 27% with 22. “22 what? Parts per million?”
You either have to strip the % off the 27, or add a % to the 22

No, I have no idea why you would put your apparent temperature reading into a Number:Dimensionless type. People would usually use either a Number:Temperature or a plain Number.

Why then in logs it is not written% after value? It worked with temperature and wrote:
2019-07-01 14: 05: 50.319 [INFO] [vice ControllerDS18B20 was last seen] - Temperature_28a06224020000e1.state = 56.31 ° C

Logs write in rule:

 logInfo("Records when device ControllerDS18B20 was last seen", "Temperature_28a06224020000e1.state=" + Temperature_28a06224020000e1.state)

Probably because you haven’t assigned it a unit. Just because people usually use Number:Dimensionless as a percentage doesn’t meant it has to be.
Number:Dimensionless represents a proportion, so “3 to 1” would be a valid sort of value to represent. The state of the Item can only hold one number, so we might store that as just 3, with a blank unit.
It’ is still a Number:Dimensionless, and you still cannot do the apples/oranges comparison with a plain Number.

You seem to be making it difficult for yourself by choosing to store some temperature reading in a Number:Dimensionless Item. Maybe it is time to review that decision.

I am trying to approach the setting of OH2 in a systematic and uniform way.
My approach, which is not clear how to implement:

  1. In the items I create an item with the desired icon (temperature, humidity, pressure, voltage). But the value of the item should not keep dimension.
  2. in sitemaps I configure the output in basicui what dimension to display in the user interface
  3. in the rules, use for comparison only the value of .state for all items.

For example, the readings from the humidity sensor do not work according to the temperature example, the rules do not work if the comparison without dimension does not work:

rule "Records when device mobile1 was last seen"
when
  Item Temperature_83020000000000 received update or
  Item Humidity_8302000000000000 received update or
  Item Voltage_8302000000000000 received update
then
logInfo ("Records when device mobile1 was last seen", "BEGIN")
 logInfo ("Records when device mobile1 was last seen", "Temperature_8302000000000000.state =" + Temperature_830200000000000000.state)
 logInfo ("Records when device mobile1 was last seen", "Humidity_8302000000000000.state =" + Humidity_830200000000000000.state)

  postUpdate (Mobile1_LastUpdate, new DateTimeType ())

 if (Temperature_8302000000000000.state <40) {
  logInfo ("Records when device mobile1 was last seen", "Temperature_8302000000000000.state =" + Temperature_830200000000000000.state + "IF")
}
 if (Humidity_8302000000000000.state <40) {
  logInfo ("Records when device mobile1 was last seen", "Humidity_8302000000000000.state =" + Humidity_830200000000000000.state + "IF")
}
logInfo ("Records when device mobile1 was last seen", "END")
end

In the logs:
2019-07-08 13: 52: 06.447 [INFO] [ds when device mobile1 was last seen] - BEGIN
2019-07-08 13: 52: 06.448 [INFO] [ds when the device mobile1 was last seen] - Temperature_8302000000000000.state = 21.2
2019-07-08 13: 52: 06.448 [INFO] [ds when device mobile1 was last seen] - Humidity_83020000000000.state = 53.5
2019-07-08 13: 52: 06.449 [INFO] [ds when device mobile1 was last seen] - Temperature_8302000000000000.state = 21.2 IF
2019-07-08 13: 52: 06.449 [INFO] [ds when device mobile1 was last seen] - END

Items:

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

I expected with this setting that the line will be displayed in the log:
2019-07-08 13: 52: 06.448 [INFO] [ds when device mobile1 was last seen] - Humidity_83020000000000.state = 53.5 IF

But the check did not work.

Icons have nothing to do with any of this

That’s not always possible; some bindings reqire use of an appropriate UoM

Just use as Number. I promise it doesn’t cost you anything.