I was also looking for Panasonic TV binding on openHAB 3, but as it’s discontinued so far I’ve ended up with replacement for sending key events implemented in HTTP binding. It does not include discovery, but with making TV IP static works for me.
See here for details
-
http.things:
Thing http:url:panasonictv "HTTP: Panasonic TV - keys" [
baseURL="http://10.0.0.118:55000/nrc/control_0/",
commandMethod="POST",
contentType="text/xml;charset=utf-8",
headers="Accept=text/xml",
"SOAPAction=\"urn:panasonic-com:service:p00NetworkControl:1#X_SendKey\""] {
Channels:
Type string:send_key "Key" [
mode="WRITEONLY",
commandTransformation="JS:panasonictv_keyevent_body.js"
]
}
where of course 10.0.0.118
need to be replaced with IP of your TV and transformation file ‘panasonictv_keyevent_body.js’ looks as follows:
(function(key) {
var NRC_KEY_CODES_MAPPING = {
"POWER" : "NRC_POWER-ONOFF", // power off only (on tested TV)
"MUTE" : "NRC_MUTE-ONOFF",
"TV_INPUT" : "NRC_AD_CHANGE-ONOFF", // dvbt input change
"AV_INPUT" : "NRC_CHG_INPUT-ONOFF", // hdmi input change
"VOLDOWN" : "NRC_VOLDOWN-ONOFF",
"VOLUP" : "NRC_VOLUP-ONOFF",
"VOLUP_ON" : "NRC_VOLUP-ON",
"VOLUP_OFF" : "NRC_VOLUP-OFF",
"CH_DOWN" : "NRC_CH_DOWN-ONOFF",
"CH_UP" : "NRC_CH_UP-ONOFF",
"APPS" : "NRC_APPS-ONOFF",
"HOME" : "NRC_HOME-ONOFF",
"EXIT" : "NRC_CANCEL-ONOFF",
"RIGHT" : "NRC_RIGHT-ONOFF",
"LEFT" : "NRC_LEFT-ONOFF",
"DOWN" : "NRC_DOWN-ONOFF",
"UP" : "NRC_UP-ONOFF",
"OK" : "NRC_ENTER-ONOFF", // return button
"BACK" : "NRC_RETURN-ONOFF",
"OPTION" : "NRC_SUBMENU-ONOFF",
"3D" : "NRC_3D-ONOFF",
"ASPECT" : "NRC_DISP_MODE-ONOFF", // aspect ratio button
"MENU" : "NRC_MENU-ONOFF",
"GUIDE" : "NRC_EPG-ONOFF",
"TEXT" : "NRC_TEXT-ONOFF",
"STTL" : "NRC_STTL-ONOFF",
"INFO" : "NRC_INFO-ONOFF",
"EHELP" : "NRC_GUIDE-ONOFF", // e-help button
"1" : "NRC_D1-ONOFF",
"2" : "NRC_D2-ONOFF",
"3" : "NRC_D3-ONOFF",
"4" : "NRC_D4-ONOFF",
"5" : "NRC_D5-ONOFF",
"6" : "NRC_D6-ONOFF",
"7" : "NRC_D7-ONOFF",
"8" : "NRC_D8-ONOFF",
"9" : "NRC_D9-ONOFF",
"0" : "NRC_D0-ONOFF",
"LAST_VIEW" : "NRC_R_TUNE-ONOFF",
"BLUE" : "NRC_BLUE-ONOFF",
"YELLOW" : "NRC_YELLOW-ONOFF",
"GREEN" : "NRC_GREEN-ONOFF",
"RED" : "NRC_RED-ONOFF",
"REW" : "NRC_REW-ONOFF",
"PLAY" : "NRC_PLAY-ONOFF",
"FF" : "NRC_FF-ONOFF",
"SKIP_PREV" : "NRC_SKIP_PREV-ONOFF",
"PAUSE" : "NRC_PAUSE-ONOFF",
"SKIP_NEXT" : "NRC_SKIP_NEXT-ONOFF",
"STOP" : "NRC_STOP-ONOFF",
"REC" : "NRC_REC-ONOFF"
}
var soapBody =
'<?xml version="1.0" encoding="utf-8"?>' +
'<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">' +
'<s:Body>' +
'<u:X_SendKey xmlns:u="urn:panasonic-com:service:p00NetworkControl:1">'+
'<X_KeyEvent>'+NRC_KEY_CODES_MAPPING[key]+'</X_KeyEvent>' +
'</u:X_SendKey>'+
'</s:Body>'+
'</s:Envelope>'
return soapBody
})(input)
Then item declaration:
String PanasonicTV_Remote "TV remote" { channel="http:url:panasonictv:send_key", autoupdate="false"}
and used as follows in the sitemap:
Switch item=PanasonicTV_Remote label="" mappings=["LEFT"="◄","UP"="▲", "DOWN"="▼", "RIGHT"="►"] icon="none"
Switch item=PanasonicTV_Remote label="" mappings=["OK"="OK", "BACK"="Back"] icon="none"
Switch item=PanasonicTV_Remote label="" mappings=["APPS"="APPS", "HOME"="HOME", "EXIT"="EXIT","MENU"="Menu"] icon="none"
or in rules:
PanasonicTV_Remote.sendCommand("AV_INPUT")
PanasonicTV_Remote.sendCommand("OK")