Copy of Blockly rules?

Hello Stefan,

thanks for the link and the excelent job you did. I’ve discovered your reference some days befor an read some chapters. This was very helpfull.

Currently I try to write an own Bloclly block to use the HUE “.fadingLightCommand” … but I’m strugglink, because I have to use the getActions command and I’m not familare with java. So maybe you can support me by doing this job.

uid: HUE_fading
tags: []
props:
  parameters: []
  parameterGroups: []
timestamp: Jan 2, 2022, 12:44:23 PM
component: BlockLibrary
config:
  name: Block Library c107d09908
slots:
  blocks:
    - component: BlockType
      config:
        type: block1
        message0: HUE brightness [%] %1 within [ms] %2 with Thing %3
        lastDummyAlign0: right
        args0:
          - type: input_value
            name: BRIGHTNESS
          - type: input_value
            name: FADIING_TIME
            text: some text
          - type: input_value
            name: THING_ID
        previousStatement: ""
        nextStatement: ""
        inputsInline: false
        colour: 0
        tooltip: ""
        helpUrl: ""
      slots:
        code:
          - component: BlockCodeTemplate
            config:
              template: >
                var hueActions = getActions("hue",{{input:THING_ID}});
                hueActions.fadingLightCommand("color", new PercentType({{input:BRIGHTNESS}}), new DecimalType({{input:FADIING_TIME}}))
utilities:
    - component: UtilityJavaType
      config:
        name: things
        javaClass: org.openhab.core.model.script.actions.Things

So this is the Blockly component I try to write … an it seems that Blockly ist not the problem because the parameter transfer works fine.

What will work not correctly ist the code. But I’m totaly confused of this because my research within the forum shows different solution that will not work for me an produce errors.

val hueActions = getActions("hue",{{input:THING_ID}})
hueActions.fadingLightCommand("color", new PercentType({{input:BRIGHTNESS}}), new DecimalType({{input:FADIING_TIME}}))

actions.get("hue",{{input:THING_ID}}).fadingLightCommand("color", PercentType({{input:BRIGHTNESS}}), DecimalType({{input:FADIING_TIME}}))

Here you can see two impementations that won’t work correctly. Do you have any idear how to fix this? Or do you think taht it should be better to create a new thread in this forum?

Best regards, an stay healthy
Stef