Main repository at: https://gitlab.com/ChriZ98/OpenHab2RulesGenerator
Application for generating a rules file that can be used with OpenHab 2.0. A file can be easily generated by modifying an input file in form of a table.
First of all download the binary file for your system architecture from the releases. You may also download the "example.zip" to have some working example to test with. If you have any further questions on how to use the application, feel free to contact me.
You will need the following files to get things working...
This is the table file where all the magic happens. You have to use the following format:
OpenHab 2.0 Rules Generator | ||
Dateiname | Output.rules | |
Benutzerdefinierter Inhalt | fixed.rules | |
Regel Vorlagen | templates.rules | |
Tabelle | ||
Item | Aktion | ... |
LightSwitch_LivingRoom | SWITCH_ON | ... |
... | ... | ... |
Click to expand raw table
OpenHab 2.0 Rules Generator; Dateiname;Output.rules Benutzerdefinierter Inhalt;fixed.rules Regel Vorlagen;templates.rules ; Tabelle; Item;Aktion LightSwitch_LivingRoom;SWITCH_ON
You can add as many columns and row as you like. Every new row creates a new rule and every column creates a new key/value that can be replaced in a template as explained below.
You should create some template to make things easier. A template has the following format:
#template:SWITCH_ON
when
Channel "astro:sun:68b99d43:civilDusk#event" triggered END
then
if (Automate_Light_Switch.state==ON) {
sendCommand($ITEM$, ON)
}
end
The template name is the value in the "Aktion" column of the rules.csv. Every other column name can be used in the template to be replaced by its value.
This file is appended to the output file in front of the generated rules. You can simply write an ordinary rules code in here.
Put these three files and the executable into one folder and run the application. The rules will be created and grouped by condition and if statements. Then your output file will be created and you can put it into the folder of your Open Hab 2.0 configuration.
OpenHab2RulesGenerator by ChriZ982 is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.