I’ve just read some things here about design patterns.
What I want to achieve is a general Rule that applies for all Hue Dimmer switches in my house.
Like if the on button is pressed again the color is changing …
Now I wonder if this can be done with Blocky because I’ve never seen a tutorial like that.
I’ve just seen examples in DSL and Pyton here:(BTW great tutorial).
Blockly doesn’t appear to support splitting Strings yet so you can’t use the same approach as is used in these examples. And Blockly really isn’t intended to address advanced approaches like this.
That doesn’t necessarily mean you can’t write one rule that works for all the Items in Blockly. You’ll just need to find a way to figure out what Item triggered the rule and construct the name of the other Items you need to interact with based on the triggering Item’s name or some other attribute of the Item.
Thanks for that information. splitting strings is not an issue. I did this by removing the unit " %". (see below)
The main issue is that I cannot get the “Trigger” items name.
Is there an example to receive this (in Blocky or in JS) I just found examples in DSL and Python.
FrankS I found with Blocky you can get it to write much of the code for you. Then when you switch to the code window you can hopefully be 85% of the way to your completed code, just tailor to your liking at the end.
A small update: Blockly now contains all kinds of contextual info like triggeringItem, new state, previous state, triggered channel…
A lot of stuff was added in the openhab category and even more is available at the marketplace