openhab / openhab-core

Core framework of openHAB
https://www.openhab.org/
Eclipse Public License 2.0
930 stars 428 forks source link

[rest] VoiceResource: Return answer from /interpreters endpoint #4434

Closed florian-h05 closed 2 weeks ago

florian-h05 commented 3 weeks ago

Also add annotations for the response.

florian-h05 commented 3 weeks ago

As the current answer was undocumented, WDYT about changing the format to JSON and putting the current answer string into a answer key? My plans for the UI need extended core APIs ...

wborn commented 2 weeks ago

WDYT about changing the format to JSON and putting the current answer string into a answer key?

I wouldn't change it now unless there is a good reason and it is actually used for that. Seems like this API has been around since OH 2.x so changing it will most likely break some user integrations.

florian-h05 commented 2 weeks ago

My problem is, that I not only need to return an answer from the HLI but also some „action“ data to instruct the UI to show a widget for some Item, but that would also need changes to the HLI interface. Not sure how to handle that.

wborn commented 2 weeks ago

It might be possible to support both if you add another method with the @Consumes(MediaType.APPLICATION_JSON) annotation and keep the method having @Consumes(MediaType.TEXT_PLAIN). :wink:

florian-h05 commented 2 weeks ago

Thanks for the hint — I will try that out then, but let’s get this merged first.