mirror of
https://github.com/nicolabs/musiccast-repairkit.git
synced 2025-09-07 16:10:34 +02:00
~ fixed doc
This commit is contained in:
parent
cf43d4da86
commit
c25d0d70b0
102
README.md
102
README.md
|
@ -2,65 +2,86 @@
|
|||
|
||||
[](https://hub.docker.com/r/nicolabs/musiccast-repairkit) [](https://github.com/nicolabs/musiccast-repairkit) [](https://plant.treeware.earth/nicolabs/musiccast-repairkit)
|
||||
|
||||
This program will help you implement missing features for your [Yamaha MusicCast©](https://usa.yamaha.com/products/contents/audio_visual/musiccast/index.html) devices by watching events (e.g. volume or source change) and automatically updating the settings, according to your scenarios.
|
||||
This software implements missing features for your [Yamaha MusicCast©](https://usa.yamaha.com/products/contents/audio_visual/musiccast/index.html) devices by using their embedded Application Programming Interface (API).
|
||||
|
||||
Scenarios are pluggable scripts that you can implement in JavaScript ([NodeJs](https://nodejs.org/)).
|
||||
Scripts are already provided for the following use cases :
|
||||
You will have to run this program on an always-on machine, connected to the same WiFi / Ethernet nertwork as your MusicCast devices so that it can communicate with them.
|
||||
|
||||
- [change the sound program when you're switching from e.g. TV to Spotify and vice versa](#automatic-sound-program-depending-on-the-source)
|
||||
- [synchronize the volume of two devices](#sync-volume-of-several-devices)
|
||||
The behavior is managed by enabling and configuring scenarios, each doing a specific task. You can even code your own scenarios.
|
||||
|
||||
|
||||
## Scenarios
|
||||
|
||||
## Provided scenarios
|
||||
Each scenario is implemented as a script, written in JavaScript (run with [NodeJs](https://nodejs.org/)).
|
||||
|
||||
Each scenario is implemented as a script in the `scripts/` directory in this project.
|
||||
There is no guide on how to develop your own scenario, but you should look at the existing scripts, which are easy to understand for any JavaScript programmer.
|
||||
Basically they work by watching events over the network (e.g. volume or source change) and calling accordingly the API of the MusicCast devices.
|
||||
|
||||
### Automatic sound program depending on the source
|
||||
Scenarios are already provided in the [scripts](./scripts) directory in this project, for the following use cases :
|
||||
|
||||
- [change the sound program when the source changes](#scenario-automatic-sound-program-depending-on-the-source)
|
||||
- [synchronize the volume of several devices](#scenario-synchronize-volume-of-several-devices)
|
||||
- [standby several devices together](scenario-standby-several-devices-together)
|
||||
|
||||
|
||||
### Scenario : Automatic sound program depending on the source
|
||||
|
||||

|
||||
|
||||
*This is the script that comes from the original project, [axelo/yamaha-sound-program-by-source](https://github.com/axelo/yamaha-sound-program-by-source).*
|
||||
|
||||
#### What it does
|
||||
|
||||
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
|
||||
#### How to configure
|
||||
|
||||
Currently the following mappings from source to sound program are hard coded. You can change them by editing the script directly.
|
||||
|
||||
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/audio-profile.js` to enable this script and use the `--conf.audio-profile.source` option to set the hostname or IP address of the receiver.
|
||||
On the command line, use `-s scripts/audio-profile.js` to enable this script and use the `--conf.audio-profile.source=<source_IP>` option to set the hostname or IP address of the receiver.
|
||||
|
||||
Top-level options (e.g. `--source`) and configuration file are also valid (see instructions below).
|
||||
|
||||
|
||||
### Sync volume of several devices
|
||||
### Scenario : Synchronize volume of several 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 directly 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.
|
||||
#### What it does
|
||||
|
||||
This script will solve this by listening to volume updates on a source device and applying any volume change to one or more target devices.
|
||||
If you have a Yamaha MusicCast receiver (like *CRX N470D*) connected to ***wireless*** Yamaha MusicCast speakers (like a MusicCast 20 stereo pair), you may have noticed that **using the device's physical volume button or the IR remote will not update the volume of the wireless speakers**. Those hardware buttons only work with speakers physically 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 script will solve this by listening to volume changes on a source device and applying them on one or more target devices.
|
||||
|
||||
#### How to configure
|
||||
|
||||
On the command line, use `-s scripts/sync-volume.js` to enable this script and use the following options :
|
||||
- `--conf.sync-volume.source` sets the hostname or IP address of the *master* receiver
|
||||
- `--conf.sync-volume.target` lists the *slave* devices that will be updated with the master's volume. You can separate them with a space or pass the option several times.
|
||||
- `--conf.sync-volume.source=<source_IP>` sets the hostname or IP address of the *master* receiver
|
||||
- `--conf.sync-volume.target=<target_IP [target_IP [...]]>` lists the *slave* devices that will reflect the master's volume changes. You can separate them with a space or pass the option several times.
|
||||
|
||||
Top-level options (e.g. `--source`) and configuration file are also valid (see instructions below).
|
||||
|
||||
|
||||
### Sync standby mode of several devices
|
||||
### Scenario : Standby several devices together
|
||||
|
||||
#### What it does
|
||||
|
||||
It sometimes happens that wirelessly-linked devices don't go to standby mode or don't awake together with the main one.
|
||||
It may be a bug or a reliability issue with network protocols ; however the result is that this forces you to physically put them on/off.
|
||||
It may be a bug or a network reliability issue or whatever, but it forces you to physically put them on/off.
|
||||
|
||||
This script will automatically forces a given list of devices to power on or off following the main device power status.
|
||||
This script will automatically force a given list of devices to power on or off together with the main device.
|
||||
|
||||
#### How to configure
|
||||
|
||||
On the command line, use `-s scripts/standby-together.js` to enable this script and use the following options :
|
||||
- `--conf.standby-together.source` sets the hostname or IP address of the *master* receiver
|
||||
- `--conf.standby-together.target` lists the *slave* devices that will follow the master's power status. You can separate them with a space or pass the option several times.
|
||||
- `--conf.standby-together.source=<source_IP>` sets the hostname or IP address of the *master* receiver
|
||||
- `--conf.standby-together.target=<target_IP [target_IP [...]]>` lists the *slave* devices that will follow the master's power status. You can separate them with a space or pass the option several times.
|
||||
|
||||
Top-level options (e.g. `--source`) and configuration file are also valid (see instructions below).
|
||||
|
||||
|
@ -72,11 +93,16 @@ This program requires [Node.js](https://nodejs.org) to run.
|
|||
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 :
|
||||
Use the **`-s` command line option to specify which script(s) to load** ; for example :
|
||||
|
||||
node . -s ./scripts/sync-volume.js --source=192.168.1.42 --target=192.168.1.43 --target=192.168.1.44
|
||||
|
||||
Or in a configuration file (let's say `config.json`) :
|
||||
You can pass all options on the command line, or use the **`--config` option to store them in a JSON file** ; example :
|
||||
|
||||
|
||||
node . -s ./scripts/sync-volume.js --config config.json
|
||||
|
||||
Contents of config.json :
|
||||
|
||||
```json
|
||||
{
|
||||
|
@ -92,40 +118,36 @@ Or in a configuration file (let's say `config.json`) :
|
|||
}
|
||||
```
|
||||
|
||||
Then use the `--config` option :
|
||||
|
||||
node . -s ./scripts/sync-volume.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).
|
||||
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 be used for the *sync-volume* scenario only.
|
||||
|
||||
You can pass those arguments multiple times or give several space-separated values if you need to.
|
||||
You can pass those arguments multiple times or provide space-separated values if you need to.
|
||||
|
||||
The following environment variables may be specified before running `index.js` :
|
||||
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
|
||||
LOCAL_IP # The local IP address of this program, 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 .
|
||||
PORT=44444 LOCAL_IP=192.168.1.187 node . [...]
|
||||
|
||||
|
||||
|
||||
## Docker usage
|
||||
|
||||
Instead of installing _Node.js_ and running the scripts you can run from a [docker](https://www.docker.com/) image :
|
||||
Instead of installing _Node.js_ and running this program from sources you can run it directly from a [Docker](https://www.docker.com/) image :
|
||||
|
||||
docker run -d --network=host nicolabs/musiccast-repairkit:1.1 -s ./scripts/standby-together.js --source 192.168.1.42 --target 192.168.1.43
|
||||
|
||||
Please see [docker-compose.yml](docker-compose.yml) for a deployment template.
|
||||
See also [docker-compose.yml](docker-compose.yml) for a deployment template.
|
||||
|
||||
This sample contains a example *command* that you shall override to fit your needs.
|
||||
This sample contains an example *command* that you shall override to fit your needs.
|
||||
You can edit it locally to reflect the IP addresses of your setup (or use a `.env` file or set environment variables).
|
||||
It should not be necessary to define a `LOCAL_IP` environment variable as IP addresses inside the container will likely don't match the one of the host.
|
||||
|
||||
|
||||
### Build & deploy commands
|
||||
### Build & deploy Docker image
|
||||
|
||||
Build :
|
||||
|
||||
|
@ -149,19 +171,19 @@ Deploy on a swarm cluster :
|
|||
|
||||
There is an option `-l` to change the default logging level ; the most useful option might be `-l debug`.
|
||||
|
||||
Otherwise, logging is set up in the [`logging.js`](logging.js) module : feel free to override it locally or in your custom Docker image.
|
||||
Otherwise, logging is set in the [`logging.js`](logging.js) module : feel free to override it locally or in your custom Docker image.
|
||||
|
||||
There is a special `scripts/debug.js` script that does nothing but printing debug informations. It is simply loaded as a scenario (you need to set log level to *debug* at least) :
|
||||
There is a special `scripts/debug.js` script that does nothing but print debug informations. It is simply loaded as a scenario (you need to set log level to *debug* at least) :
|
||||
|
||||
node . -s ./scripts/sync-volume.js ./scripts/debug.js -l debug --source=192.168.1.42 ...
|
||||
|
||||
|
||||
This will log network activity (Node.js native) :
|
||||
Note : Node.Js natively allows to log network activity :
|
||||
|
||||
NODE_DEBUG="net" node index.js ...
|
||||
|
||||
|
||||
# References
|
||||
## References
|
||||
|
||||
- http://habitech.s3.amazonaws.com/PDFs/YAM/MusicCast/Yamaha%20MusicCast%20HTTP%20simplified%20API%20for%20ControlSystems.pdf
|
||||
- https://www.pdf-archive.com/2017/04/21/yxc-api-spec-advanced/yxc-api-spec-advanced.pdf
|
||||
|
|
Loading…
Reference in a new issue