29.03.2021, 06:49
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