TzuHuanTai / Pi-Camera

Transform your Raspberry Pi into a powerful home security camera with the Pi Camera app.
26 stars 3 forks source link

Need help adding correct uid in pi-webrtc service file #1

Open macphyter opened 1 month ago

macphyter commented 1 month ago

Creating the pi-webrtc systemd service file, the command line to execute pi_webrtc has a parameter "--uid". Do I set this to the device uuid in the mqtt config, or do I use the Alias? Also, is STUN/TURN necessary for remote access to camera?

TzuHuanTai commented 1 month ago

The argument --uid=your-uid-in-the-app must match the device uid listed in Pi Camera App. You can create a new device in the app, clear the default generated uid then paste your-uid-in-the-app to the input. Alias is only used for the name of the device you'd like to display on the app.

STUN/TURN is not necessary in most scenarios unless your Pi uses 5G cellular internet or a special intranet.

macphyter commented 4 weeks ago

Thanks for your comment. I've been wrestling with this for hours and I can't seem to make it work. For starters, I'm just trying to make it work on my internal home network. I have mosquitto running on my Home Assistant server on a dedicated Raspberry Pi 4 using port 1883, and from the Raspberry Pi zero command line I can subscribe and publish, and it seems to be working fine. My android phone is on my home network, and it can ping both the Pi zero and the HA server.
When I start the pi-webrtc systemd service it runs, and I've got resulting video/jpgs in /mnt/ext_disk/video/20240926/22/... I've configured the android app with the mqtt details, using websocket port 1884. I've created the device in the andoid app, and copied the uuid to the systemd service file. I just get nothing but the little weiner dog in the window.

One question- in the android app config, there's a field "Path" set to "/mqtt" by default. Do I need to set this to something particular?

TzuHuanTai commented 4 weeks ago

The Path is set /mqtt in default because most cloud providers would use reverse proxy on top of the mqtt service. My mosquitto is also using nginx to reverse proxy the MQTT WebSocket port and expose it under the /mqtt path. You can try to leave the "Path" blank if you connect to the mqtt server directly.

By the way, the status light left-top of the dog is gray means the mqtt server is not connected successfully. Red means mqtt server is connected, but it can not find any device that has the same uid.

macphyter commented 4 weeks ago

OK, good to know about the status light. I'm getting the gray status light, so apparently the android app can't find the mqtt server. I tried leaving the "path" setting blank, but still no luck. I've used the command line on the Pi zero to verify that the mqtt server is responding on port 1883... do you know how to verify if it is responding on the websocket port 1884? Should I reconfigure the server to use ports 8883/8884?

TzuHuanTai commented 4 weeks ago

I guess you face the same issue here. The app only accepts connections with SSL/TLS. It's a part of Google's policy.

macphyter commented 4 weeks ago

OK, I went to hivemq.cloud and set up an external mqtt broker. I went through all the settings and made sure the uuid was correct, and the username and password... and now BOOM! Its working! Thanks for your help, this is very cool.