用户
 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

4

主题

5

帖子

1836

积分

金牌会员

Rank: 6Rank: 6

积分
1836
2019-9-6 21:57:21 dodojie 金牌会员 楼主 2241
本文为dodojie原创文章,未经许可,严禁转载!
如经许可转载时务必注明原作者dodojie及原始链接,并注明“发表于ioBroker中国”,转载不得对作品进行修改。 https://bbs.iobroker.cn/thread-327-1-1.html
本帖最后由 dodojie 于 2019-9-6 23:46 编辑

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

好了,先来个示意图

QQ图片20190906214453.png

节点分享如下:
[AppleScript] 纯文本查看 复制代码
[{"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":[]}]


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


如图所示:
QQ图片20190906234303.png

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

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

使用道具 举报 回复
这个牛逼啊
使用道具 举报 回复 支持 反对
牛逼!好用,能否分享一些其他场景,这个只能打开。无法收到是否打开或是关闭。在HA里怎么引用呢
使用道具 举报 回复 支持 反对
发新帖
您需要登录后才可以回帖 登录 | 立即注册