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.

HEOS by Denon
#1
Has anyone written a script to control the HEOS system?

I have no idea how to write json, but wondering if the SONOS script can be modified for use with HEOS as per this documentation:

http://www.eurostar-ostrava.cz/files/01....OL_V01.pdf
Reply
#2
Telnet is used data exchange, so you need to use LuaSocket for communication. Try this code, change IP variable and see if there's any data in logs. Errors will be logged as well.

Code:
require('json')
require('socket')

IP = '192.168.1.11'
PORT = 1255

sock = socket.tcp()
sock:settimeout(5)
sock:connect(IP, PORT)
sock:send("heos://system/check_account\r\n")

res, err = sock:receive()
if res then
  dec = json.pdecode(res)
  if dec then
    log(dec)
  else
    log(res)
  end
else
  log(err)
end

sock:close()
Reply
#3
Thanks for amazing help! I´ll test this and report back!

EDIT:

Getting error at line15, it´s expecting = near dec...?
Reply
#4
Chrome issue, remove all leading spaces from this script.
Code:
require('json')
require('socket')

IP = '192.168.1.11'
PORT = 1255

sock = socket.tcp()
sock:settimeout(5)
sock:connect(IP, PORT)
sock:send("heos://system/check_account\r\n")

res, err = sock:receive()
if res then dec = json.pdecode(res)
if dec then log(dec) else log(res) end
else log(err) end

sock:close()
Reply
#5
I´m getting this:

Code:
* table:
[heos]
 * table:
  [result]
   * string: success
  [command]
   * string: system/check_account
  [message]
   * string: signed_out

Which I am guessing is a good thing!

EDIT:

So I put this script in common functions, does that mean it gets triggered every time a resident script gets triggered?

See attachded screenshot.

Attached Files Thumbnail(s)
   
Reply
#6
You should never place code that is executed by itself into common functions. Common functions is included in every script and should only contain functions.
Reply
#7
I see, thanks, understand better know!
Reply
#8
I´ve been experimenting a lot with the script above, trying to get the Player ID from the system. I cannot execute anything without that elementary piece of information.

So, someone who actually knows how this works; What´s the next step? I´m getting responses from the system with various commands, I´m just missing what they´re calling payload information...

Anyone up for the challenge?
Reply
#9
Most probably you have to send auth info first, don't forget about escaping parameters in all commands or they might not work.

Put this after sock.connect and change user/pass variables accordingly:
Code:
url = require('socket.url')
escape = url.escape

user = 'user@gmail.com'
pass = '12345'

cmd = 'heos://system/sign_in?un=' .. escape(user) .. '&pw=' .. escape(pass) .. '\r\n'
sock:send(cmd)
Reply
#10
It´s pretty strange, even though I get success in the log when sending the auth, by sending a check account shortly after it says I´m signed out.

I think I´ll have to try this with a computer on the network itself, after all, all I need is the damn player id to be able to control volume up and down and play/pause, which is the only thing I´ll be using it for initially.

Thank you for the tremendous support, I´ve never experienced anything like it really.
Reply
#11
I´ve had someone over in the house to locally telnet directly into the heos and that finally gave me the PID i was looking for. The payload seems to be missing from the responses run through the scripts here.

Changing volume and muting seems to be working just fine now, thanks for all your help!
Reply


Forum Jump: