In the process of developing a library to use my openhab-rules-tools library from Blockly I’ve encountered a problem I can’t solve from the tutorial nor the docs.
I have a block I’m trying to create that needs to create it’s own variable (kind of like a for loop has a variable). I can’t use a temporary variable (i.e. {{temp_name:desiredName[:realm]}}
) for this because the users need to be able to reference the variable in a statements block.
I did discover field_variable
which does exactly what I want (creates the variable, lets me rename it, variable shows up under “Variables”, the whole nine-yards.
However, I can’t figure out how to actually reference that variable in my code. Given.
args0:
- type: field_variable
name: VAR_NAME
variable: item
in my code I’ve tried:
Attempt | Output |
---|---|
{{field:VAR_NAME}} |
:Qdtlf+vg4rV7iO!.0yX or some other random string, clearly a unique identifier of sorts (maybe the id field (per Variable fields | Blockly | Google for Developers)). It doesn’t make sense to use the ID though because “item” gets added as a variable to the top of the code. I need the field’s text. |
{{input:VAR_NAME}} |
a space, which is interesting as if the input value is undefined it’s usually “null”, isn’t it? |
{{variable:VAR_NAME}} |
/* Invalid placeholder type variable! */ |
{{variables:VAR_NAME}} |
/* Invalid placeholder type variables! */ |
{{var:VAR_NAME}} |
/* Invalid placeholder type var! */ |
{{vars:VAR_NAME}} |
/* Invalid placeholder type vars! */ |
Have I run into a feature that OH doesn’t support perhaps?