- Platform information:
- Hardware: RPI3
- OS: OpenHabian
- openHAB version: 2.5.2
I’m trying to control my LG TV with the help of the RS232 serial port in the TV. I made a RX/TX crossover cable and with the help of a USB<>Serial adapter I got it working with my PC and a terminal.
I first tried the “LG TV Serial Binding” but this did nothing. I found a tread about the binding not working with 2.5.2. So I went on trying to accomplice my goal with the Serial binding.
I’m so far that I can change volume and turn the TV off. Bud I can’t get it to turn on again. With my pc directly connected it turn on but OpenHab won’t. I’m just trying random things now so I don’t know where to look anymore.
Can someone point my in the right direction?
This is wat I’m using right now:
Items:
Switch VolummeUp
Switch VolummeDown
Switch PowerTV "Tv power"
String SerialData "Data van de serial binding" { serial="/dev/ttyUSB0@9600,CHARSET(ASCII)"}
Rule:
rule "TvSerialData"
when
Item SerialData received update
then
logInfo("TV control", "Serial data: {}" , SerialData.state)
if (SerialData.state == "a 01 OK01x"){
logInfo("TV control", "TV aan")
SerialData.sendCommand("")
//sendCommand (SerialData , "\n")
}
else if (SerialData.state == "a 01 OK00x"){
logInfo("TV control", "TV uit")
SerialData.sendCommand("")
//sendCommand (SerialData , "\n")
}
else if (SerialData.state == ""){
}
else
{
createTimer(now.plusSeconds(1)) [
//sendCommand (SerialData , SerialData.state)
]
}
//SerialData.sendCommand("")
//sendCommand (SerialData , "\n")
end
rule "TvAan"
when
Item PowerTV received update
then
if (PowerTV.state == ON){
//sendCommand (SerialData , "\n")
sendCommand (SerialData , "ka 01 01\n")
}
else if (PowerTV.state == OFF){
sendCommand (SerialData , "ka 01 00\n")
//sendCommand (SerialData , "")
//SerialData.postUpdate("ka 01 00")
}
end
rule "Volume up"
when
Item VolummeUp received update
then
logInfo("TV control", "Vol UP")
sendCommand (SerialData , "mc 01 02\n")
end
Thank you in advance!
Greetings,
Sander