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.
- npm install yamaha-yxc-nodejs
- To power on the yamaha, network standby has to be enabled
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.
- refactoring of emulation, variable test data injection
- skip using chalk, figlet
- correction of Version in package.json 3.0.1 -> 3.1.1
- API exposes two classes the API and the Emulation, the import/require has to be changed
- no longer ES module
- move figlet, chalk to dependencies, instead devDep
- created as ES module with two classes, the API and the Emulation
- skip node12 (no longer LTS)
- (scrounger) recallRecentItem added
- added testing
- added github actions
- add library root/request, http.request alone not working
- new API calls implemented
- for testing purpose the ip could also defined with a port e.g. localhost:3333
- changed error rejection in SendReqToDevice
- different library for ssdp
- remove library root/request
- async/await functions
- no more instantiating with autodiscovery
- discovery responds with an array of found devices (not only the 1st appeering)
- (alanbacon) returning paresed json instead raw
- (alanbacon) setPartyMode
- (alanbacon) storePreset
- (alanbacon) clearPreset
- (danie1kr) zone playlist
- change deprecated request to @root/request
- add advanced setLinkAudioQuality
- improvement for setInput, getListInfo, setListControl
- added mode to setInput
- added getListInfo, setListControl
- improvement in power/standby
- tuner commands added
- clock commands added
- subscribe for update when GET send
- getPlayInfo extended for getting CD-values
- new surround(on)
- deleted parameter Zone in some functions, hence not necessary
- discovery on YamahaExtendedControl instead Manufacturer=Yamaha, because not all devices respond to MusicCast
- new method power, mute
- bugfixes to getcommands for zones, readme etc.
- intitial version
Copyright (c) 2017 - 2022 foxthefox foxthefox@wysiwis.net
The MIT License (MIT) This library is using the simple-ssdp package (MIT License).