oh god, thats embarrassing, I’ve forgotten the brackets in the rule. The rule repeats itself after the first cycle and ends in a permanent slope.
The right rule is:
rule "Sheldon"
when Item sheldon received command
then if(receivedCommand == ON)
{
Power_Plug_Socket_B9.sendCommand("ON") // turn on the socket
Thread::sleep(5000)
lirc.apply("fernseher", "KEY_POWER", logName) // turn on the tv
Thread::sleep(1600)
lirc.apply("appletv", "KEY_UP", logName) // random button to turn the Apple TV on
Thread::sleep(25000)
lirc.apply("harman_kardon", "KEY_POWER", logName) // turn on the receiver
Thread::sleep(25000)
lirc.apply("appletv", "KEY_DOWN", logName) // navigate in the home screen
Thread::sleep(1600)
lirc.apply("appletv", "KEY_DOWN", logName) // navigate in the home screen
sheldon.sendCommand("OFF")
}
end
I was on my phone before but so you know this is the example. I’ll leave the lock up to you if you need it or not.
item receives the ON command and the rule fires
rule "Sheldon"
when Item sheldon received command ON
then
Power_Plug_Socket_B9.sendCommand("ON") // turn on the socket
Thread::sleep(5000)
lirc.apply("fernseher", "KEY_POWER", logName) // turn on the tv
Thread::sleep(1600)
lirc.apply("appletv", "KEY_UP", logName) // random button to turn the Apple TV on
Thread::sleep(25000)
lirc.apply("harman_kardon", "KEY_POWER", logName) // turn on the receiver
Thread::sleep(25000)
lirc.apply("appletv", "KEY_DOWN", logName) // navigate in the home screen
Thread::sleep(1600)
lirc.apply("appletv", "KEY_DOWN", logName) // navigate in the home screen
}
end
add autoupdate false to your sheldon item which causes it to not update its state, so you don’t have to turn it off.
{autoupdate=“false”}
Hey again, I tried to get it to work on an other pi. I’m confused because I can’t find the .service file under /usr/lib/systemd/system/lirc.service. Do you have an idea, where it is ? @chriscolden
Hey everyone
I have been trying my best to get this working and I cant, I have written my own remote code and added it to /etc/lirc/lircd.conf.d and name it RGB.lirc.conf.i am trying to control my RGB led light throw OH2 installed on RPI3 with LIRC and it works fine when I send I receive on terminal ssh, I have followed the openhab2 guide for addon LIrc as Binding and here is what my files looks like and not sure what im missing, im new to coding and all this stuff… THANKS in advance for any help
rule "Temote"
when
Item GF_Remote received command
then
if (receivedCommand == 1)
{
lirc.apply("RGB", "KEY_R", logName)
}
else
{
lirc.apply("RGB", "KEY_B", logName)
}
end
I don’t have sitemaps file for this and I am trying to use Habpanel in the future and maybe paperUI for now… everything on terminal works fine even the echo command, with the files I have I don’t have a switch so im wondering if I need one and how ? please help me fix this ?
It looks like you’re trying to use a lambda expression in your rule, but you haven’t defined it anywhere. If you want to get this working without the lambda, you can use this for your rule:
rule "Temote"
when
Item GF_Remote received command
then
if (receivedCommand == 1)
{
sendCommand(Remote_RGB, "KEY_R")
}
else
{
sendCommand(Remote_RGB, "KEY_B")
}
end
I tried this and still not working.
i am only trying to press a button from HABPANEL to switch my LED LIGHT to different color . i don’t seem to have the right code yet. i have my things discovered my RGB remote and i added things to be a button and when i press it nothing happens. do i need Switch in my item file instead String ??
thanks in advanced for any help