openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.88k stars 3.59k forks source link

[freeboxos] Playing audio media though the audio sink fails #17243

Closed lolodomo closed 3 months ago

lolodomo commented 3 months ago

Using the "audio play" console command and the Revolution player as audio sink:

12:53:52.323 [DEBUG] [ing.freeboxos.internal.api.ApiHandler] - executeUrl POST: https://mafreebox.freebox.fr:443/api/v12/airmedia/receivers/Freebox%20Player
12:53:52.345 [TRACE] [ing.freeboxos.internal.api.ApiHandler] - executeUrl POST - https://mafreebox.freebox.fr:443/api/v12/airmedia/receivers/Freebox%20Player returned {"msg":"Action invalide","success":false,"error_code":"invalid_request"}
12:53:52.347 [WARN ] [eeboxos.internal.handler.AirMediaSink] - Playing media failed: Api request failed: Action invalide

I will investigate.

lolodomo commented 3 months ago

Here is the provided JSON leading to the error:

 {"password":"","action":"STOP","media_type":"VIDEO","media":null,"position":0}
lolodomo commented 3 months ago

Certainly the same issue as already encountered while using an ENUM in the record leading to value in uppercase in the provided JSON while the API expects lowercase.

lolodomo commented 3 months ago

Problem confirmed. Even with parameters in lowercase, I now encounter a second problem, the response of the API is simply this JSON:

{"success":true}

And this leads to an IllegalArgumentException in controlSingleton because there is no result field.

lolodomo commented 3 months ago

Ok, I was finally able to make it work. I will test more in details and then provide a fix.