Ok so it’s on 9001 for some reason. Maybe i’m running an old version but mine defaults to 8765 as per the docs for lirc.
Try this then
echo “SEND_ONCE harman-kardon KEY_POWER” | nc localhost 9001
Ok so it’s on 9001 for some reason. Maybe i’m running an old version but mine defaults to 8765 as per the docs for lirc.
Try this then
echo “SEND_ONCE harman-kardon KEY_POWER” | nc localhost 9001
I’ve tried this, too, but nothing happened. @ei_Gelb_Geek informed me right now, that I’m running lircd 0.9.0-pre1 - does this change anything ?
So i’m running 0.9.0~pre1-1.2
It’s started using init.d unfortunately, I should really replace that.
i did specify the port --listen=8765
Lets try adding --listen=8765 in your service file, don’t forget to reload, and then restart it. then see if its listening on 8765.
Also if it is listening.
nc localhost 9001
Should show blank but not return to the shell prompt
Then type
SEND_ONCE harman-kardon KEY_POWER <enter>
should see something like this…
nc localhost 8765
SEND_ONCE technika32 KEY_POWER
BEGIN
SEND_ONCE technika32 KEY_POWER
SUCCESS
END
I changed it right now and restarted the whole pi - safe is safe. Now, netstat -lptn delivers the same stuff as before: port 9001. Is it right, that my .service file is there: /usr/lib/systemd/system/lirc.service ? Seems that this does not react…
When changing the service file you need to do sudo systemctl daemon-reload
I did
sudo nano /usr/lib/systemd/system/lirc.service
Is this ok? Askd me for a password and then I could change the file.
yeah thats fine but you still need to issue the daemon-reload command
I can’t understand why netstat delivers the same …
see above
sudo systemctl daemon-reload
in the directory /usr/lib/systemd/system/?
any directory
ok did it. yeah, see this:
tcp 0 0 0.0.0.0:9001 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:8765 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN -
tcp6 0 0 :::139 :::* LISTEN -
tcp6 0 0 :::5007 :::* LISTEN -
tcp6 0 0 :::8080 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 :::8443 :::* LISTEN -
tcp6 0 0 :::445 :::* LISTEN -
tcp6 0 0 127.0.0.1:44353 :::* LISTEN -
tcp6 0 0 :::9124 :::* LISTEN -
tcp6 0 0 127.0.0.1:8101 :::* LISTEN -
Crazy !!! echo ‘SEND_ONCE harman-kardon KEY_POWER’ | nc localhost 8765 works also, now !!
Ok interesting I wonder if you had something else running on 9001 and you were getting a conflict.
Test using
nc localhost 8765
then typing your SEND_ONCE command and hitting enter
Guy, you are a god, openhab works also !!!
Cool, port conflict you have something else running on 9001, see it’s still in the list.
Now change your openhab server config to 8765
SEND_ONCE harman-kardon KEY_POWER
BEGIN
SEND_ONCE harman-kardon KEY_POWER
SUCCESS
END
Everything’s working ! Including the controlling in openhab !! Oh my god, I thank you so much !
your very welcome. Now it’s just a matter of tweaking your rules and sitemap to your liking.
Let me know if you have any problems.
Hi there again,
I thought about making a rule that makes a sequence of different commands, in my case: Turn the receiver on and navigate through the home screen of my Apple TV, click on Netflix and start a movie.
In sitemaps, everything works great. In the rule “Sheldon” all commands are executes many times. There is something like a permanent rule that can only stop by updating the files. When I only write one single operation in the rule, this works. When writing two or more commands, they were permanently repeated. It seems that the Threat sleep has something to do with the interval of the repeats.
Can anyone help me, maybe you, @chriscolden, again ?
Thank you !
The rule looks like this:
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
The rule of the virtual remote in sitemap is:
import org.eclipse.xtext.xbase.lib.Functions
val logName = "Media"
val Functions$Function3<String, String, String, Boolean> lirc= [ r, k, ln |
logInfo(ln, "LIRC Send " + r + " " + k)
sendCommand("Remote_" + r, k)
true
]
rule "Harman Kardon"
when
Item HarmanKardon received command
then
if (receivedCommand == 1) lirc.apply("harman_kardon", "KEY_POWER", logName)
if (receivedCommand == 2) lirc.apply("harman_kardon", "KEY_POWER2", logName)
.....
if (receivedCommand == 10) lirc.apply("appletv", "KEY_UP", logName)
if (receivedCommand == 11) lirc.apply("appletv", "KEY_DOWN", logName)
if (receivedCommand == 12) lirc.apply("appletv", "KEY_LEFT", logName)
if (receivedCommand == 13) lirc.apply("appletv", "KEY_RIGHT", logName)
if (receivedCommand == 14) lirc.apply("appletv", "KEY_MENU", logName)
......
end
The items file is:
Switch Remote_Send { channel="exec:command:remote-send:run" }
String Remote_Send_Args { channel="exec:command:remote-send:input"}
String Remote_Send_Out { channel="exec:command:remote-send:output" }
Group remotes
Number HarmanKardon "" <none> (gLounge) { autoupdate="false" }
String Remote_harman_kardon { channel="lirc:remote:local:harman-kardon:transmit" }
Number appletv "" <none> (gLounge) { autoupdate="false" }
String Remote_appletv { channel="lirc:remote:local:appletv:transmit" }
Number fernseher "" <none> (gLounge) { autoupdate="false" }
String Remote_fernseher { channel="lirc:remote:local:fernseher:transmit" }
Number ledstrip "" <none> (gLounge) { autoupdate="false" }
String Remote_ledstrip { channel="lirc:remote:local:ledstrip:transmit" }
The things file is:
Bridge lirc:bridge:local [ host="***myIP***", port="8765" ] {
Thing remote harman-kardon [ remote="Harman-Kardon" ]
Thing remote appletv [ remote="appletv" ]
Thing remote fernseher [ remote="fernseher" ]
Thing remote ledstrip [ remote="ledstrip" ]
}