Hide (to secrets.yaml) username and password credentials for RTSP stream or URLs

I was intregrating my UniFi G3 Flex camera in Home Assistant through the generic camera integration. This works fine if I enter the username and password in the stream url in the configuration.yaml:

stream_source: https://username:password@ipaddress/s0

However I am not able to hide the username and password in my secrets configuration file. Is there any way to do this? It’s not responding to the authentication method described (basic or digest, which is probably for HTTP and not RTSP). I want my configuration.yaml to stay clear of passwords.

Make the whole URL the secret


So simple yet so effective, didn’t think of this. Thanks @Tinkerer.