- 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 ```
33 lines
904 B
TypeScript
33 lines
904 B
TypeScript
import { SignedPath, signedPathSchema } from '../types';
|
|
import { homeAssistantWSRequest } from './ws-request';
|
|
import { HomeAssistant } from './types';
|
|
|
|
/**
|
|
* Request that HA sign a path. May throw.
|
|
* @param hass The HomeAssistant object used to request the signature.
|
|
* @param path The path to sign.
|
|
* @param expires An optional number of seconds to sign the path for (by default
|
|
* HA will sign for 30 seconds).
|
|
* @returns The signed URL, or null if the response was malformed.
|
|
*/
|
|
export async function homeAssistantSignPath(
|
|
hass: HomeAssistant,
|
|
path: string,
|
|
expires?: number,
|
|
): Promise<string | null> {
|
|
const request = {
|
|
type: 'auth/sign_path',
|
|
path: path,
|
|
expires: expires,
|
|
};
|
|
const response = await homeAssistantWSRequest<SignedPath>(
|
|
hass,
|
|
signedPathSchema,
|
|
request,
|
|
);
|
|
if (!response) {
|
|
return null;
|
|
}
|
|
return hass.hassUrl(response.path);
|
|
}
|