fix: Improve 2-way audio detection (#2293)

- For Frigate cameras, you must be running at least [integration
v5.12.0](https://github.com/blakeblackshear/frigate-hass-integration/releases/tag/v5.12.0).
 - Closes: #2191 

Includes a significant refactor of cameras, and the introduction of a
`2-way-audio` capability that is dynamically fetched from `go2rtc`. One
gotcha is if you previously had a substream with 2-way audio, you may
need to modify

```yaml
 - camera_entity: camera.foo
    capabilities:
      disable_except:
        - substream
```

... to ...

```yaml
 - camera_entity: camera.foo
    capabilities:
      disable_except:
        - substream
        - 2-way-audio
```
This commit is contained in:
Dermot Duffy
2025-12-20 13:06:09 -08:00
committed by GitHub
parent 588ed6c98a
commit 1e821f09c6
47 changed files with 2240 additions and 958 deletions
@@ -295,21 +295,26 @@ describe('GenericCameraManagerEngine', () => {
});
describe('should get camera endpoints', () => {
it('default', () => {
expect(createEngine().getCameraEndpoints(createGenericCameraConfig())).toBeNull();
it('default', async () => {
const camera = await createEngine().createCamera(
createHASS(),
createGenericCameraConfig(),
);
expect(camera.getEndpoints()).toBeNull();
});
it('for go2rtc', () => {
expect(
createEngine().getCameraEndpoints(
createGenericCameraConfig({
go2rtc: {
stream: 'stream',
url: '/local/path',
},
}),
),
).toEqual({
it('for go2rtc', async () => {
const camera = await createEngine().createCamera(
createHASS(),
createGenericCameraConfig({
go2rtc: {
stream: 'stream',
url: '/local/path',
},
}),
);
expect(camera.getEndpoints()).toEqual({
go2rtc: {
endpoint: '/local/path/api/ws?src=stream',
sign: true,
@@ -317,14 +322,15 @@ describe('GenericCameraManagerEngine', () => {
});
});
it('for webrtc-card', () => {
expect(
createEngine().getCameraEndpoints(
createGenericCameraConfig({
camera_entity: 'camera.office',
}),
),
).toEqual({
it('for webrtc-card', async () => {
const camera = await createEngine().createCamera(
createHASS(),
createGenericCameraConfig({
camera_entity: 'camera.office',
}),
);
expect(camera.getEndpoints()).toEqual({
webrtcCard: {
endpoint: 'camera.office',
},