• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

hdmvide/Homebridge-SwitchSound

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

hdmvide/Homebridge-SwitchSound

开源软件地址:

https://github.com/hdmvide/Homebridge-SwitchSound

开源编程语言:

JavaScript 100.0%

开源软件介绍:

SwitchSound

SwitchSound is a plugin that offers the possibility to create buttons that activate the playback of audio files present locally. Each button is linked (and will play) a single audio file or a folder of audio files in shuffle. In the latter case, pressing the button will randomly select and play one of the audio files present in the specified path. For each button you can adjust the volume of the audio playback. The volume cannot be adjusted during playback but only before pressing the button.

Install Omxplayer

Log in ssh to the raspberry and install omxplayer with this command. Omxplayer is the music player that will play your sounds.

sudo apt-get install omxplayer

Upload your sounds on Pi

Log in ssh to the raspberry and create a folder "sounds" in this path:

/home/pi/

To create folders and transfer your audio files, you can use an SFTP application. I use Cyberduck. https://cyberduck.io/

How use SwitchSound

After installing the player and uploaded our favorite sounds, let's create the Homekit buttons corresponding to our audio files. Let's open the Homebridge configuration and create the new SwitchSound platform as follows:

{
    "platform": "SwitchSound",
    "name": "SwitchSound",
    "debug": false,
    "defaultSoundPlayer": "/usr/bin/omxplayer.bin",
    "accessories": [
        {
            "accessory": "SwitchSound",
            "id": "000000000001",
            "name": "Server Pronto",
            "soundFile": "/home/pi/sounds/restart/",
            "soundOptions": [],
            "shuffle": 1,
            "loop": false,
            "volume": 66,
            "debug": false,
            "sequence": false
        },
        {
            "accessory": "SwitchSound",
            "id": "000000000002",
            "name": "Allarme",
            "soundFile": "/home/pi/sounds/varie/AlarmSound2.mp3",
            "soundOptions": [],
            "loop": false,
            "volume": 66,
            "debug": false,
            "sequence": false
        }
    ]
}

Parameters

  • accessory <string> required: identifies the accessory. It must always be SwitchSound
  • id <string> required: identifies the serial code of the accessory. You can write whatever you want
  • name <string> required: identifies the name of the button that will appear in HomeKit
  • soundFile <string> required: identifies the path of the audio file to be connected and playing. In case of multiple files in shuffle, you can stop at the folder
  • soundOptions <string> optional: For the more experienced, it is possible to pass additional parameters to omxplayer
  • shuffle <bool> optional: activates shuffle mode. In this case it is necessary to indicate the path of a folder within the soundFile parameter
  • loop <bool> optional: play the audio file endlessly until the user turns off the button from HomeKit
  • volume <int> required: It is necessary to indicate a starting volume (0-100)
  • debug <bool> optional: enable debug mode with more output instructions
  • sequence <bool> optional: offers the possibility to play an audio file several times consecutively. Useful for short audio files

Permissions

If the playback of your audio files does not work, it may be necessary to assign permissions to the user with whom you started homebridge (if different from pi).

Run these commands:

sudo passwd INSERT_YOUR_USERNAME_HOMEBRIDGE
sudo usermod -a -G video INSERT_YOUR_USERNAME_HOMEBRIDGE

Now reboot your raspberry.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
tay1orjones/dotfiles: 发布时间:2022-06-17
下一篇:
markeissler/homebrew-hyperkit: Brew formula for Hyperkit发布时间:2022-06-17
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap