Blockly with numbers

I am an absolute beginner in blocky. I really like the interface, but am struggling to do a basic function

I have tried every condition, >,=,<, etc. The only one that works is ‘not equal’

Any ideas on why this doesn’t work?

I suspect this is because the Item has a unit attached to it.

No idea how to fix I’m afraid as I keep all my Items unit-less, but I’ve updated your title so it’s easier for others to find.

You need to compare the state of the item not the item itself. Try this:

2 Likes

Trouble is, the state of Item comes with units W …

Basically the answer is right about the fact that the value contains units.

You probably fell into the same “trap” like I did quite some time ago where I opened a bug myself: Blockly handles comparison differently when taken from state directly or from intermediate variable · Issue #836 · openhab/openhab-webui · GitHub

You can see my answer here and we also had a rather long discussion here:

I hope that helps to understand the background.

Okay so this worked. Thank you very much