Yamaha Extended Control NodeJS library for MusicCast
MIT License
A node module to control your Yamaha MusicCast devices (inspired by yamaha-nodejs). This library is not, in any way, affiliated or related to Yamaha Inc.. Use it at your own risk.
This module uses the Yamaha Extended Control protocol. It should be possible to control loudspeakers, soundbars etc. Tested with WX-010 and YSP-1600.
const YamahaYXC = require('yamaha-yxc-nodejs').YamahaYXC;
//------------Instantiate -------------------
const yamaha = new YamahaYXC("192.168.xxx.yyy")
//-------------Zone related comands----------
yamaha.power(on, zone)
yamaha.powerOn(zone)
yamaha.powerOff(zone)
yamaha.sleep(val, zone)
yamaha.setVolumeTo(to, zone)
yamaha.mute(on, zone)
yamaha.muteOn(zone)
yamaha.muteOff(zone)
yamaha.setInput(input, zone, mode)
yamaha.setSound(input, zone)
yamaha.surround(on, zone)
yamaha.surroundOn(zone)
yamaha.surroundOff(zone)
yamaha.setDirect(on, zone)
yamaha.setPureDirect(on, zone)
yamaha.setEnhancer(on, zone)
yamaha.setClearVoice(on, zone)
yamaha.setBassTo(val, zone)
yamaha.setTrebleTo(val, zone)
yamaha.setEqualizer(low, mid, high, zone)
yamaha.setBalance(val, zone)
yamaha.setSubwooferVolumeTo(val, zone)
yamaha.setBassExtension(on, zone)
yamaha.startMCPlaylistEn()
//get commands
yamaha.getSignalInfo(zone)
yamaha.getStatus(zone)
yamaha.getSoundProgramList(zone)
yamaha.getMCPlaylists()
yamaha.getMCPlaylistContent()
//------------ NetUSB commands --------------
yamaha.getPresetInfo()
yamaha.getSettings()
yamaha.getRecentInfo()
yamaha.clearRecentInfo()
yamaha.setNetPlayback(val)
yamaha.toggleNetRepeat()
yamaha.toggleNetShuffle()
yamaha.storePreset(num)
yamaha.clearPreset(num)
yamaha.recallPreset(num, zone)
yamaha.stopNet()
yamaha.pauseNet()
yamaha.playNet()
yamaha.nextNet()
yamaha.prevNet()
yamaha.frwNet(state)
yamaha.ffwNet(state)
yamaha.recallRecentItem(val, zone)
yamaha.getListInfo(input, index, size, lang)
yamaha.setListControl(listId, type, index, zone)
//------------ NetUSB + CD + Tuner commands --------------
yamaha.getPlayInfo(val) //if empty the netusb is called, otherwise val must be set to "cd" or "tuner"
//------------ NetUSB + CD commands --------------
yamaha.toggleRepeat(val) //if empty the netusb is called, otherwise val must be set to "cd"
yamaha.toggleShuffle(val) //if empty the netusb is called, otherwise val must be set to "cd"
yamaha.setPlayback(where, val) //if where is empty the netusb is called, otherwise val must be set to "cd". val is for commands e.g. 'next'
//------------ CD commands ------------
yamaha.setCDPlayback(val)
yamaha.toggleTray()
yamaha.toggleCDRepeat()
yamaha.toggleCDShuffle()
yamaha.stopCD()
yamaha.pauseCD()
yamaha.playCD()
yamaha.nextCD()
yamaha.prevCD()
yamaha.frwCD(state)
yamaha.ffwCD(state)
//-------------System commands------
yamaha.getDeviceInfo()
yamaha.getFeatures()
yamaha.getNetworkStatus()
yamaha.getFuncStatus()
yamaha.getNameText(zone)
yamaha.getLocationInfo()
yamaha.setAutoPowerStandby(state, zone)
yamaha.setHdmiOut1(state, zone)
yamaha.setHdmiOut2(state, zone)
yamaha.setPartyMode(on)
//----------- advanced ------------
yamaha.setLinkControl(control, zone)
yamaha.setLinkAudioDelay(delay, zone)
yamaha.setLinkAudioQuality(mode, zone)
yamaha.getDistributionInfo()
yamaha.setServerInfo(data)
yamaha.setClientInfo(data)
yamaha.startDistribution(num)
yamaha.stopDistribution()
yamaha.setGroupName(name)
//----------- Tuner ------------
yamaha.getTunerPresetInfo(band)
yamaha.getTunerPlayInfo()
yamaha.setBand(band)
yamaha.setFreqDirect(band,freq)
yamaha.switchPresetTuner(direction)
yamaha.setDabService(direction)
//----------- Clock ------------
yamaha.getClockSettings()
yamaha.setClockAutoSync(state)
yamaha.setClockDateTime(YYMMDDhhmmss)
yamaha.setClockFormat(format)
yamaha.setAlarmSettings(data)
Some Parameter have to be determined first by calling a "get" method first. JSON array has to be formed before calling the method.
The zone parameter is optional, you can pass a number or a string
All these methods return a promise:
The resolved promise result will have been parsed from JSON into an object if the response content-type
was application/json
.
yamaha.powerOff().then(function(result){
console.log("Response is" + result);
});
There is an explicit function for discovery yamaha.discover(time). If the function is called without time, then the discovery is running for 5s. It returns an object for each device { ip, model, name, systemId, deviceId } in an array. It is not ensured that all devices are detected in this period, in the applicatian a merge of a second run might be necessary.
Copyright (c) 2017 - 2022 foxthefox [email protected]
The MIT License (MIT) This library is using the simple-ssdp package (MIT License).