I am using oh 3.1 m1 and make my first steps with blockly. I try to compare the item state (number item) with a number from the math block in an if statement, but I can not link the Number block to the inequality block (see first picture). A text block is no problem (2. picture) but doesn’t work. If I set a variable to the number value and than link the variable in the inequality block everything is running like I expect (3. Picture).
Can somebody help me to link the number block like it should…
It’s not clear why, but the only way to compare an Item’s state to a number in Blockly right now is to put one of them into a variable first.
Thank you Rick! Are there any plans to rework this problem?
I don’t know if an issue was opened for this or not but there is work being done on Blockly to make it more complete.
That sounds very good. Do you know when the new changes are going into a snapshot?
When they are done. It’s all volunteer effort. there is no schedule. It might be tomorrow, it might be next week, it might be next year. In the next couple of weeks is the most likely.
From what I can tell, this has not yet been fixed.
What a strange bug. Isn’t such a comparison (i.e. between an item state and a number) quite a common thing?
I suppose the reason why I find it strange, is that I don’t understand something, but the only explanation I can come up with is that item states are usually strings so that comparing them to text was the most important thing to implement since even numbers (i.e. number-strings) can be compared to strings. So it only becomes a problem when the comparison involves mathematical operations. Does that makes sense or is there a different explanation?
Blocky support was hurried and released as a minimum viable product (to parrot an Agile development term). Wiring with numbers on OH is actually quite complicated because of Units of Measurement so it’s not simple to implement.
The hint with the variable is still up to date.
To make a simple temperature control, where the object to be cooled should be lowered a few degrees, must still be achieved with variables.
Example: Room temperature is set to 22°C, but the air conditioner should cool down to 21°C.
[Variable] = Item State
ItemTemperature < [Variable] - 1
A bit dumb, but it works.