I might just be blind, but for the hell I cannot figure out how to make a sunset and a sunrise rule in the graphical OpenHAB rule editor in OH3.
I tried a lot of things, but nothing worked. I hoped that
When channel astro:…:civilDusk#event was triggered
with event “start” that it would work. But nothing. Nothing happens and I have no clue how to turn lights on in the evening and send roller shutters down (and vice versa in the morning).
Also - can I set random values in the graphical editor? Like I don’t want the rollershutter every day in the exact same position but somewhere between 60 and 80% open. I did that in OH 2 rules, but in OH 3 I have no clue.
Sorry if I ask a stupid question, but I can’t figure it out myself.
You have the Astro binding installed?
The Astro Thing has the correct lat/lon coordinates for your location?
Do you see any astro log statements in openhab.log, particularly errors (these will likely appear around midnight as that’s when it calculates the events for the next day)?
I assume you are selecting the Channel from a list meaning you must actually have the Thing. Does that Thing show as ONLINE?
Do it the same way you did in OH 2. Almost everything you did in OH 2 works exactly the same in OH 3. It’s only when you want to use new OH 3 features that things become different.
If you want to do this via a UI rule, create a Script Action for the Action and choose Rules DSL for the language and most of the time you can paste the stuff between then and end there and it will work just fine. If you use “global” variables you’ll need to keep them in files or use alternatives.
You would do well to go through the Getting Started Tutorial. There are four pages devoted to UI rules and concepts.
I have seen the other ways, but I am trying to achieve it through the rules UI by selecting stuff, as I am trying to be consistent and use purely the UI of OH3. I must admit it still feels very inconvenient compared to OH2, but I am trying to adopt to the new “hot” stuff
So - I’ll try again with the rule, since it sounds that I’m almost there. I have the Astro thing, it’s online and I selected it from the dropdown.
You can add a blockly script to generate a random number and send this as command to the roller shutter.
By this you still have a graphical user interface to configure & manager your rules and do not need to write the code by yourself.
First, adding a Script Action is a pure UI rule. The point and click UI rules are not and were never intended to be used exclusively.
Put another way, you cannot get away without writing some code (or using Blockly) unless you have only the simplest of rules requirements. As soon as you get beyond “when X happens command Item Y if Item Z is A” type rules you have to write some code.
No, put the rollershutters into a Group:Rollarshutter and send the command to the Group. Commands sent to a Group get forwarded to all the members of the Group.
Unless you are talking about a different random number for each in which case, still keep the Group but add a Script Action that loops through the members of that Group and calculates a new random number and sends it as a command to each member individually.
If you insist on not using Script Actions though, well, you can’t get the random number and you can’t do it all in one rule. You would indeed need 15 scripts. But that’s an arbitrary and frankly odd restraint to put upon yourself.