Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

almightycouch/musiccast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yamaha MusicCast™

Travis Hex.pm Documentation Status GitHub license Github Issues

Cover image

Elixir implementation of Yamaha's MusicCast™ multiroom audio solution.

Documentation

See the online documentation for more information.

Installation

Add :musiccast to your list of dependencies in mix.exs:

def deps do
  [{:musiccast, "~> 0.2"}]
end

Usage

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}}