Wyze Cams utilizing wz_mini_hacks, go2rtc RTSP, movement detection, and two-way audio. Sorta

Wyze Cams utilizing wz_mini_hacks, go2rtc RTSP, movement detection, and two-way audio. Sorta

I’m working Home Assistant in Docker for a little bit over a yr at this level. I acquired sick of writing little remoted scripts making an attempt to attach totally different sensible units and would have began sooner if I spotted how a lot HA can glue all of it collectively.

I’ve been utilizing Wyze Cams for a number of years now. I began with some V2 cams utilizing one of many earlier RTSP beta firmware variations. At some level I added a number of extra V3 cams. I’m as much as a couple of half-dozen of every and one Pan V1.

RTSP was at all times clunky, however labored high quality in iSpy the place I used it primarily. When I added the cameras to Home Assistant it bothered me that the audio channel didn’t work proper, nevertheless it wasn’t a show-stopper. I might at all times simply pop open the Wyze app on my cellphone if I actually wanted audio.

Over the previous couple months I’ve been enjoying with wz_mini_hacks and located that by switching to go2rtc audio labored. It additionally loaded the digicam feeds sooner since wz_mini_hacks gives a snapshot URL. I performed with the cmd waitMotion to do space detection inside Home Assistant, initially by way of API, and now by way of an Automation Webhook. Everything says two-way audio doesn’t work with the Wyze cams out of the field.

I observed although that I might do cmd aplay, isn’t that sort-of two-way audio? I performed with changing recordsdata to correct low high quality .wav format and will set off these by way of script. Then performed with the file pipe (mkfifo) methodology listed within the wiki.

I discovered I might use the gstreamer configuration to configure a media_player in Home Assistant that writes out to a fifo. Now I’ve HA writing to a fifo in Docker:

media_player:
  - platform: gstreamer
    title: 'tts'
    pipeline: "audioresample ! audioconvert ! audio/x-raw,price=8000,channels=1,format=S16LE ! wavenc ! filesink location=/media/voice/snapcast_gstreamer"

and cmd aplay listening to a fifo on the cam

cmd aplay /decide/wz_mini/tmp/stream 50 2> /dev/null &

I’m on the lookout for a greater strategy to join the 2 collectively. Ideally with one thing like snapcast, which I’m simply dipping my toe into now, so I might doubtlessly choose which cameras are listening to which streams, maybe have a number of streams going round the home on the similar time.

So far this works, sorta. I can begin a listener within the Docker container, in all probability exterior of it as effectively, and may in all probability mount the identical listing I might use in snapcast for the pipe into HA Docker as effectively, however that is what I’m doing:

whereas true; do cat /config/voice/snapcast_gstreamer; completed | nc -l -p 4001

Then on the Wyze cam I can connect with that listener and output the stream to the pipe that cmd aplay is listening to.

nc 192.168.42.1 4001 >> /decide/wz_mini/tmp/stream &

And if I time all of it proper, I can play a media file in Home Assistant and it’ll come out of the speaker of the Wyze Cam. That’s two-way audio, proper? The downside is, and I haven’t discovered all the precise timing, that I’ve to begin all of it in the appropriate order after which it solely performs as soon as. I feel this has to do with nc liking to exit when it will get an EOF. I feel I acquired the server/listener aspect working, however each the Wyze nc “shopper” and the cmd aplay command exist after the stream ends.

I’m positive I might loop the shopper aspect too, perhaps digging into snapcast is the appropriate path, and I can simply have it ship silence which can hold the stream going and hold all of it lively and I’m over pondering it. Either manner I would like to jot down up some daemons or command_line integrations to begin these processes and hold them working on HA and every of the cameras.

Instead of constant to construct the Rube Goldberg contraption I’ve began I ask you is there a greater, extra direct strategy to get audio out of Home Assistant? I feel I need it to indicate up as a media_player, however might be satisfied I’m doing it improper. I’d like to ultimately have a PTT (push-to-talk) button on my look digicam playing cards that might simply document a little bit of audio and stream it to the speaker. If I’ve to enter Media → Text-to-speech and sort it out, that’s high quality too.

Thoughts?

1 submit – 1 participant

Read full subject

HI-FI News

by way of Home Assistant Community – Latest subjects https://ift.tt/AxQz0g5

February 10, 2024 at 10:34PM