This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Denon Home 150 and Yamaha Musicast 20 Speakers
#1
Hi to everyone!
I am new to LM world so I would like a little help regarding Denon Home 150 and a Yamaha musicast 20 Speakers. Both are wireless speakers (also with cable) with their own applications. I want to test those speakers along with KNX system installation with LM server. I know that LM application has already Sonos controlling embedded but we have to check it also if we can use one or both the 2 speakers I mentioned before. 
Is it possible to control Volume , Track playing (Start/stop) , choosing different sources  if possible (like USB, NAS Web radio, Spotify etc.) and also how to add restrictions regarding volume value.  To explain the volume restrictions, I mean the time  that the volume will be allowed to be in a specific value and in general speaking the timers that we can create for volume values and allowed to someone to have too loudly the speakers.
I am not familiar with scripting , so I will need a help if possible please!
Don't hesitate to contact me if you need further information!
Thank you in advance
Reply
#2
For Denon this might be applicable: https://forum.logicmachine.net/showthread.php?tid=190
Yamaha speakers seems to have some kind of HTTP control. This library in JavaScript can be used as a basis for writing your own Lua script for control and status retrieval: https://github.com/DoctorNSA/homebridge-...r/index.js
Reply
#3
Hello and thank you for your answer! Because I am not familiar with scripting and I am very new to LM software as I told you before , is it possible to guide me so I can make the tests for DENON Home 150 or YAMAHA Musiccast speakers please?
Reply
#4
For Yamaha run this script once and if it works correctly you should be a table with various status info in Logs tab. Change ip variable to Yamaha speakers IP address.
Code:
ip = '192.168.1.2'

json = require('json')
http = require('socket.http')
ltn12 = require('ltn12')

respbody = {}
res, code, hdrs = http.request({
  url = 'http://' .. ip .. '/YamahaExtendedControl/v1/main/getStatus',
  headers = {
    ['X-AppName'] = 'MusicCast/1.0',
    ['X-AppPort'] = '41100',    
  },
  sink = ltn12.sink.table(respbody)
})

if res then
  data = json.pdecode(table.concat(respbody))
  log(data)
else
  log('request failed', res, code)
end
Reply
#5
(29.03.2021, 06:49)admin Wrote: For Yamaha run this script once and if it works correctly you should be a table with various status info in Logs tab. Change ip variable to Yamaha speakers IP address.
Code:
ip = '192.168.1.2'

json = require('json')
http = require('socket.http')
ltn12 = require('ltn12')

respbody = {}
res, code, hdrs = http.request({
  url = 'http://' .. ip .. '/YamahaExtendedControl/v1/main/getStatus',
  headers = {
    ['X-AppName'] = 'MusicCast/1.0',
    ['X-AppPort'] = '41100',   
  },
  sink = ltn12.sink.table(respbody)
})

if res then
  data = json.pdecode(table.concat(respbody))
  log(data)
else
  log('request failed', res, code)
