I’v been struggling with OpenHab for more then a week.
I’ve a orange Pi plus 2E with Rfxcom and it works with al my kaku-switches. I’ve a wireless-walswitch even from kaku. I want to push the wallswitch and then it has to turn on the light in the kitchen and livingroom. Tried to link channels but it didn’t work… Read many forums but no luck.
And if I press my doorbel it has to trigger a script that sends me a foto of whois in front of the door. The script runs fine in cli. But I cannot accomplish this. I tried rules but with no luck.
I’ve made everthing whti paper ui and habmin. But how can I create a sitemap? I’ve read many topics but i;m stuck.
Thanks for your reply. I want to trigger a script when the doorbell is pressed:
rule "Deurbel"
when
item "rfxcom:lighting2:ded27f2a:17077686_0:command" triggered
then
var String Deurbel = executeCommandLine("sudo /etc/openhab2/scripts/deurbel.sh",10000)
end
and this one for my wallswitch:
rule "Wandschakelaar_BG_WK"
when
Item rfxcom_lighting4_ded27f2a_278865_command changed from OFF to ON
then
sendCommand(rfxcom_lighting4_ded27f2a_262145_command, ON)
sendCommand(rfxcom_lighting2_ded27f2a_14160886_1_command, ON)
end
rule "Wandschakelaar_BG_WK"
when
Item rfxcom_lighting4_ded27f2a_278865_command changed from ON to OFF
then
sendCommand(rfxcom_lighting4_ded27f2a_262145_command, OFF)
sendCommand(rfxcom_lighting2_ded27f2a_14160886_1_command, OFF)
end
What is this channel?
“rfxcom:lighting2:ded27f2a:17077686_0:command” is it a switch?
Not all binding accept channel triggers
Assign an item to that channel and chande the trigger to that rule
RENAME your items, you can’t know what they are by just reading your code
rule "Wandschakelaar_BG_WK"
when
Item rfxcom_lighting4_ded27f2a_278865_command changed
then
rfxcom_lighting4_ded27f2a_262145_command.sendCommand(receivedCommand)
rfxcom_lighting2_ded27f2a_14160886_1_command.sendCommand(receivedCommand)
end
rule "Wandschakelaar_BG_WK"
when
Item wandschakelaar changed
then
rfxcom_lighting4_ded27f2a_262145_command.sendCommand(receivedCommand)
rfxcom_lighting2_ded27f2a_14160886_1_command.sendCommand(receivedCommand)
end
But it stil doesn’t work. Perhaps I misunderstood you.
And from my doorbell script I get an error. I gues it runs. this is the error:
20:50:22.966 [ERROR] [nhab.binding.exec.handler.ExecHandler] - An exception occu rred while executing '/etc/openhab2/scripts/deurbel.sh' : 'Cannot run program "/ etc/openhab2/scripts/deurbel.sh": error=13, Permission denied'
I think you are getting confused between things and items.
In the thing Licht_kamer there will be channels
One off the channel will probably be command
Link an item to that channel and call the item 'Licht_Kammer_Switch`
TO turn the “Real world” switch you send the command ON to the item:
Licht_Kammer_Switch.sendCommand(ON)
For your door bell do the same thing:
Link an item called ‘Doorbell’ to the command channel of the ‘Deurbell’ thing
Then your rule trigger is:
rule "Deurbel"
when
item Doorbell received command
then
var String Deurbel = executeCommandLine("sudo /etc/openhab2/scripts/deurbel.sh",10000)
end
And the second rule:
rule "Wandschakelaar_BG_WK"
when
Item wandschakelaar received command
then
rfxcom_lighting4_ded27f2a_262145_command.sendCommand(receivedCommand)
rfxcom_lighting2_ded27f2a_14160886_1_command.sendCommand(receivedCommand)
end
Good well done.
Do you have a better understanding of the difference between things and items?
And the items names and labels.
You could change the items labels to something without the _ now.
rule "Wandschakelaar_BG_WK"
when
Item Wandschakelaar_Beneden changed
then
Licht_Kamer_Switch.sendCommand(ON)
Licht_Keuken_Switch.sendCommand(ON)
end
It turns on but I cann’t turn the lights off.
But now I wanna just turn on and off the same lichts. I edit the rule as shown below.
rule "Wandschakelaar_BG_WK_ON"
when
Item Wandschakelaar_Beneden changed to ON
then
Licht_Kamer_Switch.sendCommand(ON)
Licht_Keuken_Switch.sendCommand(ON)
end
Rule "Wandschakelaar_BG_WK_OFF"
when
Item Wandschakelaar_Beneden changed to OFF
then
Licht_Kamer_Switch.sendCommand(OFF)
Licht_Keuken_Switch.sendCommand(OFF)
end
when I use just the firts rule:
rule "Wandschakelaar_BG_WK_ON"
when
Item Wandschakelaar_Beneden changed to ON
then
Licht_Kamer_Switch.sendCommand(ON)
Licht_Keuken_Switch.sendCommand(ON)
end
But when I add the second rule it doesn;t work. I’ve even made two different rules, but with the same result.