Blockly doesn't like the value in key/value pairs

I am trying to add a dictionary (with just one key/value pair), effectively passing a parameter into a script which will be called from multiple places. My first experiment took me here:


Very close, but I can’t drag the “Hello” into the value position of the dictionary - it jumps back again whenever I try. From what I have read in the [excellent] documentation, it should work.

In the hope that it helps, this is the code view:

It feels tantalisingly close - the null just needs to be replaced with “Hello” - so where am I going wrong?

Thanks, Nick

I just ran into this issue. I eventually replaced the whole violet coloured block with the last block from the Lists menu, to which we can attach a text block. Just remove any unneeded lines (I think it starts with three by default).




1 Like

Fantastic, thank you for the pointer.

That does feel like we have found a Blockly bug, but that workaround certainly does the job. Thanks for taking the time to respond.

It certainly feels like it - perhaps there’s a nuance that we don’t understand yet. @stefan.hoehn might be able to provide more wisdom!

It is exactly right how you did it. You have to replace the block with the real one. There is a mention of that situation in the ‘Extending Blockly’ thread ( I am away which is why it is currently hard for me to point you to the right entry).

Do you mind setting it to solved then in the title?

OK. The current entry states:

Parameters can be provided by adding a “dictionary” of key / value pairs to the block but can also be left empty if not necessary. The dictionary block can be found openhab blockly “lists” section where you can find more information on how to use it.

It’s that second sentence which seems important in this case, and at the time I didn’t understand that this was a MUST. I will edit the wording a little to try to make it a little clearer.

I’ve made some modifications to that section in the documentation. I have also replaced the screenshot that accompanied it as I realised that was the main reason for my confusion - it had the gear icon expanded which suggested you could add keys here, but that doesn’t work (at least not with the text and variable blocks I tried).

@NickLocke has marked the relevant post as the answer, so a tick automatically appears in the title of the thread.


Thanks, the new wording is fine. I appreciate that you help but do you mind telling me before what and how you want to change so I can review it first because finding out myself takes quite some time due to the length of text comparing it? :pray:

Can you please put the picture into it like I depicted it

but replace it with the new dictionary one before which then has a different color.
I intentionally wanted to show the cog’s popup there. You wording now makes it clear that it has to replaced.

Here is the reference I mentioned above by the way: Extending Blockly with new openHAB commands - #221 by stefan.hoehn


If you want this then you (or Andrew, I guess), should remove the wiki feature of that thread and just get us to send you all recommended changes instead.

Sure, but isn’t that cog icon irrelevant to this section of the documentation, and far more relevant back in the List section?

The idea of the wiki was that Andrew, me and Rich can work together on that. If we remove that we cannot collaborate anymore. I am not saying you must not change anything but at the current state I would still like to review everything to make sure it is correct.

Now now… is that any way to treat your beta testers???
Correction: the block reference is a wiki so that anyone… anyone in the community willing to put their time and efforts into improving is welcome to do so. Thanks T

Regarding the solved I was told that one should put “solved” in the title but I may have been wrong there. Thanks for clarifying that.

will tentatively solve this problem - since the cog icon (“mutations”) don’t work with so-called “shadow” blocks then as an exception this makes it into a real block in the toolbox.

1 Like