Hi, i am exploring rules now and I want to do something realy simple: Simply send a UP comment to my rollershutter at 23:40. This is the content of my .rules file:
rule "Storen um 2340 hoch"
when
Time cron "0 40 23 * * ?"
then
sendCommand(Lamellen_EG_Whz_Sued, UP)
end
Nothing… or better nothing that is in this relation
2016-03-10 22:39:49 - Aussentemperatur_aktuell received command 26.400000000000002
2016-03-10 22:39:54 - Aussentemperatur_aktuell received command 26.5
2016-03-10 22:41:00 - Taster_Gas_fuer_Whz received command OFF
2016-03-10 22:41:00 - UG_BueroLicht received command OFF
it looks even like nothing happened… how can i check if the rule has been executed?
I have done this change, moving towards sendCommand(Item,state) helped a lot.
I however have another very strange behavior observed. Openhab does not execute one of my 3 rules file. I am using raspberry. These are my files:
-rwxr-xr-x 1 pi pi 828 Mar 6 21:20 rules.rules
-rwxr-xr-x 1 pi pi 0 Mar 6 21:20 sonos.rules
-rwxr-xr-x 1 pi pi 231 Mar 11 19:38 storen.rules
rules.rules and sonos.rules work and openhab loads them when i start:
2016-03-11 19:45:15.058 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'sonos.rules’
2016-03-11 19:45:20.823 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model ‘rules.rules’
For whatever reason storen.rules is not being loaded. This behavior even happens, if i copy rules. rules (which works) to storen.rules (which would mean exactly the same content).
Also, very interesting, if i open openhab Designer, than I see only rules.rules and sonos.rules, but not storen.rules. If I open Finder on my Mac, i see all three files, as i do on my Raspberry.
Anyone that observed the same or has an idea why this behavior?
Check the file permissions and ownership of the unloaded file. If the openhab user (or whatever user openHAB is running under) is not allowed to read the file it wont.
As you can see, its exactly the same.
I wonder if there is a why to check if which ever script is responsible to scan the rules directory can see also the storen.rules file and whats the reason for this script to ignore it
There is no script, it’s part of the core software.
Double check that there is no typo or other syntax error in storen.rules. It should generate an error in the log if that is the case but I can’t think of anything else.
Maybe you have a typo in the filename (for instance a leading space, mac has the ability to do such things), the designer doesn’t filter any files out, so it seems, that the file itself is ‘invisible’ for openHAB.
rules.rules does work. I have copied rules.rules into storen.rules
-rwxr-xr-x 1 pi pi 828 Mar 6 21:20 rules.rules
-rwxr-xr-x 1 pi pi 0 Mar 6 21:20 sonos.rules
-rwxr-xr-x 1 pi pi 828 Mar 11 22:28 storen.rules
It is now exactly the same. I stopped openhab. Next step i started openhab again.
openhab.log tells now the following:
2016-03-11 22:31:17.273 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'sonos.rules’
2016-03-11 22:31:25.328 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model ‘rules.rules’
you can test it with “sendCommand(Lamellen_EG_Whz_Sued, 0)” or “sendCommand(Lamellen_EG_Whz_Sued, 100)” - depends on how you define UP and DOWN (my Fibaro is 0% open and 100% close). For me that works fine.
BR
Hubertus
rules.rules does work. I have copied rules.rules into storen.rules
-rwxr-xr-x 1 pi pi 828 Mar 6 21:20 rules.rules
-rwxr-xr-x 1 pi pi 0 Mar 6 21:20 sonos.rules
-rwxr-xr-x 1 pi pi 828 Mar 11 22:28 storen.rules
It is now exactly the same. I stopped openhab. Next step i started openhab again.
openhab.log tells now the following:
2016-03-11 22:31:17.273 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'sonos.rules’
2016-03-11 22:31:25.328 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model ‘rules.rules’
Try making sure the rule names are not identical in the two files. Perhaps OH skips over those when they are identical. No other ideas but at this point I think it is an OS/Shell problem more than an OH problem. For what ever reason the shell doesn’t let OH even see the file.