Missing „hsb of“ blockly block

Hey everyone,

I try to use the blockly scripts, by define colors and send them to the hue bulbs. Problem is, that colors are HEX values and I need separated RGB values. Online I found a „hsb of“ block in the documentation. But the block is not exists in my env?! Can someone send me a hint why I don‘t found the block?

I am using OpenHABian in the current 3.2 version.


For me it’s in the Color section within Blockly, but I am on 3.3.0.M2.

Hmm… the block is missing in my system. Anyone a idea why?

Perhaps it wasn’t added until later versions…

@hafniumzinc Good point. But the documentation of this block is already in Version 3.2.0.

I’m pretty sure the documentation is ahead of the “stable” release in this instance. For example the inline code block also only appears in the 3.3 milestones and snapshots…

Ok. Thank you. I found this function here Extending Blockly with new openHAB commands - #250 by ysc and create a own block Lib (with this tutorial: Tutorial: How To Write Block Libraries ) that backport the block for me:

uid: 360friends
tags: []
  parameters: []
  parameterGroups: []
timestamp: Apr 6, 2022, 5:20:56 PM
component: BlockLibrary
  name: 360friends
    - component: BlockType
        type: block1
        message0: hex->hsb %1
          - type: input_value
            name: COLOR
        colour: 20
        tooltip: ""
        helpUrl: ""
        output: STRING
          - component: BlockCodeTemplate
              template: "{{utility:hex_to_hsb}}({{input:COLOR}})"
    - component: UtilityFunction
        code: >-
          function hex_to_hsb(hex) {
            var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
            if (!rgb) return '';
            var r = parseInt(rgb[1], 16) / 255, g = parseInt(rgb[2], 16) / 255, b = parseInt(rgb[3], 16) / 255;
            var v = Math.max(r, g, b), n = v - Math.min(r, g, b);
            var h = n === 0 ? 0 : n && v === r ? (g - b) / n : v === g ? 2 + (b - r) / n : 4 + (r - g) / n;
            return [60 * (h < 0 ? h + 6 : h), v && (n / v) * 100, v * 100].join(',');
        name: hex_to_hsb

Thank you.

yes the documentation is ahead of the release. The block is only part of 3.3. I would recommend upgrading to 3.3 as there have been other blocks added, too.

Hey @stefan.hoehn
I am new in the openHAB eco system. So I thought I will wait for a stable release :slight_smile: Or what exactly is the „milestone3“ release?!

See this section of the Linux installation for a little more detail on what each type of release is.

The stable release only happens (usually) every 6 months (where January is usually Month 1)

The testing (or milestone) release happens (usually) every month.

Snapshots are every day.

So if you waited for the latest stable release you’d be waiting for 2 months or so…