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…
opened 04:25PM - 22 Jan 21 UTC
closed 05:16PM - 26 Dec 22 UTC
bug
main ui
## The problem
- when a state of type number (e.g a power item) is compared i… n blockly it is not treated as a number but a string instead
- when the item's state is assigned to a value and then the variable is compared it is treated as a number
See more details in thread https://community.openhab.org/t/solved-how-to-convert-state-string-to-number-in-blockly/113933/4
## Expected behavior
It is expected that a state value of type number can be directly compared against a number without intermediate assignment to a variable which to me even though working rather looks like a hack 😄
## Steps to reproduce
- Define a number item and then create the following rule in blockly

- in the above image the first comparison works against a number as it has been assigned to a variable before
- if the comparison is done line in the second if branch it only allows a string comparison (which does not make sense in this case)
## Your environment
Openhab 3.0.0
```yaml
generated javascript code from blockly:
var watt;
watt = itemRegistry.getItem('Shelly1Steckdose_Leistung').getState();
if (watt < 5) {
}
if (itemRegistry.getItem('Shelly1Steckdose_Leistung').getState() < '5') {
}
```
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