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.

HifiBerry REST API
#1
Hi.

I normally control my HifiBerry amplifiers with NodeRed and the HifiBerry API. I now try to do the same with my LM5, but i just get an error code. I want to send % volume to the amplifier. Anyone here who knows what to adjust to get this to work?

Code:
http = require('socket.http')
ltn12 = require('ltn12')

body = require('json').encode({
  percent = event.getvalue()
})


res, code = http.request({
  url = 'http://192.168.1.91:81/api/volume',
  method = 'POST',
  headers = {
    ['Content-Length'] = #body,
  },
  source = ltn12.source.string(body)
})


log(res, code)


HifiBerry API documentation:
https://github.com/hifiberry/audiocontro...doc/api.md

Error:
* arg: 1
  * string:
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html>
        <head>
            <title>Error: 500 Internal Server Error</title>
            <style type="text/css">
              html {background-color: #eee; font-family: sans;}
              body {background-color: #fff; border: 1px solid #ddd;
                    padding: 15px; margin: 15px;}
              pre {background-color: #eee; border: 1px solid #ddd; padding: 5px;}
            </style>
        </head>
        <body>
            <h1>Error: 500 Internal Server Error</h1>
            <p>Sorry, the requested URL <tt>'http://192.168.1.91:81/api/volume'</tt>
              caused an error:</p>
            <pre>Internal Server Error</pre>
        </body>
    </html>

* arg: 2
  * number: 500
BR
Kai-Roger
Reply


Messages In This Thread
HifiBerry REST API - by Kai-Roger - 09.05.2021, 14:28
RE: HifiBerry REST API - by admin - 09.05.2021, 15:57
RE: HifiBerry REST API - by Kai-Roger - 09.05.2021, 16:15
RE: HifiBerry REST API - by Kai-Roger - 09.05.2021, 21:18
RE: HifiBerry REST API - by admin - 10.05.2021, 06:30
RE: HifiBerry REST API - by Kai-Roger - 10.05.2021, 07:21

Forum Jump: