ok. that’s not an issue for me since I do not use it that much from HASS. I use Spotify through the built in support of forked-daapd mainly. Just sometimes when people come round and want to play something off Spotify that is not in my library I use librespot
This projects sounds really interesting, but I’m not sure it would work for my use-case. I’m looking for something that would allow me to control my iTunes library that’s on my PC (sadly, not a mac, so no API for it). I use smart playlists extensively, since I haven’t found any alternative that will let me use logic rules to sort my music, sync ratings, playcounts, and other metadata, and stream to my two Airport Express remote speakers.
Would this solution allow me to integrate Home Assistant with my iTunes located on my PC? Or, alternatively, could it be set up to point to an iTunes library on a NAS? I’m not familiar with Java or Python, so I’d like to get suggestions (or confirmation) from the community before I start messing with my setup.
This would be working if you can move your library to a NAS AND run forked-daapd instead of iTunes either on the NAS or some other linux computer (Raspberry Pi for example)
That’s amazing news! I’ll be able to test that out some time in the future, and see if I can figure it out. Thanks so much for letting me know. I’m assuming that I can run forked-daapd on the same rPi 3 that’s running HassIO, and that it can be installed using docker. Is this correct, or would I need to run it on a different linux machine?
same machine is fine.
Yeah you just have to think of forked-daapd as an iTunes server. It will manage your library and can output it to multiple Airplay speakers.
Unfortunately you need to use command line switches to control the outputs though and their individual volume because they are not yet in Hass (the point of this thread amongst other things).
Forked-Daapd now includes some json api so it should be much easier to control it from hass. The api is still not complete but working nicely already.
See discussion here: https://github.com/ejurgensen/forked-daapd/issues/462
Hey man!
Can you give me some more details on this? I read the Github thread and it looks interesting, but it went a little over my head.
Sure. What exactly do you want to do? I would post my config but it’s a convoluted mess… so I’d rather post some specific sections…
I meant specifically regarding the API, whether there are now nicer ways of controlling which speakers were enabled, and their volume. Rather than through the CLI.
What I have configured are input_sliders and then the volume can be set and read via rest:
so I have a sensor:
sensor:
- platform: rest
name: bedroom volume
method: GET
resource: http://forked-daapd-ip:3689/api/outputs/215949698466292
value_template: '{{value_json.volume}}'
scan_interval: 5
and a rest command to send the new volume when the input_number was changed.
rest_command:
set_bedroom_volume:
url: http://forked-daapd-ip:3689/api/outputs/215949698466292
method: PUT
payload: '{"volume" : {{ states.input_number.bedroom_volume.state|round }} }'
215949698466292
is the speaker id.
you get those for example by curl http://forked-daapd-ip:3689/api/outputs
unfortunately there is no rest input_number component so you need automations as well to tie things together:
automation:
- alias: 'Bedroom Volume Slider Change'
trigger:
platform: state
entity_id: input_number.bedroom_volume
action:
- service: rest_command.set_bedroom_volume
- alias: 'Bedroom Volume Change'
trigger:
platform: state
entity_id: sensor.bedroom_volume
action:
service: input_number.set_value
data_template:
entity_id: input_number.bedroom_volume
value: '{{ states.sensor.bedroom_volume.state }}'
you can switch the speakers by defining a rest switch:
switch:
- platform: rest
name: Airplay Loop
method: PUT
resource: http://forked-daapd-ip:3689/api/outputs/215949697879210
body_on: '{"selected": true}'
body_off: '{"selected": false}'
is_on_template: '{{value_json.selected}}'
scan_interval: 5
You’re the man, dawg. I will digest this and report back!
I put together a video on my YouTube channel showing how I set things up. Should be useful as a reference for setting up both forked-daapd itself, as well as integration into Home Assistant. The video description has a link to a notes document that I use as a reference.
Credit to this thread for motivating me to set this up!
nice. your config is much neater than mine One suggestion may be to use the home-assistant universal media player on top.