Bug with item meta data and blockly?

Before I might file an issue to OpenHAB core, I wanted to ask if I might have a misunderstanding or just did something wrong. I cam across the following issue:

I created a status item (number item, non-semantic) that I wanted to use to track the state of the dryer. I created a rule using a blockly script to set the status item to one of three states (0, 1, 2). All of this worked fine.
Since I didn’t want to show 0, 1, 2 in the UI, I added a meta data, state description. Within, I put 0=OFF etc. This works fine as well.
But now the strange thing happens: as soon as there is state description meta data at this item, I cannot use it in Blockly anymore! It disappears from the item list. If I delete the meta data, I can select the item again.
I don’t think having meta data attached should make an item disappear from the item list, right? Here are some screenshots:

The rule I use:


Item:

Meta data:

Now the two views in Blockly:
As long as there is meta data set in the item:

Now I removed the meta data and then choosing an item gives me:

To me that looks like a bug, but I don’t know if this might be intentional…

This definitely sounds like a regression.

Keep in mind though that if you are running OH 3.4, you’ll need to test this in OH 4 because we have a bunch of new development around Blockly in OH 4 and this might already be fixed.

In the mean time, what you can do is apply a transform profile with the Map transformation and put the mappings into that. Your Item will need to change to be a String Item.

Yes, I’m running (latest stable?) OH 3.4.4. I don’t have a OH 4 instance running yet, but I can fire up a VM and test it there. I will report as soon as I can.

Everything works fine as long as I apply the transformation after the rule is done. I can’t select/add the item anymore after the transformation is added, but the rule still works. It’s only a visual thing that it’s missing in the search/pick dialog.

I did a quick test with OH4 and it seems to be working there. No matter if I put a state description or not, the item seems to be shown in the Blockly designer windows. So this bug seems to be resolved in OH4.
Of course, in my OH3 instance. I have dozens of things and 800 items. The OH4 was a fresh install with one thing and one non-semantic item. So this might also have an influence. Though I hope it didn’t.

2 Likes

I will mark this as solved, since it seems to be solved in OH4. Though, it’s not the perfect solution :slight_smile:

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.