資料介紹
軟件簡介
homebridge-rusty-spotify
Spotify plugin for Homebridge written in Rust. The plugin requires a Spotify Premium account.
Installation and Setup
-
Install Homebridge:
sudo npm install -g homebridge
-
Install the plugin:
sudo npm install -g homebridge-rusty-spotify
- Register the plugin as app in the Spotify Developer Dashboard
- Configure the plugin using the generated client ID and client secret (see Configuration)
Configuration
The generate_config
script can be used to generate the config. It requires for the client_id
, client_secret
and Spotify username
needs to be set since those are required to authenticate to the Spotify Web API. To run the script, make sure to have Python 3 and the spotipy library installed.
Running the script will open a web browser asking to authenticate to Spotify which is required to retrieve the refresh_token
.
$ ./generate_config --help
usage: generate_config [-h] [--client_id CLIENT_ID]
[--client_secret CLIENT_SECRET]
[--redirect_uri REDIRECT_URI] [--username USERNAME]
Script to retrieve an access and refresh token for using the Spotify API
optional arguments:
-h, --help show this help message and exit
--client_id CLIENT_ID, --client-id CLIENT_ID
Spotify client ID
--client_secret CLIENT_SECRET, --client-secret CLIENT_SECRET
Spotify client secret
--redirect_uri REDIRECT_URI, --redirect-uri REDIRECT_URI
Redirect URI
--username USERNAME Spotify username
$ ./generate_config --client_id=<client_id> --client_secret=<client_secret> --username=<username>
{
"platform": "Spotify",
"name": "Spotify",
"service_type": "light", // "light" or "speaker"; Speaker is not supported by HomeKit
"client_id": "" ,
"client_secret": "" ,
"refresh_token": ""
}
The generated config needs to copied to the Homebridge config file (e.g. ~/.homebridge/config.json
). For example:
//...
"platforms": [
{
"platform": "Spotify",
"name": "Spotify",
"service_type": "light", // "light" or "speaker"; Speaker is not supported by HomeKit
"client_id": "" ,
"client_secret": "" ,
"refresh_token": "" ,
}
]
//...
service_type
specifies whether Spotify devices should use the Lightbulb or Speaker service. If service_type
is not specified, "light"
will be used by default. HomeKit currently does not support Speaker services and will show "This accessory is not certified and may not work reliably with HomeKit".
Usage
Add the plugin in the Home app. The plugin will automatically discover available Spotify devices and add them as accessories. Turning a Spotify accessory on will resume playing music on the device, turning off the accessory will pause the music. The accessory also allows to change the playback volume.
Accessories get refreshed every 10 seconds (or as specified in the configuration file).
Development
-
Install the Rust toolchain,
wasm-pack
,cargo-generate
andnpm
by following this guide - Clone the repository
-
Run
make
-
This will create a
pkg/
directory containing all the generated nodejs files
-
This will create a
- Copy the generated files to a device/directory that can be discovered by Homebridge
-
Switch to the directory and run
npm install
to install all required dependencies -
Run Homebridge in debug mode and specify the directory with the plugin files:
DEBUG=* homebridge -D -P /path/to/plugin/homebridge-rusty-spotify
A blog post about writing plugins for Homebridge and specifically this plugin has been published here.
- 用于樹莓派與PIR傳感器連接成運(yùn)動傳感器的homebridge插件
- Homebridge插件集成Shinobi
- 用于Away的homebridge插件
- Homebridge的Loxone插件
- Homebridge Pi恒溫器插件
- 米家安防攝像頭Homebridge插件
- Homebridge插件可在Apple HomeKit中使用RuuviTags
- homebridge示例插件示例集合
- homebridge-smartthings SmartThings插件
- homebridge miio平臺插件
- 熱門的homebridge插件列表
- 將Wyze連接家庭設(shè)備支持添加到Homebridge的插件
- Homebridge-Denon-Marantz-AVR插件
- Homebridge GPIO WiringPi平臺插件
- Rust 1.15 引入自定義derive特性有什么做用
- 從Rustup出發(fā)看Rust編譯生態(tài) 557次閱讀
- 如何編寫高性能的Rust代碼 868次閱讀
- Rust的標(biāo)準(zhǔn)庫的功能劃分 1328次閱讀
- Rust語言如何與 InfluxDB 集成 1207次閱讀
- Rust GUI實踐之Rust-Qt模塊 1629次閱讀
- Rust的 match 語句用法 937次閱讀
- Rust GUI實踐之Tarui模塊 6165次閱讀
- 基于Rust的Log日志庫介紹 3536次閱讀
- Rust構(gòu)建QEMU插件的框架 934次閱讀
- Rust開源社區(qū)推出龍架構(gòu)原生適配版本 526次閱讀
- 使用C++編寫通用庫并在 Rust 中使用它 (WASI) 1133次閱讀
- Rust的內(nèi)部工作原理 822次閱讀
- 以調(diào)試Rust的方式來學(xué)習(xí)Rust 932次閱讀
- 介紹一種二維碼生成工具 818次閱讀
- 用Rust語言開發(fā)微服務(wù) 2738次閱讀
下載排行
本周
- 1UHV系列雷電沖擊電壓發(fā)生器試驗裝置詳細(xì)說明使用
- 1.07 MB | 16次下載 | 免費(fèi)
- 2介紹一些常用的電子元器件
- 3.20 MB | 4次下載 | 免費(fèi)
- 3RS-485收發(fā)器CMT83086的高可靠性全雙工隔離特性及其應(yīng)用
- 888.28 KB | 2次下載 | 免費(fèi)
- 4PNE20080EPE超快恢復(fù)整流器規(guī)格書
- 275.29KB | 1次下載 | 免費(fèi)
- 5半導(dǎo)體存儲電路講課資料
- 17.38 MB | 1次下載 | 免費(fèi)
- 6RS-485高可靠性隔離半雙工收發(fā)器CMT83085/CMT83087的技術(shù)規(guī)范及應(yīng)用場景
- 0.99 MB | 1次下載 | 免費(fèi)
- 7適用于3級電動汽車充電站的雙向雙有源電橋參考設(shè)計
- 6.26 MB | 1次下載 | 免費(fèi)
- 8STM32系列產(chǎn)品選型-中文
- 1.81 MB | 1次下載 | 免費(fèi)
本月
- 1DeepSeek:從入門到精通
- 5.36 MB | 75次下載 | 1 積分
- 2OAH0428最新規(guī)格書(中文)
- 2.52 MB | 27次下載 | 10 積分
- 3UHV系列雷電沖擊電壓發(fā)生器試驗裝置詳細(xì)說明使用
- 1.07 MB | 16次下載 | 免費(fèi)
- 4麻將機(jī)升降電路
- 0.12 MB | 5次下載 | 1 積分
- 5中興通訊的PCB設(shè)計規(guī)范
- 23.03 MB | 5次下載 | 5 積分
- 6Altium-常用3D封裝庫(Step)接插件篇
- 4.95 MB | 5次下載 | 免費(fèi)
- 7PNE20040CPE-Q雙共陰極超快恢復(fù)整流器規(guī)格書
- 275.16KB | 4次下載 | 免費(fèi)
- 8介紹一些常用的電子元器件
- 3.20 MB | 4次下載 | 免費(fèi)
總榜
- 1matlab軟件下載入口
- 未知 | 935124次下載 | 10 積分
- 2開源硬件-PMP21529.1-4 開關(guān)降壓/升壓雙向直流/直流轉(zhuǎn)換器 PCB layout 設(shè)計
- 1.48MB | 420063次下載 | 10 積分
- 3Altium DXP2002下載入口
- 未知 | 233088次下載 | 10 積分
- 4電路仿真軟件multisim 10.0免費(fèi)下載
- 340992 | 191370次下載 | 10 積分
- 5十天學(xué)會AVR單片機(jī)與C語言視頻教程 下載
- 158M | 183336次下載 | 10 積分
- 6labview8.5下載
- 未知 | 81583次下載 | 10 積分
- 7Keil工具M(jìn)DK-Arm免費(fèi)下載
- 0.02 MB | 73814次下載 | 10 積分
- 8LabVIEW 8.6下載
- 未知 | 65988次下載 | 10 積分
評論