這片文章主要是拜讀以下幾篇文章生出來的東西

  1. 極米投影機的相關api
  2. HA 、博聯Broadlinl RM Mini4風與火的交會二_讓電視轉身實現Homekit TV
  3. node-red-contrib-homekit-bridged/wiki/Television-Service

以下設定有問題也可以回來這些地方看看,

這篇只有極米雷射電視的遙控,

如果要再增加其他的電視盒控制也可以由此類推。

 

首先在packages建立一個xgimi.yaml

binary_sensor:
  - platform: ping
    host: 192.168.0.167 #極米投影機ip
    name: "xgimi_on_off"
    count: 1
    scan_interval: 10

然後要先在home assisatnt安裝node-red,

並導入程式碼,

這部份不會的話可以參考上面第二個連結

image

程式碼下載連結

程式碼:

[{"id":"193ef564.684623","type":"tab","label":"XGIMI","disabled":false,"info":""},{"id":"5ef1036b.a09064","type":"inject","z":"193ef564.684623","name":"TV on","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"Active\":1}","payloadType":"json","x":490,"y":220,"wires":[["c797e2ba.51097"]]},{"id":"ee2c8ab5.610ec8","type":"inject","z":"193ef564.684623","name":"TV off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"Active\":0}","payloadType":"json","x":490,"y":260,"wires":[["c797e2ba.51097"]]},{"id":"f5810db9.3ab9b","type":"debug","z":"193ef564.684623","name":"Volume output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1640,"y":1080,"wires":[]},{"id":"951e2b44.542af8","type":"inject","z":"193ef564.684623","name":"TV Setup","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":500,"y":160,"wires":[["4a28d024.d64998"]]},{"id":"8a085a09.969f7","type":"inject","z":"193ef564.684623","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":420,"y":620,"wires":[["d07eb006.4b6f68"]]},{"id":"4a28d024.d64998","type":"function","z":"193ef564.684623","name":"Setup TV","func":"var name = \"XGIMI\";\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":680,"y":160,"wires":[["c797e2ba.51097"]]},{"id":"b45d18c8.ec71d","type":"inject","z":"193ef564.684623","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":490,"y":380,"wires":[["c797e2ba.51097"]]},{"id":"fbe1cc7d.dca91","type":"inject","z":"193ef564.684623","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":490,"y":340,"wires":[["c797e2ba.51097"]]},{"id":"a351aed4.5af608","type":"inject","z":"193ef564.684623","name":"Input 2","props":[{"p":"payload","v":"{\"ActiveIdentifier\":2}","vt":"json"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"ActiveIdentifier\":2}","payloadType":"json","x":490,"y":420,"wires":[["c797e2ba.51097"]]},{"id":"cc683e88.413bd","type":"inject","z":"193ef564.684623","name":"Input 3","props":[{"p":"payload","v":"{\"ActiveIdentifier\":3}","vt":"json"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"ActiveIdentifier\":3}","payloadType":"json","x":490,"y":460,"wires":[["c797e2ba.51097"]]},{"id":"d07eb006.4b6f68","type":"function","z":"193ef564.684623","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 = \"Home\";\nvar input1 = \"Youtube\";\nvar input2 = \"MOD\";\nvar input3 = \"Digital TV\";\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 = OTHER;\nvar input2type = OTHER;\nvar input3type = APPLICATION;\n\n// Duplicate or remove sets if you have more or fewer inputs\nvar msg0={};\nvar msg1={};\nvar msg2={};\nvar 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};\nmsg2.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\nreturn [msg0,msg1,msg2,msg3];","outputs":4,"noerr":0,"initialize":"","finalize":"","x":630,"y":620,"wires":[["2d4b00.3e03b5"],["efedc5ef.8d2798"],["9366feb3.836398"],["79217d31.72bfdc"]]},{"id":"c797e2ba.51097","type":"homekit-service","z":"193ef564.684623","isParent":true,"bridge":"f6a4260d.7e51e","parentService":"","name":"XGIMI","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":870,"y":220,"wires":[["896211fa.a9987"],["74027a23.ff8ef4","5a11d2c3.437144"]]},{"id":"5bfb7f6a.8344c8","type":"homekit-service","z":"193ef564.684623","isParent":false,"bridge":"f6a4260d.7e51e","parentService":"c797e2ba.51097","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,\"Mute\":true}","waitForSetupMsg":false,"outputs":2,"x":1330,"y":1000,"wires":[[],["f5810db9.3ab9b","8718a6de.2d6f5"]]},{"id":"2d4b00.3e03b5","type":"homekit-service","z":"193ef564.684623","isParent":false,"bridge":"","parentService":"c797e2ba.51097","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":860,"y":600,"wires":[[],[]]},{"id":"efedc5ef.8d2798","type":"homekit-service","z":"193ef564.684623","isParent":false,"bridge":"","parentService":"c797e2ba.51097","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":860,"y":660,"wires":[[],[]]},{"id":"9366feb3.836398","type":"homekit-service","z":"193ef564.684623","isParent":false,"bridge":"","parentService":"c797e2ba.51097","name":"Input 2","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":860,"y":720,"wires":[[],[]]},{"id":"79217d31.72bfdc","type":"homekit-service","z":"193ef564.684623","isParent":false,"bridge":"","parentService":"c797e2ba.51097","name":"Input 3","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":860,"y":780,"wires":[[],[]]},{"id":"8ff04730.1af6a","type":"inject","z":"193ef564.684623","name":"find out what Characteristics","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"foo\":\"bar\"}","payloadType":"json","x":1120,"y":920,"wires":[["5bfb7f6a.8344c8"]]},{"id":"896211fa.a9987","type":"switch","z":"193ef564.684623","name":"Active","property":"payload.Active","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1110,"y":160,"wires":[[],["31f9065.968d67a"]]},{"id":"74027a23.ff8ef4","type":"switch","z":"193ef564.684623","name":"ActiveIdentifier","property":"payload.ActiveIdentifier","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"},{"t":"eq","v":"3","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":1160,"y":260,"wires":[["8bd45601.346ef"],["5c08ccd9.939f84"],["c069f16d.f2213","3165a5d7.57a10a"],["8edc2b1f.1d2498"]]},{"id":"8718a6de.2d6f5","type":"switch","z":"193ef564.684623","name":"Volume","property":"payload.VolumeSelector","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1640,"y":1020,"wires":[["2589b4da.22bc34"],["2c76a3d3.5e00fc"]]},{"id":"5a11d2c3.437144","type":"switch","z":"193ef564.684623","name":"RemoteKey","property":"payload.RemoteKey","propertyType":"msg","rules":[{"t":"eq","v":"4","vt":"str"},{"t":"eq","v":"5","vt":"str"},{"t":"eq","v":"6","vt":"str"},{"t":"eq","v":"7","vt":"str"},{"t":"eq","v":"8","vt":"str"},{"t":"eq","v":"9","vt":"str"},{"t":"eq","v":"11","vt":"str"},{"t":"eq","v":"15","vt":"str"}],"checkall":"true","repair":false,"outputs":8,"x":1190,"y":760,"wires":[["8a525653.71aa18"],["cbff070f.a6c0e8"],["2b8142ed.3dca36"],["d0f46323.5919f8"],["2dd76b7.0af7e14"],["512467d1.0aee3"],["e9ff3f29.ab3d48"],["6deaba9b.398444"]]},{"id":"2589b4da.22bc34","type":"change","z":"193ef564.684623","name":"vol+","rules":[{"t":"set","p":"payload","pt":"msg","to":"KEYPRESSES:115","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1860,"y":1020,"wires":[["ab0aa3f0.6b2af"]]},{"id":"2c76a3d3.5e00fc","type":"change","z":"193ef564.684623","name":"vol-","rules":[{"t":"set","p":"payload","pt":"msg","to":"KEYPRESSES:114","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1860,"y":1060,"wires":[["ab0aa3f0.6b2af"]]},{"id":"8bd45601.346ef","type":"change","z":"193ef564.684623","name":"Home","rules":[{"t":"set","p":"payload","pt":"msg","to":"KEYPRESSES:35","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1410,"y":220,"wires":[["ab0aa3f0.6b2af"]]},{"id":"8a525653.71aa18","type":"change","z":"193ef564.684623","name":"up","rules":[{"t":"set","p":"payload","pt":"msg","to":"KEYPRESSES:36","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1480,"y":620,"wires":[["ab0aa3f0.6b2af"]]},{"id":"cbff070f.a6c0e8","type":"change","z":"193ef564.684623","name":"down","rules":[{"t":"set","p":"payload","pt":"msg","to":"KEYPRESSES:38","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1480,"y":660,"wires":[["ab0aa3f0.6b2af"]]},{"id":"2b8142ed.3dca36","type":"change","z":"193ef564.684623","name":"left","rules":[{"t":"set","p":"payload","pt":"msg","to":"KEYPRESSES:50","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1480,"y":700,"wires":[["ab0aa3f0.6b2af"]]},{"id":"d0f46323.5919f8","type":"change","z":"193ef564.684623","name":"right","rules":[{"t":"set","p":"payload","pt":"msg","to":"KEYPRESSES:37","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1480,"y":740,"wires":[["ab0aa3f0.6b2af"]]},{"id":"512467d1.0aee3","type":"change","z":"193ef564.684623","name":"back","rules":[{"t":"set","p":"payload","pt":"msg","to":"KEYPRESSES:48","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1490,"y":840,"wires":[["ab0aa3f0.6b2af"]]},{"id":"e9ff3f29.ab3d48","type":"change","z":"193ef564.684623","name":"play/pause","rules":[{"t":"set","p":"payload","pt":"msg","to":"KEYPRESSES:49","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1510,"y":880,"wires":[["ab0aa3f0.6b2af"]]},{"id":"2dd76b7.0af7e14","type":"change","z":"193ef564.684623","name":"select","rules":[{"t":"set","p":"payload","pt":"msg","to":"KEYPRESSES:49","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1490,"y":800,"wires":[["ab0aa3f0.6b2af"]]},{"id":"6deaba9b.398444","type":"change","z":"193ef564.684623","name":"menu","rules":[{"t":"set","p":"payload","pt":"msg","to":"KEYPRESSES:35","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1490,"y":920,"wires":[["ab0aa3f0.6b2af"]]},{"id":"31f9065.968d67a","type":"change","z":"193ef564.684623","name":"power on/off","rules":[{"t":"set","p":"payload","pt":"msg","to":"KEYPRESSES: 116","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1290,"y":160,"wires":[["ab0aa3f0.6b2af"]]},{"id":"ab0aa3f0.6b2af","type":"udp out","z":"193ef564.684623","name":"port:16735","addr":"192.168.0.167","iface":"","port":"16735","ipv":"udp4","outport":"","base64":false,"multicast":"false","x":1970,"y":160,"wires":[]},{"id":"c069f16d.f2213","type":"api-call-service","z":"193ef564.684623","name":"Netflix","server":"149c12be.d3cc1d","version":1,"debugenabled":false,"service_domain":"script","service":"turn_on","entityId":"script.mod_info","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1410,"y":320,"wires":[[]]},{"id":"8edc2b1f.1d2498","type":"change","z":"193ef564.684623","name":"HDMI2","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"action\":20000,\"controlCmd\":{\"data\":\"HDMI2\",\"delayTime\":0,\"mode\":5,\"time\":0,\"type\":0},\"msgid\":\"2\"}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1410,"y":420,"wires":[["f27bf62c.1c8e28"]]},{"id":"3165a5d7.57a10a","type":"change","z":"193ef564.684623","name":"HDMI1","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"action\":20000,\"controlCmd\":{\"data\":\"HDMI1\",\"delayTime\":0,\"mode\":5,\"time\":0,\"type\":0},\"msgid\":\"2\"}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1410,"y":380,"wires":[["f27bf62c.1c8e28"]]},{"id":"5c08ccd9.939f84","type":"change","z":"193ef564.684623","name":"Youtube","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"action\":20000,\"controlCmd\":{\"data\":\"com.liskovsoft.videomanager\",\"delayTime\":0,\"mode\":7,\"time\":0,\"type\":1},\"msgid\":\"2\"}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1420,"y":280,"wires":[["f27bf62c.1c8e28"]]},{"id":"f27bf62c.1c8e28","type":"udp out","z":"193ef564.684623","name":"port:16750","addr":"192.168.0.167","iface":"","port":"16750","ipv":"udp4","outport":"","base64":false,"multicast":"false","x":1640,"y":280,"wires":[]},{"id":"22c35fbe.8f216","type":"debug","z":"193ef564.684623","name":"State and source output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1310,"y":40,"wires":[]},{"id":"cfa6ed2c.e4fa7","type":"server-state-changed","z":"193ef564.684623","name":"XGIMI status","server":"d06297cb.c4f038","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.xgimi_on_off","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":480,"y":60,"wires":[["5fd17f66.09a56"]]},{"id":"5fd17f66.09a56","type":"change","z":"193ef564.684623","name":"轉換","rules":[{"t":"change","p":"topic","pt":"msg","from":"binary_sensor.xgimi_on_off","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"on","fromt":"str","to":"{\"Active\":1}","tot":"json"},{"t":"change","p":"payload","pt":"msg","from":"off","fromt":"str","to":"{\"Active\":0}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":80,"wires":[["22c35fbe.8f216","c797e2ba.51097"]]},{"id":"f6a4260d.7e51e","type":"homekit-bridge","bridgeName":"Television Bridge","pinCode":"111-11-111","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},{"id":"149c12be.d3cc1d","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"d06297cb.c4f038","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true}]

分幾個區塊來講解一下匯入後node-red後要修改的內容

1. 匯入後node-red裡的XGIMI要點2下更新

Untitled 3.png

Untitled 4.png

2. 接下來要實現homekit按鍵切換hdmi作用

IMG_FC22E2D38EEA-1.jpeg

Untitled 2.png

input 0,1,2,3就會顯示Home(首頁),投影機的youtube(需安裝smart youtube app), MOD(HDMI1),Digital TV(HDMI2),

 

當我選擇不同的項目,

XGIMI投影機就會切換首頁或不同的HDMI,

這裡要點開set up inputs設定名稱。

image

 

3. 接下來設定開關機,

因為極米投影機無法送電就開機,

我又不想只關投影讓機器繼續跑,

所以還是用遙控器開機,

開關機的狀態用剛剛xgimi.yaml的ping去判斷

image

off的部份就參考下圖。

image

msg.payload就是用來輸出udp指令,

port 16735,16750這種灰色的按鍵都是要指定接收指令的極米投影機,

所以必須點開來更改自己投影機的ip

image

4. 然後設定input 1,2,3的動作

input 0的部份我是設定首頁

input 1是投影機的smart youtube app,

payload是{"action":20000,"controlCmd":{"data":"com.liskovsoft.videomanager","delayTime":0,"mode":7,"time":0,"type":1},"msgid":"2"}

也可以到資料夾andriod/data查詢其他的app自行設定。

image

input 2我有設定一個腳本會讓遙控器操控mod電視盒打開Netflix,

然後會讓極米投影機切到HDMI1,

input 3則是HDMI2了。

image

 

5. 接著是遙控器的上下左右、菜單、選擇等等。

 

image

6. 最後這個區塊是用來調整音量大小,

當iphone開啟遙控器時,

手機的音量鍵就可以控制投影機音量。

image

television speaker,input0,1,2,3要點開來Parent Service選擇XGIMI

Untitled 6.png

修改完要部屬

image

最後home assistant會產生一個QR code讓homekit加入,

加入碼是111-11-111

 

 


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 派西 的頭像
    派西

    與蟲鳥和鳴的田間歲月

    派西 發表在 痞客邦 留言(1) 人氣()