请选择 进入手机版 | 继续访问电脑版

『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 215|回复: 2

[经验分享] 【音频之路篇二】NR控制Volumio

[复制链接]

7

主题

255

帖子

939

积分

版主

Rank: 7Rank: 7Rank: 7

积分
939
金钱
684
HASS币
0
发表于 2019-9-29 13:09:06 | 显示全部楼层 |阅读模式
本帖最后由 whxciotw 于 2019-9-29 13:55 编辑

1. 起因
    近日在做Volumio音乐播放器,遇到一个很小、但也很实际的障碍:无法远程关闭Volumio客户端,仅能通过断电关闭。
    在Homeassistant中可以通过media组件接入,但仍不支持关闭功能。
    在NR中查找,有volumio节点,遂安装、调试。

2. 实现及作用
    Volumio安装、NR节点安装、设置IP等都很简单,略过。
   
    该节点与HA media组件的区别,是可以调用更多的api接口、实现更多的功能如睡眠关机等;详细的websocket api可以参考官方文档,其列出的api均可调用。
   
[{"id":"b1509528.23b768","type":"volumio event","z":"ec0b3231.4baca","server":"423bd89d.5877f8","event":"pushState","x":180,"y":120,"wires":[["a1fe5d60.84a9e"]]},{"id":"c29e1835.638668","type":"inject","z":"ec0b3231.4baca","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":220,"wires":[["133e90c2.cd096f"]]},{"id":"133e90c2.cd096f","type":"function","z":"ec0b3231.4baca","name":"pause","func":"msg.payload = {}\nmsg.payload.event= 'pause'\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":220,"wires":[["860c8ddd.effff"]]},{"id":"e11c8c61.97bbf","type":"function","z":"ec0b3231.4baca","name":"play","func":"msg.payload = {}\nmsg.payload.event= 'play'\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":300,"wires":[["860c8ddd.effff"]]},{"id":"ef9a5e3b.80dd","type":"inject","z":"ec0b3231.4baca","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":300,"wires":[["e11c8c61.97bbf"]]},{"id":"d52881b7.8780a","type":"function","z":"ec0b3231.4baca","name":"volume 50","func":"msg.payload = {}\nmsg.payload.event= 'volume'\nmsg.payload.data= 50\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":400,"wires":[["860c8ddd.effff"]]},{"id":"c29785f0.87f698","type":"inject","z":"ec0b3231.4baca","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":400,"wires":[["d52881b7.8780a"]]},{"id":"58e9469f.53a918","type":"function","z":"ec0b3231.4baca","name":"sleep","func":"msg.payload = {}\nmsg.payload.event= "setSleep"\nmsg.payload.pushEvent= "pushSleep"\nmsg.payload.data= {}\nmsg.payload.data.enable= true\nmsg.payload.data.time= '00:01'\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":480,"wires":[["860c8ddd.effff"]]},{"id":"305ef955.108f26","type":"inject","z":"ec0b3231.4baca","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":480,"wires":[["58e9469f.53a918"]]},{"id":"860c8ddd.effff","type":"volumio command","z":"ec0b3231.4baca","server":"423bd89d.5877f8","x":780,"y":340,"wires":[[]]},{"id":"a1fe5d60.84a9e","type":"debug","z":"ec0b3231.4baca","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":430,"y":120,"wires":[]},{"id":"423bd89d.5877f8","type":"volumio-server","z":"","host":"192.168.19.5","port":"3000"}]

3. 参考资料
    https://flows.nodered.org/node/node-red-contrib-volumio
    https://volumio.github.io/docs/API/WebSocket_APIs.html



2.JPG
1.JPG

评分

参与人数 2金钱 +40 收起 理由
+ 20 膜拜大神!
咸味土豆 + 20 大神666!

查看全部评分

回复

使用道具 举报

105

主题

3621

帖子

1万

积分

管理员

囧死

Rank: 9Rank: 9Rank: 9

积分
11654
金钱
7953
HASS币
44
发表于 2019-9-30 11:35:14 | 显示全部楼层
阳春白雪,曲高和寡啊
回复

使用道具 举报

7

主题

255

帖子

939

积分

版主

Rank: 7Rank: 7Rank: 7

积分
939
金钱
684
HASS币
0
 楼主| 发表于 2019-9-30 12:13:36 | 显示全部楼层
囧 发表于 2019-9-30 11:35
阳春白雪,曲高和寡啊

都是巨人的肩膀
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2019-10-23 04:04 , Processed in 0.107857 second(s), 25 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表