end
Hi
I endered the script on the Resident Script tab (I don't know if I have done well or I had to choose another Script tab to create this Script) by creating a new Script and named it as YAMAHA. Also I entered the IP of the Yamaha Speaker and  I checked the logs. It runs the script and now how I am going to visualize it and make it usable and make the functions like controlling volume , changing tracks or web radios or even changing the source from LM application something like SONOS app?
Thank you in advance for your help

Also I forgot to mentioned that the IP at line 2 I changed it to 192.168.1.169 which is the IP address of the Yamaha Musicast Speaker

Also is this something to do with KNX? I mean can we make some restrictions for example in volume like having levels in volume for specific hours of time?

Attached Files Thumbnail(s)
               
Reply
#6
First of all don't run this script with 0 sleep time, it will consume all CPU resources of the system. To write data to objects use grp.checkwrite(address, value). Make sure that you have created objects beforehand and that they have matching datatypes for the data that will be stored there (string, boolean, number).
Code:
if res then
  data = json.pdecode(table.concat(respbody))
  if type(data) == 'table' then
    grp.checkwrite('1/1/1', data.input)
    grp.checkwrite('1/1/2', data.mute)
  end
else
  log('request failed', res, code)
end

For control you will need to create an event script for each action and send HTTP requests to the speakers. You should use different objects for control and status otherwise it's possible to make an infinite loop which will also overload the system.
Example for volume control (use 1 byte scale object):
Code:
value = event.getvalue()

ip = '192.168.1.169'

http = require('socket.http')

res, code, hdrs = http.request({
  url = 'http://' .. ip .. '/YamahaExtendedControl/v1/main/setVolume?volume=' .. value,
  headers = {
    ['X-AppName'] = 'MusicCast/1.0',
    ['X-AppPort'] = '41100',    
  }
})
Reply
#7
Hi and thank you for your reply.
As I told you I am not familiar with scripting codes  and I will appreciate if you can help me more regarding this.  What do you mean by this '' First of all don't run this script with 0 sleep time''?
Also regarding :  ''To write data to objects use grp.checkwrite(address, value). Make sure that you have created objects beforehand and that they have matching datatypes for the data that will be stored there (string, boolean, number).'' You mean that I have to create the functions with group addresses first in LM and after created them I have to insert that code continuing the firts code you send me or create another Script in Resident Script Tab?
I have to make many different scripts for each control at the same resident script for Yamaha or I have to create a new one?
I am sorry for asking but I am very new and I will need your help if possible

Also I found this API for Yamaha Musiccast Speaker in that link I am sending you. Can I use it to do something with this API and in which way? Maybe its easier to do it that way and just create buttons in visualization LM system ?

https://github.com/honnel/yamaha-commands

YamahaExtendedControl Protocol
Yamaha HTTP simplified API for Control Systems V1.1 - June 20, 2017

Overview
Yamaha provide a comprehensive API for control and interrogation of MusicCast devices. This document covers the most useful features, with examples, for integration in to CI Environments.

Prerequisites/Recommendations
For the HTTP API to function correctly in an integrated system, the MusicCast devices must be on a fixed or bound IP Address. To avoid network loops through the wireless “extend” functionality of MusicCast products you should set the device to wired or wireless only - through the web GUI on the MusicCast device:

HTTP API Overview
All HTTP transactions take place through a connection to the MusicCast device on port 80 (the default used by a web browser), and take the following form: HTTP:// [ipaddress] /YamahaExtendedControl/v1/... Example: http://[ipaddress]/YamahaExtendedControl/v1/system/getFeatures (recalls the available features on the MusicCast device)

HTTP API - Get information
Note that when a zone is specified below, the available zones per device can be recalled using the getLocationInfo command. In all examples main has been used. Get Device info http://[ipaddress]/YamahaExtendedControl/v1/system/getDeviceInfo Get Available Device Features http://[ipaddress]/YamahaExtendedControl/v1/system/getFeatures Get Network Status http://[ipaddress]/YamahaExtendedControl/v1/system/getNetworkStatus Get Function Status (e.g.: Auto Power Standby) http://[ipaddress]/YamahaExtendedControl/v1/system/getFuncStatus Get Location info and zone list (device) http://[ipaddress]/YamahaExtendedControl/v1/system/getLocationInfo Get zone info (device|zone) http://[ipaddress]/YamahaExtendedControl/v1/main/getStatus Get Sound Program List (device|zone) http://[ipaddress]/YamahaExtendedControl/v1/main/getSoundProgramList

HTTP API - Power Functions
Enable/Disable Auto Power http://[ipaddress]/YamahaExtendedControl/v1/system/setAutoPowerStandby?enable=true Standby http://[ipaddress]/YamahaExtendedControl/v1/system/setAutoPowerStandby?enable=false Power on http://[ipaddress]/YamahaExtendedControl/v1/main/setPower?power=on Standby http://[ipaddress]/YamahaExtendedControl/v1/main/setPower?power=standby Power Toggle http://[ipaddress]/YamahaExtendedControl/v1/main/setPower?power=toggle

HTTP API - Sleep Timer
Set in minutes. Use zone name from getLocationInfo Set Sleep timer for 60 minutes http://[ipaddress]/YamahaExtendedControl/v1/main/setSleep?sleep=60 Cancel Sleep timer http://[ipaddress]/YamahaExtendedControl/v1/main/setSleep?sleep=0

HTTP API - Input and Volume
Input: Net Radio http://[ipaddress]/YamahaExtendedControl/v1/main/setInput?input=net_radio Input: Napster http://[ipaddress]/YamahaExtendedControl/v1/main/setInput?input=napster Input: Spotify http://[ipaddress]/YamahaExtendedControl/v1/main/setInput?input=spotify Input: Juke http://[ipaddress]/YamahaExtendedControl/v1/main/setInput?input=juke Input: Qobuz http://[ipaddress]/YamahaExtendedControl/v1/main/setInput?input=qobuz Input: Tidal http://[ipaddress]/YamahaExtendedControl/v1/main/setInput?input=tidal Input: Deezer http://[ipaddress]/YamahaExtendedControl/v1/main/setInput?input=deezer Input: Server http://[ipaddress]/YamahaExtendedControl/v1/main/setInput?input=server Input: Bluetooth http://[ipaddress]/YamahaExtendedControl/v1/main/setInput?input=bluetooth Input: Airplay http://[ipaddress]/YamahaExtendedControl/v1/main/setInput?input=airplay Input: MusicCast link http://[ipaddress]/YamahaExtendedControl/v1/main/setInput?input=mc_link The functions in the table above use autoplay to start the last item playing if the source is not already playing. Alternatively the autoplay_disabled function can be used: http://[ipaddress]/YamahaExtendedControl/v1/main/setInput?input=airplay&mode=autoplay_disabled Prepare Input Change (not necessary for direct input changes) Let a Device do necessary process before changing input in a specific zone. This is valid onlywhen “prepare_input_change” exists in “func_list” found in /system/getFuncStatus. http://[ipaddress]/YamahaExtendedControl/v1/main/prepareInputChange?input=usb Set Sound Program (where applicable) http://[ipaddress]/YamahaExtendedControl/v1/main//setSoundProgram?program=vienna

Volume Commands
For the Direct Volume function, the maximum volume setting available can be obtained from /system/getFeatures. For the stepped volume function thestep ranges are shown in the volume section of /system/getFeatures.

Direct Volume http://[ipaddress]/YamahaExtendedControl/v1/main/setVolume?volume=60 Incremental http://[ipaddress]/YamahaExtendedControl/v1/main/setVolume?volume=up http://[ipaddress]/YamahaExtendedControl/v1/main/setVolume?volume=down In Steps http://[ipaddress]/YamahaExtendedControl/v1/main/setVolume?volume=up&step=5 http://[ipaddress]/YamahaExtendedControl/v1/main/setVolume?volume=down&step=1

Mute Commands
Set Mute On http://[ipaddress]/YamahaExtendedControl/v1/main/setMute?enable=true Set Mute Off http://[ipaddress]/YamahaExtendedControl/v1/main/setMute?enable=false

HTTP API - AM/FM/DAB Tuner Commands
Tuner Presets Where band can be am, fm or dab Recall Preset http://[ipaddress]/YamahaExtendedControl/v1/tuner/recallPreset?zone=main&band=fm&num=13 Next Preset http://[ipaddress]/YamahaExtendedControl/v1/tuner/switchPreset?dir=next Previous Preset http://[ipaddress]/YamahaExtendedControl/v1/tuner/switchPreset?dir=previous Store Preset http://[ipaddress]/YamahaExtendedControl/v1/tuner/storePreset?num=10 Get Preset info http://[ipaddress]/YamahaExtendedControl/v1/tuner/getPresetInfo?band=fm Tuner - Get Playing info http://[ipaddress]/YamahaExtendedControl/v1/tuner/getPlayInfo Tuner - Set Frequency Where num represents frequency in KHz http://[ipaddress]/YamahaExtendedControl/v1/tuner/setFreq?band=fm&tuning=direct&num=87500

Tuner - Change DAB Service
Next Service http://[ipaddress]/YamahaExtendedControl/v1/tuner/setDabService?dir=next Previous Service http://[ipaddress]/YamahaExtendedControl/v1/tuner/setDabService?dir=previous http://[ipaddress]/YamahaExtendedControl/v1/tuner/setFreq?band=fm&tuning=direct&num=87500

HTTP API - Network/USB Presets and info
Recalls presets for any network or USB-based service. Playing info includes all metadata and image link Get Preset info http://[ipaddress]/YamahaExtendedControl/v1/netusb/getPresetInfo Get Current Playing info http://[ipaddress]/YamahaExtendedControl/v1/netusb/getPlayInfo Get Account Status (streaming services) http://[ipaddress]/YamahaExtendedControl/v1/netusb/getAccountStatus

HTTP API - System Presets
Recalls presets for the MusicCast system. Use zone name from getLocationInfo . Recall Preset http://[ipaddress]/YamahaExtendedControl/v1/netusb/recallPreset?zone=main&num=2 Store Preset http://[ipaddress]/YamahaExtendedControl/v1/netusb/storePreset?num=10

HTTP API - Transport Control
Sets Playback or transport mode. Stop http://[ipaddress]/YamahaExtendedControl/v1/netusb/setPlayback?playback=stop Play http://[ipaddress]/YamahaExtendedControl/v1/netusb/setPlayback?playback=play Previous http://[ipaddress]/YamahaExtendedControl/v1/netusb/setPlayback?playback=previous Next http://[ipaddress]/YamahaExtendedControl/v1/netusb/setPlayback?playback=next Fast Rewind - Start http://[ipaddress]/YamahaExtendedControl/v1/netusb/setPlayback?playback=fast_reverse_start Fast Rewind - Stop http://[ipaddress]/YamahaExtendedControl/v1/netusb/setPlayback?playback=fast_reverse_end Fast Forward - Start http://[ipaddress]/YamahaExtendedControl/v1/netusb/setPlayback?playback=fast_forward_start Fast Forward - Stop http://[ipaddress]/YamahaExtendedControl/v1/netusb/setPlayback?playback=fast_forward_end Repeat (Toggle) http://[ipaddress]/YamahaExtendedControl/v1/netusb/toggleRepeat Shuffle (Toggle) http://[ipaddress]/YamahaExtendedControl/v1/netusb/toggleShuffle

HTTP API - List info
Retrieve metadata and list entries. input is Input ID from /system/getFeatures | index is list offset from beginning | size is maximum list size 1-8) http://[ipaddress]/YamahaExtendedControl/v1/netusb/getListInfo?input=usb&index=32&size=8&lang=en
Reply
#8
Admin gave you full solution.
1. Create object 1/1/1 datatype string 250
2. Create object 1/1/2 datatype boolean
3. Delete your yamaha script
4. Create new resident script with interval 10 and past there Admin first script.
5. Create new object call it Volume with datatype scale
6. Click on the icon next to object name in column Event script, this shoud open new script window. Paste there second admin script
7. Create a schedule on Volume object and set different levels for different times.
------------------------------
Ctrl+F5
Reply
#9
(31.03.2021, 13:46)Daniel. Wrote: Admin gave you full solution.
1. Create object 1/1/1 datatype string 250
2. Create object 1/1/2 datatype boolean
3. Delete your yamaha script
4. Create new resident script with interval 10 and past there Admin first script.
5. Create new object call it Volume with datatype scale
6. Click on the icon next to object name in column Event script, this shoud open new script window. Paste there second admin script
7. Create a schedule on Volume object and set different levels for different times.

