Elixir implementation of Yamaha's MusicCast™ multiroom audio solution.
See the online documentation for more information.
Add :musiccast
to your list of dependencies in mix.exs
:
def deps do
[{:musiccast, "~> 0.2"}]
end
You can list available devices as follow:
iex> [{pid, device_id}] = MusicCast.which_devices()
[{#PID<0.200.0>, "00A0DEDCF73E"}]
Use the MusicCast.Network.Entity
module to control a MusicCast device:
iex> MusicCast.Network.Entity.set_input(pid, "spotify")
:ok
iex> MusicCast.Network.Entity.playback_play(pid)
:ok
iex> MusicCast.Network.Entity.set_volume(pid, 50)
:ok
To subscribe to update notifications from a device use MusicCast.Network.subscribe/1
:
iex> MusicCast.subscribe(device_id)
:ok
iex> flush()
{:musiccast, :update, "00A0DEDCF73E", %{playback: %{input: "spotify", playback: "pause"}}
{:musiccast, :update, "00A0DEDCF73E", %{playback: %{playback: "play"}}
{:musiccast, :update, "00A0DEDCF73E", %{status: %{volume: 50}}