Well the api works, but as it just sends commands to the radio via http like “/Sendkey?key=” or “/gochild?id=” and gets the response in form of “/playinfo” or similar I just use that directly in the media_player.py it is just easier for me to work on, I can get the sources names and then call them using just the code in media_player.py
- One device has no need for auth to get the info, for example:
![Przechwytywanie](https://community-assets.home-assistant.io/original/4X/8/9/1/891538bd139456975cf944329f4d40e117da71b5.png)
But the other needs auth or it gives 401 erro
![Przechwytywanie](https://community-assets.home-assistant.io/original/4X/f/2/1/f21e3f77576983de1ab31c659ae069f487ee444e.png)
In nodered I can get this info by using auth basic, here is the flow:
[{"id":"45131d0546c39da9","type":"debug","z":"60fa0ad9aa6c0942","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":600,"y":240,"wires":[]},{"id":"ce553a068cb7ec00","type":"inject","z":"60fa0ad9aa6c0942","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":240,"wires":[["0118bb5b994fdd90"]]},{"id":"0118bb5b994fdd90","type":"http request","z":"60fa0ad9aa6c0942","name":"Kuchnia","method":"GET","ret":"txt","paytoqs":"ignore","url":"192.168.0.142/list?id=1&start=1&count=20","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"basic","senderr":false,"headers":[],"x":300,"y":240,"wires":[["33c824b293c0d5ab"]]},{"id":"33c824b293c0d5ab","type":"xml","z":"60fa0ad9aa6c0942","name":"","property":"payload","attr":"","chr":"","x":450,"y":240,"wires":[["45131d0546c39da9"]]}]
All the commands in both radios are the same, like IP/playinfo, IP//list?id=1&start=1&count=20 even the ip:8080/playlogo.jpg is on both radios, but on one it needs auth!
EDIT:
Well scrap that, I forgot to init the second radio after last changes to auth I’ve made and it seems to work now, (you need to send IP/init command after restart of the radio or the playinfo wont work!)
But as you can see, I need to auth the playlogo.jpg which is on port 8080, the code I have does not work:
self._image_url = 'http://' + \
'roosu3g4go6sk7' + ':' + \
'ji39454xu/^' + \
'@' + self._host + ':' + \
str(self._port) + '/playlogo' + \
reference.replace(":", "_")[:-1] \
+ '.jpg'
The auth that worked is here:
async with self._opener.get(uri, auth=aiohttp.BasicAuth('su3g4go6sk7', 'ji39454xu/^', encoding='utf-8')) as resp: