IOT button remote / Spotify control integration with MQTT
Ready for 3.0What this workflow does
This workflow has 24 nodes and runs on MQTT events. Along the way it connects Spotify and MQTT. It also calls api.spotify.com over HTTP.
How it runs
Trigger: On MQTT events.
- Spotify API - Get Available Devices (HTTP Request): calls api.spotify.com
- Extract Individual Devices (Split Out): splits a list into separate items
- Select Device by Name to get device_id (Filter): keeps only the items that match a condition
- Spotify API - Activate Target Playback Device (HTTP Request): calls api.spotify.com (PUT)
- Route to Requested Function (Switch): routes items into 5 branches
- Spotify API - Volume up 5pct (HTTP Request): calls api.spotify.com (PUT)
- Spotify API - Volume down 5pct (HTTP Request): calls api.spotify.com (PUT)
- Is Playing? (If): checks a condition and branches into true / false
- Custom Function 1 - P (HTTP Request): calls api.spotify.com (PUT)
- Custom Function 2 - P (Spotify): get user playlists
…plus 12 more steps. See the full node list below.
Services it uses
HTTP calls to: api.spotify.com
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (9)
- Spotify
n8n-nodes-base.spotify - HTTP Request
n8n-nodes-base.httpRequest - Split Out
n8n-nodes-base.splitOut - Filter
n8n-nodes-base.filter - Switch
n8n-nodes-base.switch - Edit Fields (Set)
n8n-nodes-base.set - No Operation, do nothing
n8n-nodes-base.noOp - If
n8n-nodes-base.if - MQTT Trigger
n8n-nodes-base.mqttTrigger
From the author
Overview This template integrates an IOT multi-button switch (meant for controlling a dimmable light) with Spotify playback functions, via MQTT messages. This isn't likely to work without some tinkering, but should be a good head start on receiving/routing…