查看“蓝牙音频”的源代码
←
蓝牙音频
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
== 使用蓝牙音箱 == Goal is to use a bluetooth (BT) speaker to let domoticz talk. This setup should also be usable for music purposes, which is the first step to take. I used a 'Mini-X6U' speaker and a brandless usb BT stick Use [http://www.domoticz.com/forum/viewtopic.php?f=28&t=7563 this forum topic] for support === 安装蓝牙支持 === 升级系统 <syntaxhighlight lang="bash"> sudo apt-get update sudo apt-get upgrade </syntaxhighlight> 列出已连接的usb设备 ('''without''' BT audio stick connected) <syntaxhighlight lang="bash"> lsusb </syntaxhighlight> Insert BT USB stick <syntaxhighlight lang="bash"> lsusb </syntaxhighlight> When you compare this to the previous 'lsusb' output you should see your bluetooth stick (mine is 'Bus 001 Device 006: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)') Install needed packages for bluetooth support (required 156 mb on my system and took 5 minutes on Pi2 and approx. 20 minutes on PiB) <syntaxhighlight lang="bash"> sudo apt-get install bluetooth bluez bluez-utils bluez-alsa </syntaxhighlight> (this also installs printer support etc.) Set user rights for bluetooth <syntaxhighlight lang="bash"> sudo usermod -a -G lp root </syntaxhighlight> (root might not be needed....) <syntaxhighlight lang="bash"> sudo usermod -a -G lp pi </syntaxhighlight> Edit the bluetooth audio configuration sudo nano /etc/bluetooth/audio.conf Find the [General] section and locate the following: <syntaxhighlight lang="bash"> # If we want to disable support for specific services # Defaults to supporting all implemented services #Disable=Control,Source </syntaxhighlight> Change to: <syntaxhighlight lang="bash"> # If we want to disable support for specific services # Defaults to supporting all implemented services #Disable=Control,Source Enable=Source,Sink,Socket Disable=Media </syntaxhighlight> reboot the system (from domoticz or 'sudo reboot') === Pair bluetooth speaker and enable audio === (First try without the next step, it was in the instructions I used, but does not seem to be needed, please remove from this instruction when not needed) 'sudo hciconfig hci0 up' Enable your bluetooth speaker (power-on) and find the speaker <syntaxhighlight lang="bash"> hcitool scan </syntaxhighlight> my result: <syntaxhighlight lang="bash"> Scanning ... 30:22:10:00:52:5C Mini-X6U </syntaxhighlight> Start pairing (use your mac address, and your device pincode (in my case 0000 ) <syntaxhighlight lang="bash"> bluetooth-agent --adapter hci0 0000 30:22:10:00:52:5C </syntaxhighlight> resulting in "Agent has been released" <syntaxhighlight lang="bash"> bluetooth-agent hci0 30:22:10:00:52:5C </syntaxhighlight> Trust the device for future use <syntaxhighlight lang="bash"> bluez-test-device trusted 30:22:10:00:52:5C yes </syntaxhighlight> Check the trust: <syntaxhighlight lang="bash"> bluez-test-device trusted 30:22:10:00:52:5C </syntaxhighlight> when this returns 1 everything is ok Create the audio settings file (this file is needed for every user): nano ~/.asoundrc <syntaxhighlight lang="bash"> pcm.bluetooth { type bluetooth device 30:22:10:00:52:5C # change this MAC address to your speakers address profile "auto" } </syntaxhighlight> Restart the bluetooth engine <syntaxhighlight lang="bash"> sudo /etc/init.d/bluetooth restart </syntaxhighlight> === Install mediaplayer === Install mplayer (64mb, 1 or 2 minutes on Pi2) <syntaxhighlight lang="bash"> sudo apt-get install mplayer </syntaxhighlight> edit the mplayer configuration file to prevent loading lyrics (which is not needed and reports errors on my machine sudo nano /etc/mplayer/mplayer.conf and add (top top) <syntaxhighlight lang="bash"> nolirc=yes </syntaxhighlight> === Play MP3 using mediaplayer === <syntaxhighlight lang="bash"> mplayer -ao alsa:device=bluetooth /media/networkshare/BackupPI/TOOL_FORTY_SIX_2_DRUM_COVER_BY_MEYTAL_COHEN.mp3 -softvol -volume 10 -af resample=22100:0:0 </syntaxhighlight> This command executes the mplayer, changes output to bluetooth, used the mp3 file specified, specifies to use sofware controlled volume control, sets volume to 10 (=10%) and resamples to avoid filling the buffer === Use from within domoticz === This chapter is still empty [[Category:Domoticz]] [[Category:设置]] [[Category:硬件]] [[Category:媒体]] [[Category:音频]] [[Category:蓝牙]] [[Category:脚本]] [[Category:Bash]] [[Category:树莓派]]
返回
蓝牙音频
。
导航菜单
个人工具
登录
命名空间
页面
讨论
大陆简体
查看
阅读
查看源代码
查看历史
更多
搜索
导航
Wiki首页
Domoticz 中文站
Domoticz 论坛
Domoticz Github
随机页面
特殊页面
特殊页面
所有页面
分类
最近更改
工具
链入页面
相关更改
特殊页面
页面信息