Default.rules

Taking steps forward and want to leave the PaperUI behind me. Thats working ok but want to create real rules.

In Visual Studio code : made default.items and default.sitemap and all working fine.
But when creating the default.rules in the rules directory with below lines nothing happens.
Double checked and cannot find what is going wrong. Please help me to go forward.

import java.net.URI

rule “Entry”
when
Channel “zwave:device:512b1d8c:node4:sensor_door” changed from CLOSED to OPEN
then
Balkon_Lamp.sendCommand(ON)
end

I’m assuming you have an item setup for that channel? Check your item for your changes. Not all bindings support channel triggers. Your item state will do just as well.

I tried that earlier but nothings happens

rule “Entry”
when
Hal_Voordeur changed from CLOSED to OPEN
then
Balkon_Lamp.sendCommand(ON)
end

default.items :
Contact Hal_Voordeur “Voordeur” [“Switchable”] { channel=“zwave:device:512b1d8c:node4:sensor_door” }

Switch Balkon_Lamp “Lamp balkon” [“Switchable”] { channel=“tradfri:0010:gwa0c9a0d8a75b:65546:power” }

Perhaps I need to delete all items in PaperIU before redefining them in default.rules ?

You need to revise your rule. You forgot to specify “Item”

rule "Entry"
     when
         Item Hal_Voordeur changed from CLOSED to OPEN
     then
         Balkon_Lamp.sendCommand(ON)
end

Hi @Walter1

Don’t blame you openhab is extremely powerful once opened up with text files when I first started I was petrified of text files soon realised how useful they were never looked back

I still use paper too install my bindings and create things the rest is text file now

Also when posting text rules and files can you use the code fences please it makes it alot eisier too read

Hi,
Added item and also changed capital letters Open Closed…no response

Default.rules:

import java.net.URI

rule “Entry”
when
Item Hal_Voordeur changed from Closed to Open
then
Balkon_Lamp.sendCommand(ON)
end

Default.items:
Contact Hal_Voordeur “Voordeur” [“Switchable”] { channel=“zwave:device:512b1d8c:node4:sensor_door” }

Switch Balkon_Lamp "Lamp balkon" ["Switchable"] { channel="tradfri:0010:gwa0c9a0d8a75b:65546:power" }

Default.sitemap:
Text item=Hal_Voordeur label=“Voordeur”
Switch item=Balkon_Lamp label=“Lamp balkon”

The door is nicely showing a icon of an open door.
Switching the balcon light on works via mobile

Looks like the default.rules file is not read ??

(thanks for support uptill now).
Eager to make next step in programming. just want to start with simple rule. Perhaps you have something to check if default.rules is working ?

no, CLOSED and OPEN
These are magic words in rules for Item states. ON , OFF , NULL and so on likewise.

WORKING :slightly_smiling_face:

Strange however because I had it with uppercase at the beginning…well I look forward and can start making rules. Knowing the rules file works !