Impact of cameras on rpi3 resources

I added six mjpeg cameras to my setup and noticed a quick pile up of unfinished workers in my log, I’m remote and can’t debug in detail but I’m assuming it’s the camera’s draining the pi’s resources. Is this expected behaviour?

1 Like

I am running home-assitant on a Raspberry Pi 2 along with a Z-Stick Zwave dongle plugged into it as well controlling roughly 50 Zwave devices, and I have 4 mjpeg cameras being controlled on the same Raspberry Pi through the MotionEye software, which is saving video and snapshots on the fly with motion to a harddrive hooked up to the RPi, and total I am only using 20-30% of CPU at any given time.

Your RPI3 should be running more efficiently than my RPI2, so not sure what CPU usage you are seeing, but unless you are noticing Home Assistant delaying in running automations and not triggering on time, despite the piled up worker threads, I would pay more attention to the CPU usage. Home Assistant on my Raspberry Pi, at its peak, is only using between 3-5% CPU

I have four generic mjpeg cameras plus three more pseudo cameras I am using for animated weather maps. Same Pi is running HADashboard, harmony-api, Glances and appdaemon.

I’m on an RPi 3 and I’m usually around 12-18% for everything. Just looking now, I do see one or two transient peaks to 50% but I haven’t traced them back to anything; they may actually be reboots.

Thats weird… I am also running HADashboard and AppDaemon, and still, only 3-5% cpu usage from home-assistant and max about 30% CPU usage system wide. Oh, wait, you mean 12-18% system wide? yeah, my MotionEye takes up the most CPU of everything I am running, and your RPi 3 is more efficient than my RPI2, yet everything still fires on time and running buttery smooth :smiley: Sounds like both our systems are running pretty good, so not sure what is wrong with Tyfoon’s system.

Me neither. Tyfoon; anything else running on that Pi? Anything?

Beside HASS (all in one installer) nothing else is running on the RPI3.

I tried 12 hours without the camera’s (6x MPJPEG & 1 pseudo animated weather map) and CPU is below 5% fairly consistently. Enabled the cameras again and CPU jumps to approx 20-25%. I just did this an hour ago so will report back later to see what happens (eg stays at this level or changed dramatically).

1 Like

With the 6x MJPEG cams and 1 pseudo cam resources used go up but stay around 15-25%.

So as such I don’t think this is the cause of the slow down.

However the MJPEG cams generate a generous amount of errors in the logs (document, https://home-assistant.io/components/camera.mjpeg/) and overtime this starts to add up. I had a 42mb logfile that build up in approx 48 hours.

Not sure if this is all 100% correlated but the big log files was causing other issues.

I know what you mean, unfortunately I don’t see those errors going away anytime soon as the code that generates them is not HASS core code.

Note: Don’t do this.

If the logged errors are a major problem, you can edit the file that is generating those errors (default raspbian install puts it under /usr/local/lib/python3.4/dist-packages/requests/packages/urllib3) and comment out the function that is causing them. This is not the “right” fix, and it will be clobbered when you upgrade requests, but it will bandaid the log issue.

This is the equivalent of the landlord painting over the water damage instead of fixing the leak. (but at least in this case, the leak drips into the sink.) Only do it if you know what you’re doing, and only if you have so many cameras that the the errors make the HASS log unusable. (for me that happened on the 3rd or 4th)

I wont be putting file names, line numbers, or tips on what to do here, because if you don’t understand what you’re doing, you shouldn’t do this. (and if you do, you don’t need the help)