lovelace-remote-card
这是一个通用的电视(机顶盒)遥控器卡片, 可以自定义设置额外的按钮
用 js
类型安装 remote.js
.
resources:
url: /community_plugin/lovelace-remote/remote-card.js
type: js
使用
增加这个卡片到你的Yaml或者UI编辑器
- type: custom:lovelace-remote-card
vibrate: true
entity: device_tracker.cc_b8_a8_01_ca_43
circle:
ok:
topic: homeassistant/remote/JMGO
up:
topic: homeassistant/remote/JMGO
payload: up
down:
topic: homeassistant/remote/JMGO
payload: down
left:
topic: homeassistant/remote/JMGO
payload: left
right: script.tap
left_buttons:
- entity: qmtt.retu
topic: homeassistant/remote/JMGO
payload: retu
icon: mdi:keyboard-return
- entity: qmtt.on
topic: homeassistant/remote/JMGO
payload: "on"
icon: mdi:power
- entity: qmtt.home
topic: homeassistant/remote/JMGO
payload: home
icon: mdi:home
- entity: qmtt.menu
topic: homeassistant/remote/JMGO
payload: "menu"
icon: mdi:menu
- entity: qmtt.volmin
topic: homeassistant/remote/JMGO
payload: volmin
icon: mdi:volume-minus
- entity: qmtt.volmax
topic: homeassistant/remote/JMGO
payload: "volmax"
icon: mdi:volume-plus
属性
circle
可以使用mqtt
和script
,格式严格按照示例
up
上
down
下
left
左
right
右
ok
确认
left_buttons
左侧按钮支持mqtt
,script
和switch
可以添加任意数量,但是建议在6或者8个,为的是UI的和谐.mqtt
格式严格按照示例
vibrate
(选项)设置按钮震动反馈是否开启True/False
entity
(选项) 可以指定设备的追踪ID,一般是路由器最终,判断电视是否在线
坚果投影仪mqtt流程
把坚果控制指令广播
里面的IP地址换成你自己的, 投影仪设置成静态IP
另外我投影仪的开机是使用的小米空调伴侣的红外线.
[{"id":"603650a3.813fc","type":"tcp out","z":"8520d970.354d88","host":"192.168.1.59","port":"9005","beserver":"client","base64":false,"end":false,"name":"坚果控制指令广播","x":590,"y":340,"wires":[]},{"id":"32e425b9.1724fa","type":"function","z":"8520d970.354d88","name":"指令","func":"var msg1={},msg2={},msg3={}\n\nvar left = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x15\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x15\\x10\\x00\"]\nvar right = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x16\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x16\\x10\\x00\"]\nvar up = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x13\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x13\\x10\\x00\"]\nvar ok = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x17\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x17\\x10\\x00\"]\nvar down = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x14\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x14\\x10\\x00\"]\nvar retu = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x04\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x04\\x10\\x00\"]\nvar home = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x03\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x03\\x10\\x00\"]\nvar volmin = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x19\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x19\\x10\\x00\"]\nvar volmax = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x18\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x18\\x10\\x00\"]\nvar menu = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x52\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x52\\x10\\x00\"]\nvar v3d = [\"\\x09\\x12\\x07\\x0a\\x05\\x08\\xde\\x04\\x10\\x01\",\"\\x09\\x12\\x07\\x0a\\x05\\x08\\xde\\x04\\x10\\x00\"]\nvar focusmin = [\"\\x09\\x12\\x07\\x0a\\x05\\x08\\xd9\\x04\\x10\\x01\",\"\\x09\\x12\\x07\\x0a\\x05\\x08\\xd9\\x04\\x10\\x00\"]\nvar focusmix = [\"\\x09\\x12\\x07\\x0a\\x05\\x08\\xda\\x04\\x10\\x01\",\"\\x09\\x12\\x07\\x0a\\x05\\x08\\xda\\x04\\x10\\x00\"]\nvar nit = [\"\\x09\\x12\\x07\\x0a\\x05\\x08\\xdd\\x04\\x10\\x01\",\"\\x09\\x12\\x07\\x0a\\x05\\x08\\xdd\\x04\\x10\\x00\"] //亮度\nvar n1 = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x08\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x08\\x10\\x00\"]\nvar n2 = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x09\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x09\\x10\\x00\"]\nvar n3 = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x0a\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x0a\\x10\\x00\"]\nvar n4 = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x0b\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x0b\\x10\\x00\"]\nvar n5 = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x0c\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x0c\\x10\\x00\"]\nvar n6 = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x0d\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x0d\\x10\\x00\"]\nvar n7 = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x0e\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x0e\\x10\\x00\"]\nvar n8 = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x0f\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x0f\\x10\\x00\"]\nvar n9 = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x10\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x10\\x10\\x00\"]\nvar n0 = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x07\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x07\\x10\\x00\"]\nvar del = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x43\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x43\\x10\\x00\"]\nvar off = [\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x1a\\x10\\x01\",\"\\x08\\x12\\x06\\x0a\\x04\\x08\\x1a\\x10\\x00\"]\nvar text = \"\\x1f\\x12\\x1d\\x22\\x1b\\x0a\\x14\\x63\\x6f\\x6d\\x2e\\x67\\x6f\\x6f\\x67\\x6c\\x65\\x2e\\x74\\x76\\x2e\\x73\\x74\\x72\\x69\\x6e\\x67\"+\"内容\"\n\nvar zl = msg.payload;\nif(zl===\"on\"){\n msg3.payload = \"on\";\n}\nif(zl===\"off\"){\n msg1.payload= off[0];\n msg2.payload= off[1];\n}\nif(zl===\"up\"){\n msg1.payload= up[0];\n msg2.payload= up[1];\n}\nif(zl===\"down\"){\n msg1.payload= down[0];\n msg2.payload= down[1];\n}\nif(zl===\"left\"){\n msg1.payload= left[0];\n msg2.payload= left[1];\n}\nif(zl===\"right\"){\n msg1.payload= right[0];\n msg2.payload= right[1];\n}\nif(zl===\"ok\"){\n msg1.payload= ok[0];\n msg2.payload= ok[1];\n}\nreturn [msg1,msg2,msg3];\n\n","outputs":3,"noerr":0,"x":370,"y":360,"wires":[["603650a3.813fc"],["603650a3.813fc"],["938dcbca.b8cc78"]]},{"id":"87bf4608.a9e9f8","type":"mqtt in","z":"8520d970.354d88","name":"坚果遥控输入","topic":"homeassistant/remote/JMGO","qos":"2","datatype":"auto","broker":"ef098148.c8cb9","x":170,"y":360,"wires":[["32e425b9.1724fa","3c92b3cc.ad2f4c"]]},{"id":"ff74b526.f54108","type":"inject","z":"8520d970.354d88","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":440,"wires":[["32e425b9.1724fa"]]},{"id":"3c92b3cc.ad2f4c","type":"debug","z":"8520d970.354d88","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":380,"y":460,"wires":[]},{"id":"938dcbca.b8cc78","type":"switch","z":"8520d970.354d88","name":"红外线开机","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":570,"y":400,"wires":[["6589e65a.64d0f8"]]},{"id":"6589e65a.64d0f8","type":"api-call-service","z":"8520d970.354d88","name":"开机","server":"9a56e1b1.84865","version":1,"service_domain":"climate","service":"xiaomi_miio_send_command","entityId":"climate.zhu_wo_kong_diao","data":"{\"command\":\"FE000000000000000000000000070026224D003700A900E101C2037C127225704300000000000000010100000101000000000000000100000001010101000101010542064205FF\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":730,"y":400,"wires":[[]]},{"id":"ef098148.c8cb9","type":"mqtt-broker","z":"","name":"mqtt服务器","broker":"192.168.1.14","port":"1883","clientid":"nodered","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"9a56e1b1.84865","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]