小米电视局域网控制API分享

今天,在NR里准备做电视与功放的自动化联动流程的时候,突然觉得应该拿到小米电视局域网控制api,虽然io或者hass本身都有小米电视的节点,但是据我所知,并不好用,所以索性拿到api,来用NR直接控制,效率更高,反应更快,出现问题的概率也更低。

好了,先来个示意图

节点分享如下:

[{"id":"e416228f.73db4","type":"http request","z":"6107880d.ece008","name":"增大音量","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.3.23:6095/controller?action=keyevent&keycode=volumeup","tls":"","proxy":"","authType":"basic","x":440,"y":80,"wires":[[]]},{"id":"76932be7.8ef474","type":"inject","z":"6107880d.ece008","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":80,"wires":[["e416228f.73db4"]]},{"id":"6c8ad3fc.b29cbc","type":"http request","z":"6107880d.ece008","name":"减小音量","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.3.23:6095/controller?action=keyevent&keycode=volumedown","tls":"","proxy":"","authType":"basic","x":440,"y":120,"wires":[[]]},{"id":"3438fc5d.0dd9a4","type":"inject","z":"6107880d.ece008","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":120,"wires":[["6c8ad3fc.b29cbc"]]},{"id":"a0e5fbf1.0f0a08","type":"http request","z":"6107880d.ece008","name":"电源","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.3.23:6095/controller?action=keyevent&keycode=power","tls":"","proxy":"","authType":"basic","x":430,"y":160,"wires":[[]]},{"id":"3a9d795d.45cbe6","type":"inject","z":"6107880d.ece008","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":160,"wires":[["a0e5fbf1.0f0a08"]]},{"id":"4421cbbd.6de674","type":"http request","z":"6107880d.ece008","name":"上","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.3.23:6095/controller?action=keyevent&keycode=up","tls":"","proxy":"","authType":"basic","x":430,"y":200,"wires":[[]]},{"id":"b706ef93.bdbd8","type":"inject","z":"6107880d.ece008","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":200,"wires":[["4421cbbd.6de674"]]},{"id":"f8d98218.04e58","type":"http request","z":"6107880d.ece008","name":"下","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.3.23:6095/controller?action=keyevent&keycode=down","tls":"","proxy":"","authType":"basic","x":430,"y":240,"wires":[[]]},{"id":"3a4592eb.fb6bde","type":"inject","z":"6107880d.ece008","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":240,"wires":[["f8d98218.04e58"]]},{"id":"2214abc1.efa044","type":"http request","z":"6107880d.ece008","name":"左","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.3.23:6095/controller?action=keyevent&keycode=left","tls":"","proxy":"","authType":"basic","x":430,"y":280,"wires":[[]]},{"id":"7876040.a522ffc","type":"inject","z":"6107880d.ece008","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":280,"wires":[["2214abc1.efa044"]]},{"id":"cf4937d5.e69488","type":"http request","z":"6107880d.ece008","name":"右","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.3.23:6095/controller?action=keyevent&keycode=right","tls":"","proxy":"","authType":"basic","x":430,"y":320,"wires":[[]]},{"id":"5be9c126.f3fb7","type":"inject","z":"6107880d.ece008","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":320,"wires":[["cf4937d5.e69488"]]},{"id":"4a6575be.412c9c","type":"http request","z":"6107880d.ece008","name":"确定","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.3.23:6095/controller?action=keyevent&keycode=enter","tls":"","proxy":"","authType":"basic","x":430,"y":360,"wires":[[]]},{"id":"45907aa8.f3fd44","type":"inject","z":"6107880d.ece008","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":360,"wires":[["4a6575be.412c9c"]]},{"id":"e7e7f7d0.3e1658","type":"http request","z":"6107880d.ece008","name":"返回","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.3.23:6095/controller?action=keyevent&keycode=back","tls":"","proxy":"","authType":"basic","x":430,"y":400,"wires":[[]]},{"id":"47a085cc.6712dc","type":"inject","z":"6107880d.ece008","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":400,"wires":[["e7e7f7d0.3e1658"]]},{"id":"99a29e74.31d61","type":"http request","z":"6107880d.ece008","name":"菜单","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.3.23:6095/controller?action=keyevent&keycode=menu","tls":"","proxy":"","authType":"basic","x":430,"y":440,"wires":[[]]},{"id":"658f2577.b514ac","type":"inject","z":"6107880d.ece008","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":440,"wires":[["99a29e74.31d61"]]},{"id":"9dec8ec3.e4ab","type":"http request","z":"6107880d.ece008","name":"主页","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.3.23:6095/controller?action=keyevent&keycode=home","tls":"","proxy":"","authType":"basic","x":430,"y":480,"wires":[[]]},{"id":"9438b4d9.228e38","type":"inject","z":"6107880d.ece008","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":480,"wires":[["9dec8ec3.e4ab"]]},{"id":"f3d935f4.263d08","type":"comment","z":"6107880d.ece008","name":"小米电视控制API","info":"","x":220,"y":40,"wires":[]}]

刚准备要睡觉,突然想起来有个地方需要补充,又爬起来打开电脑把坑填完吧。。。其实稍微有点道行的大佬就应该会知道有个地方需要根据个人情况修改。

如图所示:

请各位仙友一定要把红框这里的IP地址改成你们自己家小米电视的ip地址。。切记,只改ip就好,端口号什么的都不要动。

如果你要觉得对你有用的话,请点个赞吧。。。

这个牛逼啊

1 个赞

牛逼!好用,能否分享一些其他场景,这个只能打开。无法收到是否打开或是关闭。在HA里怎么引用呢

Error: Input not a JSON Array
无法导入。大神这个怎么弄

格式有问题???

不知道。新手。论坛有挺多分享都是导入有问题

数据迁移出了问题。留言看看作者会不会重新提供吧

标记一下,一会儿处理

标注一下,一会试试

还是用不了。什么时候给处理一下

我不是分享了一个小米盒子或者电视接入homekit的流么?一样的。你拿来改改就是了

我找看。谢谢大神

用不了啊,大神帮忙解决一下

要把自己的问题详细描述出来。这样才会有人看看是否可以帮助到你

修改好了 ,你试试 @YeLuo @ilongjiang

请问大佬如何拿到别的品牌电视的api啊

如果是可以用手机APP控制的,那么,你手机装个抓包软件,你手动APP控制电视,看看对应功能的的控制命令是啥

我想问一下大佬,如果电视不能app控制,有没有什么办法实现ios自带遥控器控制安卓电视?目前我看到两个思路,①ha有个安卓tv的adb命令,可以控制电视,然后通过node red实现对应关系。但是苦于我是小白,所以通过redmatic-homekit创建一个tv以后,后续不懂如何通过按遥控器来唤醒ha的具体adb命令。②第二种就是找到这个电视交互的api然后再映射到ios的遥控器按钮。大佬能否指点一下哪种可行,然后给个思路

adb命令应该可以,你去hassbian论坛看看有没有这个教程,我印象中看过

想问问大佬如何注册hassbian,上面的文章好多都要会员才能看:sob: