Go to file
nicobo 0945b69410
+ ability to load external scripts
+ using yamaha-yxc-nodejs for easier addition of new scripts
+ can now sync the volume of several devices
2021-03-26 21:31:32 +01:00
doc + draft doc 2021-03-24 22:38:43 +01:00
scripts + ability to load external scripts 2021-03-26 21:31:32 +01:00
.dockerignore + .ignore patterns 2021-03-24 22:33:40 +01:00
.gitignore + .ignore patterns 2021-03-24 22:33:40 +01:00
docker-compose.yml + ability to load external scripts 2021-03-26 21:31:32 +01:00
Dockerfile + ability to load external scripts 2021-03-26 21:31:32 +01:00
index.js + ability to load external scripts 2021-03-26 21:31:32 +01:00
LICENSE Initial commit 2018-08-09 21:17:43 +02:00
package.json + ability to load external scripts 2021-03-26 21:31:32 +01:00
README.md + ability to load external scripts 2021-03-26 21:31:32 +01:00
yarn.lock Initial version 2018-08-09 21:20:30 +02:00

MusicCast "repair kit"

This program will automatically update the settings of your MusicCast© devices for you, that cannot be done by the devices alone.

It currently implements the following use cases :

  • change the sound program when you're switching from e.g. TV to Spotify and vice verse
  • synchronize the volume of two devices

Command line usage

When running the program you need to specify which scenarios to run. The scenarios are .js scripts which implement the use cases above. More details in the next sections.

Use the -s command line option to specify which script to load :

node . -s ./scripts/sync-volume.js ./scripts/debug.js --source=192.168.1.42 --target=192.168.1.43 --target=192.168.1.44

Or in a configuration file :

{
  "conf": {
    "sync-volume": {
      "source": "192.168.1.43",
      "target": [
        "192.168.1.43",
        "192.168.1.44"
      ]
    }
  }
}

Then use the --config option :

node . -s ./scripts/sync-volume.js ./scripts/debug.js --config config.json

You can define generic options at the top level and scenario-specific options under a prefix named after the script's name (its filename without extension). For instance with --source 1.2.3.4 --conf.sync-volume.source 5.6.7.8, 1.2.3.4 will be used as the source parameter by default but 5.6.7.8 will override its value for the sync-volume scenario only.

You can pass those arguments multiple times or give several values if you need to.

The following environment variables may be specified before running index.js :

LOCAL_IP # Your local ip address to use, 0.0.0.0 could work in some setups
PORT # Port listening for events from the receiver, defaults to 41100

Example

PORT=44444 LOCAL_IP=192.168.1.187 node .

Scenarios

Automatic sound program depending on the source

When the input source of your Yamaha receiver changes, the sound program and clear voice settings are automatically changed.

Currently the following mappings from source to sound program are hard coded

tv => tv_program with clear_voice enabled
bd_dvd => tv_program with clear_voice enabled
spotify => music with clear_voice disabled
airplay => music with clear_voice disabled

On the command line, use -s scripts/sync-volume.js to enable this script and use the --conf-sync-volume-source option to set the hostname or IP address of the receiver.

Top-level options (e.g. --source) and configuration file are also valid.

Sync volume of two devices

If you have a Yamaha MusicCast receiver (like CRX N470D) wirelessly connected to Yamaha MusicCast speakers (like a MusicCast 20 stereo pair), you may have noticed that using the front volume button or the IR remote from the CRX will not update the volume of the linked speakers. Those hardware buttons only work with speakers wired to the CRX receiver. Your only option to set the same volume to all connected devices is to use the Yahama MusicCast mobile app, which is far less user-friendly than the physical remote.

This program will solve this by listening to a source device and applying any volume change to a target one.

On the command line, use -s scripts/audio-profile.js to enable this script and use the following options :

  • --conf-audio-profile-source sets the hostname or IP address of the master receiver
  • --conf-audio-profile-target is a space-separated list of slave devices that will be updated with the master's volume

Top-level options (e.g. --source) and configuration file are also valid.

Docker build & run

Update docker-compose.yml to reflect the IP addresses of your setup (or use a .env file or set environment variables).

Build :

docker-compose build

Run locally :

docker-compose up --detach

Deploy on a swarm :

docker stack deploy -c docker-compose.yml musiccast-repairkit

Logging and debugging

Will log network activity :

NODE_DEBUG="net" node index.js ...

References