Hola amigos,
another day another oh2.5 to oh3 migration…
I’ve figured out that files are the only way I would go with, as they are unbeatable in terms of flexibility… thanks to docker I can run my production OH2 and play with OH3 migration forever till I’m satisfied…
I found out that rules/scheduler and script would NOT accept anything non-semantic by default (3.1 snapshot 2115), which is bit lame honestly as you need quite a lot of helpers which does not have to be semantic at all… yes it can be avoided by selecting “semantic” item first and then edit item in the next step, but thats… ok i can live with
but how we can achieve this simple DSL rule in blocky?
rule "Cleaning"
when
Item Service_Clean received command ON
then
var count = ((if(Service_Clean_Count.state >= 0) Service_Clean_Count.state else 0) as Number).intValue + 1
Service_Clean_Count.postUpdate(count)
Service_Clean_Date.postUpdate(now.toString)
Service_Clean.setLabel("Cleaned today | " + now.toString("dd.MM") + " (" + count + ")")
end
And as I do like idea of having rules defined by UI I’m trying to get used to blocky … well my surprise, there is nothing like time functions in there?
So far I’ve got this
var count;
count = itemRegistry.getItem('Service_Clean_Count').getState();
count = (typeof count == 'number' ? count : 0) + 1;
events.postUpdate('Service_Clean_Count', count);
events.postUpdate('Service_Clean_Date', 'value');
But can’t figue how to add “now” and as well it seems there is no possibility to manipulate label? or is it?
should I just fire script instead where I put those 4 lines of DSL code instead?
This got me thinking… is UI rule definiton meant to be for regular joe? IFTTT ? as It does looks like it cannot offer anything near flexible as DLS or jython is…
I really do like scheduling (there is a bug as well, as you need to define rule from Scheduling or it’s not “scheduled” at all) but these limitations of UI pull me back a bit …
or I’m missing something very obvious here?
(not rant, not complain, just genuine question)