Blockly - Adding my own Blocks


Loving Blockly so far, it’s a real time and brain saver in my eyes. I have always known what rules I want to write but it’s often the syntax that let me down while writing DSL rules, and what sucked my time trying to debug…all that is now gone! Amazing kudos to all that developed it.

My question is, in every rule there are always a few things that I do, for example I put a log info with the name of the rule and text ‘started’ appended to it.

Is there a way for me to create my own Block that can sit in Libraries or the appropriate section, (in this case Logging & Output), that will be available for me to just drag and drop onto each new rule as required? Almost like a ‘global variable block’…

I’m guessing there must be a way as people create the libraries, but can they be user specific without being offered to the masses?

All the block libraries you create using OH (under Developer tools → Block Libraries) are local to your instance. They only become available to the community if you choose to share them by posting them in the Add-on Markplace Block Libraries category of this forum.

Ah perfect, happy to share them if they are useful to anyone…

Is it worth just putting them in the library and leaving them there or do they need some user case / user support or vote to put them there?

Nothing more than your willingness to share is required. When you create the post in the correct category a series of instructions will pre-populate the topic you are creating. Follow those instructions with regard to formatting and tagging the post and your library will be available for all in their OH Settings → Automation.

1 Like