After creation the console log informs me about a rule update but nothing happns. Tried to use a item to trigger the rule, nothing tooā¦
Iām searching for a tutorial or something similar but I canāt find any information how to get startet with this feature. As I understand, the Main UI Scripts you add to ānormalā rules, right?
Are you trying to add this script using the UI rules? The rule text youāve pasted is only if you are using file-based js rules. If you are using the UI then you put the trigger information in under the When heading using the add trigger button. And the script that gets added as a script action is only the actual lines you want executed.
Still the same issue. You do not enter the full file-based syntax in there. Just the lines you want executed.
The āscriptsā are just rules without event triggers, not a generic engine for rule-based syntax. Since you clearly show that you want a trigger in your rule, then you use the ārulesā section and follow the steps I put above.
I donāt get the terminology. Scripts inside Rules are called āMainUIā? Scripts under the menu Scripts are āMainUIā or āFileBasedā? And what are Scripts called that are the Actions of Rules that are created inside a Script? Sorry I read the docs the whole day. I just canāt get itā¦
The script I posted was the first simple attempt to get scripts without the rules menu of OH. The idea is, to create button press patterns with timers so I can use some variables as globals outside of the rules. I want to avoid to create multiple helper rules/items to provide this. Just one script with nearly everything needed inside. Maybe you can suggest a better way?
No, thatās not it. What youāve done is create a Script (see below) that when it runs, creates a wholly separate Rule that has a cron trigger. The levels of redirection is asinine. Just create the rule following the instructions in the Getting Started Tutorial.
The tl;dr for how to do that is quite aptly provided by @JustinG above.
MainUI: When you go to http://<ipaddress>:8080 you see a user interface. That user interface is called āMainUIā. OH supports many UIs. The one that lets you administer OH (create Items, rules, etc.) is called āMainUIā.
Scripts under the menu Scripts are āMainUIā or āFileBasedā?: MainUI based. File based rules live in text files under $OH_CONF/automation/js in files that have a .js file extension. The Scripts under Settings ā Scripts are rules that lack triggers or conditions. Thereās a whole section of the Getting Started Tutorial that discusses this: Getting Started - Introduction | openHAB in addition to the l docs referenced above.
And what are Scripts called that are the Actions of Rules that are created inside a Script?: The word āscriptā has multiple uses. There is a section of the Getting Started Tutorial and of the Rules Concepts Page that discusses this. The āActions of Rules that are created inside a Scriptā is kind of nonsense. Assuming you mean āActions of Rules created inside a Ruleā than they are called āScript Actionsā. They contain the code that runs when that rule is triggered.
I appreciate that but several people spent a lot of time writing those docs. Without more specific questions nothing we write here as an answer will be as well thought out, complete, and comprehensive as what exists there in the docs.
Your questions indicate a lack of reading of the docs, jumping around the reference docs without having understood some of the fundamentals of OH that are covered in the concepts sections of the docs, or a complete misunderstanding of what youāve read. Itās really hard to help because we donāt know which of these is the case.
It might help if you go to Rules - Introduction | openHAB. Read that in detail and then come back with anything you do not understand. If you donāt have these basic concepts down, itās going to be really hard to help.
Then go through the complete Getting Started tutorial. You can skim through much of it but at least scan each section of each page. Read the Rules pages in detail. Come back with anything you donāt understand from there.
Maybe then we can be of more help. If we can get some specific questions we can perhaps explain it in a different way or provide more details.
Iām not sure you have an understanding of how rules work and the parts of a rule to have any hope of achieving this right now. But to store variables outside a rule you can use Items (there is nothing wrong with using Items to store state, thatās sort of the whole point of them) or use the cache.