Kane610 / axis

Python library enabling easy communication with Axis devices and its metadatastream
MIT License
30 stars 14 forks source link

add Audio API support for axis network speakers #521

Open jonoberheide opened 2 weeks ago

jonoberheide commented 2 weeks ago

Ok, I stepped out of HA-land [1] for a bit to add the Audio API support natively to the axis library.

This PR:

[1] https://github.com/home-assistant/core/pull/130163

Kane610 commented 2 weeks ago

This is great! I can't promise i can give you feedback within the next.two weeks (busy IRL) but I eagerly want to see this in the integration. Good job!

jonoberheide commented 1 week ago

I may fling some more code over the wall for the Audio Device Control API (for volume control), but no rush on any review!

jonoberheide commented 1 week ago

Added support for the Audio Device Control API. This can control the gain and mute status for output speakers.

https://www.axis.com/vapix-library/subjects/t10100065/section/t10169359/display

The API is a bit kludgy. The GetDevicesSettings returns a huge deeply-nested JSON structure. SetDevicesSetting expects that same structure, even if just tweaking the gain or mute parameters. One approach would be to Get the big structure, modify it, and then Set it, every time you want to change one of those parameters. Another approach, which I took, was to find the minimal JSON fields required for the request to be accepted and Set that. I opened a case with Axis support to see if they have additional guidance.