Blockly: cannot directly compare openHAB Item state to Math number

Click here for system info
runtimeInfo:
  version: 3.2.0
  buildString: Release Build
locale: en-GB
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 11.0.13
  javaVendor: Azul Systems, Inc.
  javaVendorVersion: Zulu11.52+13-CA
  osName: Linux
  osVersion: 5.11.22-5-pve
  osArchitecture: amd64
  availableProcessors: 2
  freeMemory: 61696984
  totalMemory: 299892736
bindings:
  - astro
  - gpstracker
  - http
  - mqtt
  - network

I have a simple Number Item in openHAB that stores the local outdoor temperature. I would like to compare it to a fixed number. I thought I’d be able to do the following:

image

But unfortunately the Maths block containing the “5” won’t fit into the space - it keeps popping out.

A workaround is to use a variable:
image

Or, to use a Text block, which feels wrong!
image

Presumably this is by design, and we’ll never allow a Maths number into that space?

The state of an item is always a string, therefore you can only compare string with string but not string with a number

Right, but it feels counterintuitive to perform mathematical comparisons on Strings.

And the example with the variable works, where the variable is a number, right?

(Note that the State of an Item in Blockly isn’t always a String…)

I’m trying to use Blockly as if I was an absolute beginner, which I think is who this is intended for (after the rule templates). It seems like a strange quirk that we’re exposing to these beginners.

This is far from being something new.

I opened up this issue quite a time ago when I wasn’t developing blockly myself and later when I joined the development I started to investigate my own filed issue because my intention was to solve the issue during the development of the new blocks - but as always things are not easy as they seem…

Please read what I learned in my own comment and also the reference I did there where Yannick also shared his insights.

PS: The topic was also mentioned here: Oh3 blockly: logic block compare item state with number - #6 by rlkoshak