Rule from paper ui as .rules

I would love to have 4 rules configured from Paperui as .rules file.
They are all the same - open -close -switch on/off
It would be great if somebody could help me with that -.-

1st: when item status changes (xiaomi_kammer_item) to OPEN, then send command ON to item kammer.
xiaomi is the contact sensor and Item kammer is a switch (Intertechno Power Plug)

2nd: when item status changes (xiaomi_kammer_item) to CLOSED, then send command OFF to item kammer.

3rd: when item status changes (xiaomi_balkon) to OPEN, then send command 100 to item hue_brightness (Lamp is on 100% and switched on)

4th: when item status changes (xiaomi_balkon) to CLOSED, then send command 0 to item hue_brightness (Lamp is on 0% and switched off)

You can create rules as described here:

https://www.openhab.org/docs/configuration/rules-dsl.html#textual-rules

From the PaperUI it is not possible to create rules AFAIK.

Here is the first. I bet you can figure out the others by yourself. The rule engine is case sensitive.

rule "1st"
when 
    Item xiaomi_kammer_item changed to OPEN
then
	kammer.sendCommand(ON)	
end

yes…don´t know if it´s working, because i´m not at home, but did it like this.

rule "Balkonoffen"
when
    Item xiaomi_balkon changed to OPEN
then
    Lampe_Balkon_Switch.sendCommand('100')
  
end

thank you Joachim :wink:

018-11-27 23:53:52.568 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'kammerauf.rules'

2018-11-27 23:53:52.590 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'kammerauf.rules' is either empty or cannot be parsed correctly!

2018-11-27 23:53:54.055 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'kammerauf.rules'

:slightly_frowning_face:

EDIT: forget that…chown openhab:openhab :wink:

is there also an option from dusk till dawn?

but only if astro_sun_local_night_start-astro:sun:local:night#start ?

1 Like

Yes there is.
There are already plenty of solutions for this on the forum

You need to search the solutions for yourself.
If we start writing code for you, you’ll never learn.
Follow the rules tutorial first.
Small steps. It’s easy to imagine complicated behaviour but harder to implement.

All the questions you asked are answered in the docs or in the forum.
Search the forum, find samples of code. Copy them. DON’T COPY AND PASTE. I mean copy them. line by line. Best way to learn coding. Understand the code.
Soon you’ll be writing your own.

If you get REALLY stuck then ask. We’ll be happy to help.
Good luck and welcome to openHAB.

3 Likes

It is possible but it is still experimental. Experimental Next-Gen Rules Engine Documentation 1 of : Introduction. But Rules like described above are pretty trivial to set up using it right now.