Old Panasonic Viera TV to HomeKit

Link an Old Panasonic Viera TV to Apple Home.

Bridges the viera commands into apple home as a Television

Build around the television example from "node-red-contrib-homekit-bridged" their wiki contains the original example.

Built using:

  • node-red-contrib-homekit-bridged
  • node-red-contrib-toggle
  • node-red-contrib-viera
[{"id":"a9e569de.eb508","type":"inject","z":"e4f44eac.21085","name":"TV on","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"Active\":1}","payloadType":"json","x":850,"y":580,"wires":[["93bc492d.3d6848"]]},{"id":"250f61e5.cdbe8e","type":"inject","z":"e4f44eac.21085","name":"TV off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"Active\":0}","payloadType":"json","x":850,"y":620,"wires":[["93bc492d.3d6848"]]},{"id":"db46bcc.eec00c","type":"debug","z":"e4f44eac.21085","name":"on set State and source output","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1350,"y":640,"wires":[]},{"id":"d01e0a4e.49da68","type":"debug","z":"e4f44eac.21085","name":"Volume output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1620,"y":940,"wires":[]},{"id":"26b7c791.d278","type":"inject","z":"e4f44eac.21085","name":"TV Setup","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":860,"y":520,"wires":[["404e9088.92a208"]]},{"id":"2028cd20.56072a","type":"inject","z":"e4f44eac.21085","name":"Source Setup","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":true,"onceDelay":"6","topic":"","payload":"","payloadType":"date","x":860,"y":980,"wires":[["ab0cd2f6.17b038"]]},{"id":"404e9088.92a208","type":"function","z":"e4f44eac.21085","name":"Setup TV","func":"var name = \"Television\";\n\nmsg.payload = {\n \"ConfiguredName\": name,\n \"ActiveIdentifier\" : 0,\n \"SleepDiscoveryMode\" : 0,\n \"Active\" : 0\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1040,"y":520,"wires":[["93bc492d.3d6848"]]},{"id":"8e8be1d8.38174","type":"inject","z":"e4f44eac.21085","name":"Input 1","props":[{"p":"payload","v":"{\"ActiveIdentifier\":1}","vt":"json"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"ActiveIdentifier\":1}","payloadType":"json","x":850,"y":740,"wires":[["93bc492d.3d6848"]]},{"id":"27b2cba.39cb534","type":"inject","z":"e4f44eac.21085","name":"Input 0","props":[{"p":"payload","v":"{\"ActiveIdentifier\":0}","vt":"json"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"ActiveIdentifier\":0}","payloadType":"json","x":850,"y":700,"wires":[["93bc492d.3d6848"]]},{"id":"ab0cd2f6.17b038","type":"function","z":"e4f44eac.21085","name":"Set up inputs","func":"// This function will initialize and name inputs\n// it is set to work with 4 inputs\n\n// INPUT SOURCE NAMES\nvar input0 = \"HDMI 1\";\nvar input1 = \"HDMI 2\";\n//var input2 = \"Apple TV\";\n//var input3 = \"Wii U\";\n\n// INPUT SOURCE TYPES\nvar OTHER = 0;\nvar HOME_SCREEN = 1;\nvar TUNER = 2;\nvar HDMI = 3;\nvar COMPOSITE_VIDEO = 4;\nvar S_VIDEO = 5;\nvar COMPONENT_VIDEO = 6;\nvar DVI = 7;\nvar AIRPLAY = 8;\nvar USB = 9;\nvar APPLICATION = 10;\n\n// Configure your input types based on options above\nvar input0type = HDMI;\nvar input1type = HDMI;\n//var input2type = HDMI;\n//var input3type = COMPOSITE_VIDEO;\n\n\n// Duplicate or remove sets if you have more or fewer inputs\nvar msg0={};\nvar msg1={};\n//var msg2={};\n//var msg3={};\n\nmsg0.payload = {\n    \"Identifier\": 0,\n    \"IsConfigured\" : 1,\n    \"ConfiguredName\": input0,\n    \"InputSourceType\": input0type\n};\nmsg1.payload = {\n    \"Identifier\": 1,\n    \"IsConfigured\" : 1,\n    \"ConfiguredName\": input1,\n    \"InputSourceType\": input1type\n};\n/*msg2.payload = {\n    \"Identifier\": 2,\n    \"IsConfigured\" : 1,\n    \"ConfiguredName\": input2,\n    \"InputSourceType\": input2type\n};\nmsg3.payload = {\n    \"Identifier\": 3,\n    \"IsConfigured\" : 1,\n    \"ConfiguredName\" : input3,\n    \"InputSourceType\" : input3type\n};\n*/\n//return [msg0,msg1,msg2,msg3];\nreturn [msg0,msg1];","outputs":2,"noerr":0,"initialize":"","finalize":"","x":1070,"y":980,"wires":[["8ff895bc.7b935"],["f74be9ff.fa82a8"]]},{"id":"93bc492d.3d6848","type":"homekit-service","z":"e4f44eac.21085","isParent":true,"hostType":"0","bridge":"f6a4260d.7e51e","parentService":"","name":"Television Example","serviceName":"Television","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","firmwareRev":"","hardwareRev":"","softwareRev":"","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{    \"RemoteKey\":null}","waitForSetupMsg":false,"outputs":2,"x":1270,"y":580,"wires":[[],["db46bcc.eec00c","e69e3eb8.17175"]]},{"id":"983c3244.9dfbe8","type":"homekit-service","z":"e4f44eac.21085","isParent":false,"hostType":"0","bridge":"f6a4260d.7e51e","parentService":"93bc492d.3d6848","name":"Television Speaker","serviceName":"TelevisionSpeaker","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","firmwareRev":"","hardwareRev":"","softwareRev":"","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{    \"VolumeControlType\":1,    \"VolumeSelector\":true}","waitForSetupMsg":false,"outputs":2,"x":1290,"y":840,"wires":[[],["d01e0a4e.49da68","99e5ba.096d8a48"]]},{"id":"8ff895bc.7b935","type":"homekit-service","z":"e4f44eac.21085","isParent":false,"hostType":"0","bridge":"","parentService":"93bc492d.3d6848","name":"Input 0","serviceName":"InputSource","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","firmwareRev":"","hardwareRev":"","softwareRev":"","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","waitForSetupMsg":false,"outputs":2,"x":1300,"y":960,"wires":[[],[]]},{"id":"f74be9ff.fa82a8","type":"homekit-service","z":"e4f44eac.21085","isParent":false,"hostType":"0","bridge":"","parentService":"93bc492d.3d6848","name":"Input 1","serviceName":"InputSource","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","firmwareRev":"","hardwareRev":"","softwareRev":"","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","waitForSetupMsg":false,"outputs":2,"x":1300,"y":1020,"wires":[[],[]]},{"id":"290e6f89.cfc1e","type":"comment","z":"e4f44eac.21085","name":"homkit <-> panasonic map","info":"HomeKit HAP\n{\"RemoteKey\":0} REWIND\n{\"RemoteKey\":1} FAST_FORWARD\n{\"RemoteKey\":2} NEXT_TRACK\n{\"RemoteKey\":3} PREVIOUS_TRACK\n{\"RemoteKey\":4} ARROW_UP\n{\"RemoteKey\":5} ARROW_DOWN\n{\"RemoteKey\":6} ARROW_LEFT\n{\"RemoteKey\":7} ARROW_RIGHT\n{\"RemoteKey\":8} SELECT\n{\"RemoteKey\":9} BACK\n{\"RemoteKey\":10} EXIT\n{\"RemoteKey\":11} PLAY_PAUSE\n{\"RemoteKey\":15} INFORMATION\n\n{\"VolumeSelector\":0} VOLUME_UP\n{\"VolumeSelector\":1} VOLUME_DOWN\n\n{\"Active\":0} POWER_OFF\n{\"Active\":1} POWER_ON\n\n\n\nWrite value to viera TV.\n\nCommands:\n\nCH_DOWN - channel down\nCH_UP - channel up\nVOLUP - volume up\nVOLDOWN - volume down\nPOWER - Power off\nMUTE - mute\nTV - TV\nCHG_INPUT - AV\nHOME - Home screen\nAPPS - Apps\nGUIDE - Guide\nRED - red\nGREEN - green\nYELLOW - yellow\nBLUE - blue\nVTOOLS - VIERA tools\nCANCEL - Cancel / Exit\nSUBMENU - Option\nRETURN - Return\nENTER - Control Center click / enter\nRIGHT - Control RIGHT\nLEFT - Control LEFT\nUP - Control UP\nDOWN - Control DOWN\n3D - 3D button\nSD_CARD - SD-card\nDISP_MODE - Display mode / Aspect ratio\nMENU - Menu\nINTERNET - VIERA connect\nVIERA_LINK - VIERA link\nEPG - Guide / EPG\nTEXT - Text / TTV\nSTTL - STTL / Subtitles\nINFO - info\nINDEX - TTV index\nHOLD - TTV hold / image freeze\nR_TUNE - Last view\n\nREW - rewind\nPLAY - play\nFF - fast forward\nSKIP_PREV - skip previous\nPAUSE - pause\nSKIP_NEXT - skip next\nSTOP - stop\nREC - record\n\nnumeric buttons\nD1 D2 D3 D4 D5 D6 D7 D8 D9 D0\n\nP_NR - P-NR (Noise reduction)\nOFFTIMER - off timer\nR_TUNE - Seems to do the same as INFO\n\nothers (depends on type of your TV)\nCHG_NETWORK\nCC\nSAP\nRECLIST\nDRIVE\nDATA\nBD\nFAVORITE\nDIGA_CTL\nVOD\nECO\nGAME\nEZ_SYNC\nPICTAI\nMPX\nSPLIT\nSWAP\nR_SCREEN\n30S_SKIP\nPROG\nTV_MUTE_ON\nTV_MUTE_OFF\nDMS_CH_UP\nDMS_CH_DOWN","x":1790,"y":680,"wires":[]},{"id":"3e442b57.b1cac4","type":"viera write","z":"e4f44eac.21085","name":"sendCommand","host":"192.168.1.17","function":"sendCommand","x":2060,"y":553,"wires":[]},{"id":"7ad36317.99c66c","type":"debug","z":"e4f44eac.21085","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2050,"y":500,"wires":[]},{"id":"e69e3eb8.17175","type":"json","z":"e4f44eac.21085","name":"","property":"payload","action":"","pretty":false,"x":1410,"y":500,"wires":[["240c7a4b.3aaad6"]]},{"id":"3c8e128.67d8eee","type":"change","z":"e4f44eac.21085","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"{\"RemoteKey\":0}","fromt":"str","to":"REW","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"{\"RemoteKey\":1}","fromt":"str","to":"FF","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"{\"RemoteKey\":2}","fromt":"str","to":"SKIP_NEXT","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"{\"RemoteKey\":3}","fromt":"str","to":"SKIP_PREV","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"{\"RemoteKey\":4}","fromt":"str","to":"UP","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"{\"RemoteKey\":5}","fromt":"str","to":"DOWN","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"{\"RemoteKey\":6}","fromt":"str","to":"LEFT","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"{\"RemoteKey\":7}","fromt":"str","to":"RIGHT","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"{\"RemoteKey\":8}","fromt":"str","to":"ENTER","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"{\"RemoteKey\":9}","fromt":"str","to":"RETURN","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"{\"RemoteKey\":10}","fromt":"str","to":"CANCEL","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"{\"RemoteKey\":11}","fromt":"str","to":"NULL","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"{\"RemoteKey\":15}","fromt":"str","to":"MENU","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1750,"y":500,"wires":[["3e442b57.b1cac4","7ad36317.99c66c"]]},{"id":"240c7a4b.3aaad6","type":"switch","z":"e4f44eac.21085","name":"","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"{\"RemoteKey\":11}","vt":"str"},{"t":"eq","v":"{\"RemoteKey\":11}","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1550,"y":500,"wires":[["3c8e128.67d8eee"],["3f580eb.e7574f2"]]},{"id":"3f580eb.e7574f2","type":"toggle","z":"e4f44eac.21085","name":"play pause","onOffTopic":"","onValue":"PLAY","onType":"str","offValue":"PAUSE","offType":"str","toggleTopic":"","toggleValue":"","toggleType":"any","passOnOff":"","x":1770,"y":600,"wires":[["3e442b57.b1cac4","c73e92b3.e7368"]]},{"id":"c73e92b3.e7368","type":"debug","z":"e4f44eac.21085","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2050,"y":600,"wires":[]},{"id":"6dcadcb7.ab6214","type":"change","z":"e4f44eac.21085","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"{\"VolumeSelector\":1}","fromt":"str","to":"VOLDOWN","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"{\"VolumeSelector\":0}","fromt":"str","to":"VOLUP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1660,"y":840,"wires":[["13ba5ce2.e1dd73","8630b3f0.f9e88"]]},{"id":"13ba5ce2.e1dd73","type":"viera write","z":"e4f44eac.21085","name":"sendCommand","host":"192.168.1.17","function":"sendCommand","x":1880,"y":800,"wires":[]},{"id":"8630b3f0.f9e88","type":"debug","z":"e4f44eac.21085","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1890,"y":860,"wires":[]},{"id":"99e5ba.096d8a48","type":"json","z":"e4f44eac.21085","name":"","property":"payload","action":"","pretty":false,"x":1490,"y":840,"wires":[["6dcadcb7.ab6214"]]},{"id":"eaea305c.80847","type":"comment","z":"e4f44eac.21085","name":"not doing anything to the TV currently","info":"","x":1540,"y":1020,"wires":[]},{"id":"f6a4260d.7e51e","type":"homekit-bridge","bridgeName":"Television Wiki","pinCode":"321-32-321","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","firmwareRev":"","hardwareRev":"","softwareRev":"","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":false}]

Flow Info

Created 3 years, 11 months ago
Rating: not yet rated

Actions

Rate:

Node Types

Core
  • change (x2)
  • comment (x2)
  • debug (x5)
  • function (x2)
  • inject (x6)
  • json (x2)
  • switch (x1)
Other

Tags

  • viera
  • homekit
  • toggle
  • home
  • apple
  • panasonic
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option