Flic Twist with Sonos
-
My setup is that I have a Flic Twist associated with Flic LR Hub. The goal is to be able to play Sonos internet radio stations (note: not “Playlists,” which are much more natively supported) and to change the volume with the twist dial.
The challenge is that the native IOS/Flic app does volume-to-Sonos correctly (via the twist dial), but can’t trigger stations. IFTTT is way too laggy/slow for real time music, so I ruled that out after I got it “working.” HA can trigger stations and set fixed volume, but volume adjustments from the dial are an issue. So, in the immortal words of the internet: “Why Not Both?”
--> Volume happens via the flic app
--> Station selection happens via a webhook to Home AssistantAlso, the Twist has a single and a double click, so I want to play two different radio stations (local NPR + Sirius XM) which is a whole additional problem.
CURRENT VERSIONS
Flic Hubs LR = v4.3.5
Filc Twist = v2
Sonos S1 = v11.14
HA Core = 2024.10.1
HA Supervisor = 2024.10.0
HA Operating System = 13.1Here’s how to do it:
- Set up your Flic Twist & Hub + Sonos & configure the twist to do volume on the kitchen, via the Flic IOS app
- Then, in Home Assistant, set up an automation (yaml below) to trigger the radio playlist (trick is the
x-rincon-mp3radio
prefix before the http URL) note that there need to be two separate actions in the automation if you want to set the volume and play a thing) - I wanted a consistent, set volume for this particular source. - Still in HA, set up a webhook trigger to call that automation. It’s notable that the creation of the webhook creates a single-factor “secret” in the name of the webhook,
flic-button-pressed-<redacted>
which becomes the URI. - Test the automation with curl on your laptop, to make sure that part is set up. This should cause the music to start.
curl -X POST http://homeassistant.local:8123/api/webhook/flic-button-pressed-<redacted>
- Then, in the Flic IOS App, configure the flic button push trigger a URL hit to HA with the “http internet request” action, and paste in your HA webhook link.
- Repeat the whole process for flic double-click, with a second automation
There’s a GOTCHA on the
media_content_id
and URL prefixing. For starters,media_content_type: music
should JFW. Don’t worry about that part. But for the streaming station, you’ll need thatx-rincon-mp3radio
prefix. There’s a nice little doc about how to extract the Sirius XM specific station URL here, but do use thex-rincon-mp3radio
prefix again, and not thex-sonosapi-hls-static
approach.alias: Flic Button Pressed description: "" triggers: - trigger: webhook allowed_methods: - POST - PUT local_only: true webhook_id: flic-button-pressed-<redacted> actions: - action: media_player.volume_set data: volume_level: 0.3 target: area_id: kitchen device_id: 59dd4ccdec3d2qq42408305b8c9c3fa7 entity_id: media_player.sonos_room_name - action: media_player.play_media target: entity_id: media_player.sonos_room_name area_id: kitchen device_id: 59dd4ccdec3d2qq42408305b8c9c3fa7 data: media_content_type: music media_content_id: ""x-rincon-mp3radio://https://live-ftc-prod-device.streaming.siriusxm.com/v1/763a312c707<redacted>_v4.m3u8