Repository: OctoPrint

As there have been questions about webcam support, I thought I would add some more information since I now got my Pi camera module working.

Thank you for the description @mirekmal

  • In addon configuration you can set options for mjpg-streamer, if needed. Default works for me, but I am unable to verify for USB camera since I don’t have one available.
  • In OctoPrint snapshots will work without exposing any ports, webcam stream requires port to be exposed (it must be available to the device that shows it).
    • Webcam stream requires that you expose either WebUI or mjpg-streamer (port 5000 or 8000, you should be able to change those). Note that the stream is not secured by default, anyone can access it. You can add basic authentication through: mjpg_output: 'output_http.so -w /www_mjpg -c "username:password"'.
  • You can add the webcam as an mjpeg camera in Home Assistant. If you have either WebUI or mjpg-streamer exposed, you can use that URL. See post 106 by @mirekmal for an example.
  • Camera does not autostart, that would cause issues for anyone without a camera. You can use events in OctoPrint to have it start automatically, I’ve included the following in the “Documentation” tab of the addon:
    events:
      enabled: true
      subscriptions:
      -   command: supervisorctl start mjpg-streamer
          enabled: true
          event: Startup
          type: system
    

Being trying to connect my Ender 3 (with 8 bits board) to the plugin, but keeping receiving this message error:
Offline (Error: No more candidates to test, and no working port/baudrate combination detected.)
I’m running home assistant on a raspberry pi 2.
Can someone help me ?

Could you check the following?

  1. Make sure the printer is connected and on.

  2. Verify that Home Assistant can see the printer. If you go to Supervisor - System - Host - (press the three vertical dots) - Hardware, what devices do you have listed under serial?
    With my setup (Raspberry Pi 3B+, Ender 3 Pro) there are three entries, the relevant for me are /dev/ttyUSB0 and /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0.

  3. Have you tried to restart the addon? In OctoPrint use the “system” (power) menu and Reboot system.
    Devices are only discovered by the addon when it starts, I haven’t figured out new devices are not automatically discovered.

  4. In OctoPrint, under “Connection”, what devices are available under “Serial Port”?
    If you had /dev/ttyUSB0 in step 1, you want to see that device also here. Don’t worry if /dev/serial/by-id/usb-... is not visible here.

  5. What baudrate do you have?
    I have it on auto, which then sets to 115200 when I connect.

1 Like

I’ve flashed th3studio firmware yesterday and tried all the things you told. Don’t know what but i was doing something wrong. Today it’s working fine. Thanks for the help!!

One other question, is it possible to link an android app to this instance of octoprint ?
Forget it. Got it :sweat_smile::sweat_smile::sweat_smile:

When I attempted to install the octoprint plugin bed level visualizer I get an error. I believe it might have to do with the plugin requiring a Python dependency called numpy. Has anyone had success installing bed level visualizer.

I am on a raspberry pi 4 4gb. I will most the actual error here if necessary.

Thanks

Have you tried to enable add_build_packages in the addon settings? I believe that will allow for the plugin to install.

fredrikbaberg

Thanks for the help and for the great addon. To make the change I went to Supervisor, Octoprint, Configuration, checked add_build_packages and clicked save. What was odd though is a successfully install multiple plugins prior to enabling said setting.

Thanks

This is due to different requirements/dependencies of the plugins. numpy probably needs python-dev or some other package to install, which is not included by default.

Hi, I installed the Octoprint add on in Hassio and it works really well. I’m pretty satisfied, I must thank fredrikbaberg for the great job done.
Just one small issue is making me crazy: the ip-camera that runs perfectly if I type its local ip.
When I set it in the Octoprint settings, it doesn’t work…but if I launch the webUI in the "http://homeassistant:5000/ (that means in a separate tab of my browser)… IT RUNS!!
My question is simply: why!?
Can someone hel p me to understand?
Thanks a lot
AL

My setup is currently offline, and I don’t have an ip-camera available, so I can’t test much right now. Could you tell me the following?

  • Are there any error messages when you try to view the webcam stream?
  • Do you access your instance through SSL (HTTPS) or HTTP?
  • Do you have CORS enabled? If not, could you enable it and see if it helps? It’s available under Settings - API.

Hi fredrikbaberg, when I try to reach the camera from the addon UI I see in the tab “Control” a black panel with this sentence “Webcam stream not loaded, it might be not configured correctly…you can change the URL…”
As said previously, if I don’t change the url but simply open a new tab in my browser and type the address of the webUI of octoprint at port 5000 (for instance, http://192.168.x.x:5000) I see the stream regularly.
So, answering to you question: the first attempt is made in the Hassio session with HTTPS address, while the second is just HTTP.
I also tried the CORS enabled setting but it doesen’t change the situation.
I guess it could be a SSL problem but I don’t understand the reason since hassio works fine.
Thanks a lot for any suggestion
AL

SOLVED!
The problem was in the SSL configuration, if I disable it and connect with HTTP:// it works and shows me the IP camera stream, both with local and web access.
Thank you!
AL

I’ve verified that I have the same issue if I connect through HTTPS. I believe the issue is with the configuration of HAProxy, which is used to enable access to the webcam, but I haven’t figured out how to fix it.
To change from https:// to http:// is not the best idea. I’ll need to look around at the documentation or find someone with more knowledge of reverse proxy, but am not sure when I’ll have time to do so.

I agree with you but It was important at least to recognize the issue. Waiting for a solution I thank you very much for your support.
Alberto

I’ve spent a few days on trying to figure out the camera stream, without progress. I think it should “only” be a case of proper configuration of the reverse proxy but have not been successful in figuring it out. As a workaround, while trying with the “dev” version I noticed that if the video stream is served over HTTPS it seems to work in Ingress. I have Traefik setup as a reverse proxy for Home Assistant, so it was straightforward to add for me but requires extra configuration.

The goal would be to access the video stream through Ingress without exposing any ports. Even without HTTPS I’ve been unable to make this work.
Any ideas how to configure this correctly is appreciated, please let me know.

Just wanted to ask and make sure as I am new with home assistant and octoprint. Is this supposed to enable usage of Home Assistant OS and octoprint on same device?

Yes, that´s the purpose of this addon, it enables to you use a single device (e.g. Raspberry Pi) for both Home Assistant OS and OctoPrint.

Note that this addon does not add sensors to Home Assistant. There is an official integration for OctoPrint that can be used, or you can use MQTT through a plugin for OctoPrint.

1 Like

Hello, trying to figure out how to enable a usb camera that’s connected to my RPi4. Any suggestions ? Thanks in advance

Which version of the addon are you using, and what have you tried so far?

Have you made sure to start mjpg-streamer? It can be started from OctoPrint UI, same menu as for stop and restart.

There are some lines about camera in the tab Documentation. You can also look at the issues in the GitHub repository for more information, especially: Problem with the webcam · Issue #113 · fredrikbaberg/hassio-addons (github.com).

Not sure if anyone seen it yet, but I’ve been working on an update to the addon. Working name is “OctoPrint Next”, but that may change in the future. I’m using this myself for printing, with Raspberry Pi camera and a fan controlled by GPIO.

Some of the changes are:

  • Using Python 3.
  • GPIO support.
  • Files stored in a folder local to the addon instead of /config (no longer user accessible, will be purged on uninstall, but keeps everything clean).

Not fixed:

  • Access to webcam without exposing port.