OK thank you I will try to do my best! I will inform you when I tested or if I something doesn't work for me
Thank you very much for your help!
Reply
#10
Hi and thank you very much for your help I made the test and the volume is working just fine! I used an 1byte from Mosaic Management and I used the Group address for the Volume I made like you told me .
Also what about creating other scripts like On/Off , changing music source (for example ,Spotify , napster, airplay, NAS Server Net radio etc) , Mute speaker , next and previous track? Is it possible to check also the playlist from a NAS and selecting for example type of music like for example Rock, Jazz, etc?
Reply
#11
You already have a list of commands available. Here's a short example of play/stop event script attached to a 1-bit object:
Code:
value = event.getvalue()

if value then
  value = 'play'
else
  value = 'stop'
end

ip = '192.168.1.169'

http = require('socket.http')

res, code, hdrs = http.request({
  url = 'http://' .. ip .. '/YamahaExtendedControl/v1/main/setPlayback?playback=' .. value,
  headers = {
    ['X-AppName'] = 'MusicCast/1.0',
    ['X-AppPort'] = '41100',    
  }
})
Reply
#12
Hi and thank you for your support!
So the steps have to make are:
1. Making an Object for example an object and called it as Play/Stop 1 bit object
2. Clicking the icon next to this object for scripting window and paste the new script that you send me.
3. Creating a Visualizatiion Button for this object in Mosaic 3

So the main script is inserted once at the beginning and after that we have to create the scripts wih objects for each function if I understand it well?
And also we have to create objects for writing data to objects too, grp.checkwrite(address, value)?

And last question is that we can use the code that you send me and I just make changes on it ? I am sorry but I don't have the scripting experience and that's why I am asking.

Cause if I want to create another scripts for choosing another music source , changing I mean from netradio to Spotify etc. I have to make different scripts and insert different parameters which I don't know what to change and what scripting words and rules I have to use each time.
Cause it seems easier to me to change a few parameters each time if Iknow of course the specific word I have to use for each purpose.

Thank you in advance for your help!
Reply
#13
I made that play/stop object , and I created a new button in Mosaic 3 with 1bit switch , tested but it doesn't do anything to the Yamaha Musiccast speaker
So I think I missing a thing to do first.
Reply
#14
Have you created an event script for play/stop control? If it does not work then I'm afraid we can't provide a lot of help because this is not an official API but a reverse engineered protocol and we don't have any speakers to test.
Reply


Forum Jump: