My rules dont do anything… Probably a stupid mistake, but I am a total newbe to Linux and Openhab. My Items and sitemap work. I create a file named home.rules and store it in ETC/OpenHAB2/Rules/
Items configuration related to the issue
’
Switch SchaltSteckdose1 “SchaltSteckdose1” {zway:zwayDevice:192_1$
Switch Drucker_Online “Drucker_Online” {network:device:192_168_178_29:online}
Switch Onkyo_Power “Onkyo_Power” {onkyo:TX-NR626:5fb0e63a-e8e6-3ab9-3def-3a09e8$
’
Sitemap configuration related to the issue
’
sitemap home label=“home”
{
Frame label=“Diverses”
{
Switch item=SchaltSteckdose1 label="SchaltSteckdose1"
Switch item=Drucker_Online label="Drucker_online"
Switch item=Onkyo_Power label=“Onkyo_Power”
}
}
’
Thanks! The event log show it has been switched. but not rule or error entry
I switched in on once
2017-11-11 17:02:23.214 [ItemStateChangedEvent ] - Onkyo_Power changed from ON to OFF
2017-11-11 17:02:37.518 [ItemCommandEvent ] - Item 'Onkyo_Power' received command ON
2017-11-11 17:02:37.531 [ItemStateChangedEvent ] - Onkyo_Power changed from OFF to ON
2017-11-11 17:02:38.824 [ItemCommandEvent ] - Item 'Onkyo_Power' received command OFF
2017-11-11 17:02:38.832 [ItemStateChangedEvent ] - Onkyo_Power changed from ON to OFF
2017-11-11 17:02:49.931 [ItemCommandEvent ] - Item 'Onkyo_Power' received command ON
2017-11-11 17:02:49.945 [ItemStateChangedEvent ] - Onkyo_Power changed from OFF to ON
2017-11-11 17:03:00.266 [ItemCommandEvent ] - Item 'Onkyo_Power' received command OFF
2017-11-11 17:03:00.276 [ItemStateChangedEvent ] - Onkyo_Power changed from ON to OFF
2017-11-11 17:03:27.860 [ItemStateChangedEvent ] - TemperaturBadOG changed from 22.5 to 22.0
2017-11-11 17:05:27.905 [ItemStateChangedEvent ] - TemperaturBadOG changed from 22.0 to 22.5
2017-11-11 17:10:22.463 [hingStatusInfoChangedEvent] - 'onkyo:TX-NR626:6846e43e' changed from OFFLINE (COMMUNICATION_ERROR) to ONLINE
2017-11-11 17:10:32.241 [ItemCommandEvent ] - Item 'Onkyo_Power' received command ON
2017-11-11 17:10:32.261 [ItemStateChangedEvent ] - Onkyo_Power changed from OFF to ON
2017-11-11 17:10:44.682 [ItemCommandEvent ] - Item 'Onkyo_Power' received command OFF
2017-11-11 17:10:44.691 [ItemStateChangedEvent ] - Onkyo_Power changed from ON to OFF
2017-11-11 17:10:48.474 [ItemCommandEvent ] - Item 'SchaltSteckdose1' received command ON
rule "tests"
when
Item Onkyo_Power changed
then
SchaltSteckdose1.sendCommand(ON)
end
This one should fire, when the ItemOnkyo_Power changed. But beware, changed is either ON or OFF, meaning, your outlet will be powered on either way!
If you like to power your outlet, if the Stereo is powered ON, you could use:
rule "tests"
when
Item Onkyo_Power changed to ON
then
SchaltSteckdose1.sendCommand(ON)
end
Edit: please change your quotation marks to the simple ones. Perhaps this was the editor of the forum or something, but using other quotation marks than the simple ones could lead to unexpected side effects also.
Thanks for your response and taking the time.
I did not know how to use the editor properly causing the weird formating.
.
Will use it better from now on.
I tried that with Item before, also I tired addig an “Item” before the other item, no luck in either combination.
I do also have some connection issues with the Onkyo checking the logs and it is not working reliably . So need to solve that first.
I just wanted a simple test, so I have not set it all up yet. I actually re-installed everything as my rules did not work, so I spend days on it already.
Does a rule always need a trigger? Can one leave it open? How can I quickly check that the rules is working , the Fibrao Switch is working reliably.
I have a feeling no matter what I do it is not doing the rules…
No problem, everybody was a first timer here at some point!
From the log I assume, you already have your .items placed in the right folder. Just to be sure: your .rules files are placed in /etc/openhab2/rules?
So, after changing a rule, do you see a line added in openhab.log? should read something like “Loading model 'YOURNAME.rules'”
Ahh- thats pointing towards somehting I guess. I have reduced it to only one item, to exclude any item errors…
2017-11-11 18:31:58.745 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'home.rules' has errors, therefore ignoring it: [1,6]: no viable alternative at input '“'
rule “tests”
when
item SchaltSteckdose1.changed
then
SchaltSteckdose1.sendCommand(ON)
end
remove the “.” between SchaltSteckdose1 and changed
It should read now:
rule "tests"
when
Item MeinTest changed
then
SchaltSteckdose1.sendCommand(ON)
end
Hint: In your rule: if the Item “SchaltSteckose1” changed, it makes normally no sense to send an ON command to the same item? even for testing. You should add another item “MeinTest” or something, which you can change, the items must not have a binding action.
.items:
Switch Meintest
.sitemap
Switch item=MeinTest label=“Test”
You can then turn MeinTest in the sitemap and regardless of ON or OFF, the SchaltSteckdose1 should receive the Command ON.
oh. My bad!
Please be sure, the names of the items are exactly the same. I misspelled MeinTest in the .items example above!
Keep in mind: nearly everythin is case-sensitive.
So, if you change the Name to “MeinTest” in the items, it should run.
A useful tool, now that you have found the logs - logInfo()
rule "tests"
when
Item MeinTest changed
then
logInfo("testing", "my rule is running")
SchaltSteckdose1.sendCommand(ON)
logInfo("testing", "my rule is ending")
end
Hi all- this board (you) are awsome. Thanks a lot!!! Now that it is working I can re-built the sensor actor infrastructure and slowly get the rules up.
Some of the documentation of Openhab seems still to reference the old version, now the file locations have changed, for example and also some syntax.
As I am not a programmer this is is diffcult for me, also I only ever worked on Windows systems , coding (badly) VB and VBS. Yes- the mixedcase and spelling seems very fragile, and not a lot of errors thrown to get a hint. it just doesn’t work The login of is certainly now helpful. Many thanks!