-
-
Notifications
You must be signed in to change notification settings - Fork 31k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for axis network speaker #130163
base: dev
Are you sure you want to change the base?
Conversation
Hey there @Kane610, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! Thank you
I would really like to see parts related to transmit.cgi be moved and defined in the axis library instead. Keeps everything together.
Im also missing a check somewhere that validates that the device has audio out.
And once all of that is fixed Im missing tests.
I will be busy for the next two weeks but am available for support after that.
Have you referenced other integrations using ffmpeg if there are some common pattern recommended to be used?
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Makes sense. I figured there was some logical subset to have in the axis lib. I kept everything in HA-land to start just for simplicity.
I will poke at this. I have a couple Axis cameras and a network relay so hopefully those should be good devices to validate against.
HA test suite is new territory, but I'll give it a shot.
Yes, I modeled it roughly off a few other components that use ffmpeg for audio transcoding like tts/uiprotect/etc. Seems ffmpeg_manager is best practice in HA-land, while some components have the ffmpeg logic in the non-HA helper library. The latter could make sense here in terms of standalone usage/testing from the axis library, but ffmpeg_manager is nice for path discovery and such. One middle-ground might be to use ffmpeg_manager and pass the path into the axis library and have the rest of the logic in there. I think this is roughly what uiprotect does IIRC. Some components use temp files with ffmpeg, but I wanted to keep things off disk with subprocess pipes. Also, in theory, ffmpeg itself could directly stream the resulting audio to the transmit.cgi URL, but keeping things native/async with vapix/httpx is better IMO. |
Lets take the discussion on ffmpeg once Im back. I think its good to provide s ffmpeg client into the library similar to how the httpx client is provided. Because then all axis details are kept in the library which is what we want. I have rewritten most tests for axis this summer so they are att least a bit more modern |
- move ffmpeg logic into the axis library - add volume/mute support - implement async_update to get latest device state - only add a media player entity if both audio APIs are supported
New changes:
|
Hi! First-time HA developer here, so (1) adding this support took a lot longer/more learning than the LOC may indicate, and (2) open to feedback on anything I may have done incorrectly.
Proposed change
Add support for Axis Network Speakers, exposing the device as a Media Player.
Tested on the Axis C1410 Mk II Network Mini Speaker.
@Kane610 Right now this is just adding the basic support to broadcast audio via the Axis speaker and the Audio API transmit.cgi. There is little/no state tracking, no event updates from the device, etc. I am guessing this would work with any Axis devices that support the Audio API (eg. a camera that also has a built-in speaker), but I've only tested it on the dedicated C1410 speaker device.
Type of change
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.