Home Assistant: Octoprint Camera not working

What is the problem?

After setting up Octoprint as a device in Home Assistant, all entities are reported and working, except the camera. HA reports the camera as idle (see attached) even though the stream is fully functional.

What did you already try to solve it?

  • Have confirmed stream works in Octoprint
  • Have used the same streaming path in a generic camera (works)
  • Have rebooted both HA and OctoPrint
  • Have tried to remove and reinstall the OctoPrint device in HA several times
  • Have manually edited HA files to purge old instances of Octoprint before reinstalling.

Have you tried running in safe mode?

  • yes

Did running in safe mode solve the problem?

  • no

Systeminfo Bundle

octoprint-systeminfo-20230302162105.zip (63.8 KB)

Additional information about your setup

This worked fine with same HA installation and a previous install of OctoPi. However, due to trying to sort out issues with the official RPI HQ Camera for days, I created a new instance with a manual OctoPrint installation (Buster Lite). Camera functions perfectly.both in OS and OctoPrint Control window both with and without HA Proxy.

Needed to update to v1.8.7 to get the HA integration working due to API issues caused by recent babel updates.

Screenshot of what I'm seeing in HA provided.

Can you change the webcam url in HA?
If yes check the url you're using also works in a browser or vlc.

Yes the URL works in the browser.

Not sure where to change in HA specifically, though - I expect I might need to edit a file manually but not sure which.

If you don't get an answer here, try it in the HA forum :slight_smile:

I plan to. I thought it might have been an issue related to the v1.8.7 upgrade, but now I'm not so sure as really everything on the OctoPrint side seems to be working just fine.

Same here. Camera unavailable. But this is likely a HA topic since it worked with OP 1.8.6 before and after updating HA it went to unavailable state. Updating OP to 1.8.7 didn't change the behaviour within HA so I guess something happened over there. Let's check on the other side... :wink:

Interesting...I didn't update anything on the HA side myself.

As a test just now, I shutdown HA, plugged my 1.8.6 (OctoPi) instance back in and started HA back up. HA prompted me to reconfigure, where I supplied the user ID for OP and accepted the request on the OP side. Guess what...it works!

So I'm really inclined to believe it's something on the OctoPrint side now. Just don't know if it's an issue with 1.8.7, babel or something went awry with the manual installation.

At least it's working now, though.

Thank you for the update.
Another reboot later on both ends and camera is back. No idea what caused the hickup...
All good again.

So I started to play around more to break it again. It would seem that if you change the webcam codec setting in OP from libx264 to mpeg2video, it causes HA to barf with the error I posted above. What's worse...setting back to libx264 doesn't restore the connection even after removing/re-adding the device and reboots.

The only solution I've been able to find in that situation was to create a new OctoPi image and set up the HA device accordingly.

That's... Quite strange. This codec selection is only used to render the timelapses (in OctoPrint), it hasn't got anything to do with the actual streaming of the webcam. I wonder what HA might do with it causing this.

Strange, just checked mine and it is also Idle and its frozen, but it must have worked at somepoint since th build plate is down since I am doing a print

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.