Giter VIP home page Giter VIP logo

moonraker-obico's Introduction

The Obico Server

This repo is everything you need to run a self-hosted Obico Server.

Obico is a community-built, open-source smart 3D printing platform used by makers, enthusiasts, and tinkerers around the world.

The AI failure detection in this project is based on a Deep Learning model. See how the model works on real data.

Install and run the server

Note: For more detailed instructions, head to the Obico Server guide.

Prerequisites

The Obico Server only requires a computer to run. Even old PCs (within the previous 10 years) will do just fine. An Nvidia GPU is optional but can vastly increase the power consumption and beef up the number of printers the server can handle.

Detailed hardware minimum specs.

Software requirements

The following software is required before you start installing the server:

  • Docker and Docker-compose. But you don't have to understand how Docker or Docker-compose works.
    • Install Docker (Windows, Ubuntu, Fedora, CentOS, Mac). Important: If your server has an old Docker version, please follow the instructions in these links to upgrade to the latest version, otherwise you may run into all kinds of weird problems.
    • Install Docker-compose. You need Docker-compose V2.0 or higher.
  • git (how to install).

Email delivery

You will also need an email account that has SMTP access enabled (gmail will not work. As of May 30, 2022 Google has removed the option for allowing SMTP access). Other web mail such as Yahoo should work but we haven't tried them.

Get the code and start the server

  1. Get the code:
git clone -b release https://github.com/TheSpaghettiDetective/obico-server.git
  1. Run it! Do either one of these based on what OS you are using:

    • If you are on Linux: cd obico-server && sudo docker compose up -d
    • If you are on Mac: cd obico-server && docker-compose up -d
    • If you are on Windows: cd obico-server; docker-compose up -d
  2. Go grab a coffee. Step 2 will take 15-30 minutes.

  3. There is no step 4. This is how easy it is to get Obico up and running (thanks to Docker and Docker-compose).

Open "http://localhost:3334" on the same computer. Voila - your self-hosted Obico Server is now up and running!

Login page

Server Configuration

Upon fresh installation, the Obico Server can only work on the localhost. You will need to configure its IP address. Here is how:

Obtain server's IP address

Recommended Read: Connecting to your server with a .local address

This refers to the LAN IP address that has been given to the computer that the Obico server is running on.

  • If you are on Linux: Open the wifi settings and select "settings" for the network your device is currently connected to. Look for the IPv4 value.
  • If you are on Windows: Select "Properties" for the network your device is connected to, then look for the IPv4 value.
  • If you are on Mac: Go to Settings > Network. You will find your IPv4 value below the wifi status.

The Obico Server needs to have an IP address that is accessible by OctoPrint or Klipper. It can be a private IP address (192.168.x.y, etc) but there needs to be a route between OctoPrint and the Obico Server.

It is also recommended that a static IP is set to avoid issues with changing IP's. Please look up your WiFi routers guide on how to do this.

Login as Django admin

  1. Open Django admin page at http://your_server_ip:3334/admin/.

Note: If the browser complains "Can't connect to the server", wait for a couple more minutes. The web server container may still be starting up.

  1. Login with username [email protected], password supersecret. Once logged in, you can optionally (but are highly encouraged to) change the admin password using this link: http://your_server_ip:3334/admin/app/user/1/password/.

Configure Django site

  1. In the same browser window, go to the address http://your_server_ip:3334/admin/sites/site/1/change/. Change "Domain name" to your_server_ip:3334. No "http://", "https://" prefix or trailing "/", otherwise it will NOT work. Note: Deleting the original site and adding a new one won't work, thanks to the quirkiness of Django site.

  2. Click "Save". Yes it's correct that Django is not as smart as most people think. ;)

Site configuration

Note: If you are using reverse proxy, "Domain name" needs to be set to reverse_proxy_ip:reverse_proxy_port. See using a reverse proxy for details.

That's it! You now have a fully-functional Obico Server that your OctoPrint can talk to. We hope setting up the server has not been overwhelming.

Configure clients to use self-hosted Obico Server

Contribute to Obico

Feeling excited? Want to contribute? Check out how.

Difficulties in getting the Obico server up and running?

Browse and search in the Obico Server guide website. If you can't find the answer there, consult the Discord or open an issue.

Thanks

BrowserStack BrowserStack generously sponsors a free license so that I can test Obico webcam streaming on different browsers/versions. Moonraker for the source code to extract g-code metadata.

moonraker-obico's People

Contributors

aarontuftss avatar bwnance avatar crashmaxx avatar dipuzyrev avatar encetamasb avatar guilouz avatar kennethjiang avatar mallocarray avatar mhaas avatar mkuf avatar raymondh2 avatar zayigo avatar zellneralex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

moonraker-obico's Issues

restart_action: moonraker-obico-.service' contains an invalid value

Having this issue on Moonraker.

[update_manager moonraker-obico]: Option 'restart_action: moonraker-obico-.service' contains an invalid value 'moonraker-obico-.service'. All values must be one of the following choices: ['moonraker-obico', 'klipper', 'moonraker']

Screenshot 2022-07-13 at 18 12 39

I tried looking for the option 'Restart_action' but couldn't find anything. A member on Reddit had the same issue and fixed by removing -.service from managed services in moonraker-obico-update.cfg - Unfortunately this fix didn't work for me.

Moonraker Warning(s) on start up, everything else working properly.

The warnings:

Moonraker warning

Unparsed config option 'managed_services:
moonraker-obico' detected in section [update_manager moonraker-obico]. This may be an option no longer available or could be the result of a module that failed to load. In the future this will result in a startup error.

Moonraker warning

Unparsed config option 'install_script: install.sh' detected in section [update_manager moonraker-obico]. This may be an option no longer available or could be the result of a module that failed to load. In the future this will result in a startup error.

Moonraker warning

Unparsed config option 'requirements: requirements.txt' detected in section [update_manager moonraker-obico]. This may be an option no longer available or could be the result of a module that failed to load. In the future this will result in a startup error.

Moonraker warning

Unparsed config option 'origin: https://github.com/TheSpaghettiDetective/moonraker-obico.git' detected in section [update_manager moonraker-obico]. This may be an option no longer available or could be the result of a module that failed to load. In the future this will result in a startup error.

Moonraker warning

[update_manager]: Failed to load extension moonraker-obico: [Errno 13] Permission denied: '/root/moonraker-obico-env/bin/pip'

From first impressions, Obico connects to my self-hosted Obico server and works normally. No idea if these warnings carry any issues of proper operation.

flip_h and flip_v aren't working in moonraker

I have one camera that has a better view of prints, but it's upside down and backwards. I've tried setting the variables "flip_h" and "flip_v" to true, but the image in obico is still inverted and backwards. Is there something wrong with these variables at the moment?

Create ~/klipper_logs if it doesn't exist

After installation, the systemd unit will fail to start if the directory for logs doesn't exist, as soon as it's created it runs successfully.

Maybe a handler for creating the folder for logs if it doesn't exist would be a good addition?

Print progress percentage not showing

Ive used this in my moonraker config

[virtual_sdcard]
path: home/pi/gcode_files

[display_status]

[pause_resume]

But I can't see the print progress or temprature status. Have I done something wrong or is this an issue? Previous post had a screenshot of his print % showing but no eta on finish, just seeing % and temptratures would be a great start for me. Any help is appreciated.

error on install.sh and verification code not accepted.

Hi,

(sorry for the weird formatting, trying to add as code didn't work for me for whatever reason)

I have set up a self hosted Obico server running behind a Nginx proxy as described in the docs. I can access this server via https://obico.home. I also configured the domain as "https://obico.home" in django, tried without https:// before.
When I try to add a printer, I followed the instructions to clone the repo, then ran ./install.sh

Before that, I copied the moonraker-obico.cfg.sample to moonraker-obico.cfg and updated as folllows:
``
[server]
url = https://obico.home

auth_token: <let the link command set this, see more in readme>

sentry_opt: out or in

[moonraker]
host = 127.0.0.1
port = 7125
#api_key =

[webcam]
disable_video_streaming = False

#flip_h = False
#flip_v = False
#rotate_90 = False
#aspect_ratio_169 = False

#CAUTION: Don't modify the settings below unless you know what you are doing
#In most cases webcam configuration will be automatically retrived from moonraker
#snapshot_url = http://127.0.0.1:8080/?action=snapshot
#stream_url = http://127.0.0.1:8080/?action=stream

[logging]
path = /home/pi/klipper_logs/moonraker-obico.log
level = INFO

`

When running ./install.sh, this is the console:

`
pi@ratos:~/moonraker-obico $ ./install.sh

======================================================================================================

Install and Configure Obico for Klipper

======================================================================================================

Installing required system packages... You may be prompted to enter password.

Hit:1 http://archive.raspberrypi.org/debian buster InRelease
Hit:2 https://deb.nodesource.com/node_16.x buster InRelease
Hit:3 http://raspbian.raspberrypi.org/raspbian buster InRelease
Hit:4 https://dl.yarnpkg.com/debian stable InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3 is already the newest version (3.7.3-1).
python3-venv is already the newest version (3.7.3-1).
ffmpeg is already the newest version (7:4.1.10-0+deb10u1+rpt1).
python3-pip is already the newest version (18.1-5+rpt1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Detecting the softwares and settings of your Klipper system ...

Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.7/configparser.py", line 958, in getitem
raise KeyError(key)
KeyError: 'server'

We couldn't automatically detect the settings. Please enter them below to continue.

!!!WARNING: Manually entering the Moonraker settings can be error prone.
We highly recommend using KIAUH if you have a non-standard Klipper installation, e.g., running multiple Moonraker instances.

Moonraker port: 7125^C


/ __
| | | | ___ ___ ___ ___ _ __ ___
| | | |/ _ \ / _ \ / _ \ / _ | '_ / |
| |
| | () | () | () | () | |) _ \ _ _ _
_/ _/ _/ _/ _/| ./|/ () () ()
| |
|
|

The installation has run into an error:

Installation interrupted by user or for unknown error.

Please fix the error above and re-run this setup script:


cd ~/moonraker-obico
./install.sh

Need help? Stop by:

When opening the URL https://obico.home/api/v1/octo/verify/ in the browser I get a message "{"code":["This field may not be null."]}" - but this may be expected.

WHat can I do to successfully link my printer?

Images are not being sent to server when `disable_video_streaming` is `True`

I have disabled video stream (disable_video_stream = True) in my config in order to save on CPU usage when the printer is not printing.

However, when the printer is printing, images are not being sent/streamed to the server. The server is correctly displaying that the printer is printing but the image is just a broken image link:
image

Error in install instructions

The instructions did not work correctly for me. I followed the first few steps:

python3 -m venv tsd-moonraker/
 cd tsd-moonraker

Those worked fin. However the next step did not:

~/tsd-moonraker $ source venv/bin/activate
-bash: venv/bin/activate: No such file or directory

There was no venv directory in the tsd-moonraker directory. Instead what worked for me was:

source ./bin/activate

Error updating moonraker-Obico

As title said , Obico not update in klipper

The box in moonraker remain ILLEGAL. No way to recovery

The output of recovery command says

fatal: unable to access 'https://hub.fastg
it.xyz/TheSpaghettiDetective/moonraker-obi
co.git/': Failed to connect to hub.fastgit
.xyz port 443: Connection timed out

Same thing if I try to update by kiauh

How can I do?

Thank you

`wsconn.py` is too complicated to be reusable

wsconn.py is closely tied to moonraker communication protocol. Hence I had to add ws.py with duplicated chunks of code to handle communication with janus.

wsconn.py is even too complicated for communicating with Obico server. It seems to make sense to move the moonraker-specific parts to moonraker_conn.py, and combined wsconn.py with ws.py.

Service fails to connect to moonraker upon boot

When booting up the computer, moonraker-obico likely attempts to connect to moonraker. However in the app, it doesnt detect the printer being online, however it still posts an imagefeed...

Current fix is to just run sudo systemctl restart moonraker-obico once moonraker is active, alternatively run install.sh again.

2022-05-15 14:52:08,283      INFO  obico - starting moonraker-obico (v0.1.1)
2022-05-15 14:52:08,288     DEBUG  obico - ServerConfig(url='https://app.obico.io', auth_token='<SECRET_TOKEN>', upload_dir='Obico_Upload', feedrate_xy=100, feedrate_z=10)
2022-05-15 14:52:08,292     DEBUG  obico.tsdconn - fetching printer data
2022-05-15 14:52:08,293   WARNING  obico.moonrakerconn - api key is unset, trying to fetch one
2022-05-15 14:52:08,294     DEBUG  obico.tsdconn - GET https://app.obico.io/api/v1/octo/printer/
2022-05-15 14:52:08,294     DEBUG  obico.moonrakerconn - GET {url}
2022-05-15 14:52:08,608      INFO  obico.tsdconn.ws - connecting to wss://app.obico.io/ws/dev/
2022-05-15 14:52:08,609      INFO  obico - linked printer: {'is_pro': True, 'id': 109179, 'name': 'Monstadt'}
2022-05-15 14:52:08,609     DEBUG  obico.tsdconn - waiting for connection
2022-05-15 14:52:08,863      INFO  obico.tsdconn - connection is ready
2022-05-15 14:52:08,864      INFO  obico - capturing and posting snapshot
2022-05-15 14:52:08,865     DEBUG  obico.webcam - GET http://127.0.0.1:8080/?action=stream
2022-05-15 14:52:08,866     DEBUG  obico.tsdconn.ws - sending {"current_print_ts": -1, "octoprint_data": {}, "octoprint_settings": {"webcam": {"flipV": false, "flipH": false, "rotate90": false, "streamRatio": "4:3"}, "agent": {"name": "moonraker_obico", "version": "0.1.1"}}}
2022-05-15 14:52:08,877     DEBUG  obico.tsdconn.ws - receiving {"remote_status": {"viewing": false, "should_watch": false}}
2022-05-15 14:52:08,879      INFO  obico - from tsd: {'remote_status': {'viewing': False, 'should_watch': False}}
2022-05-15 14:52:08,883     DEBUG  obico.tsdconn - POST https://app.obico.io/api/v1/octo/pic/
2022-05-15 14:52:09,348      INFO  obico - posting snapshot finished
2022-05-15 14:52:14,306     DEBUG  obico.tsdconn.ws - sending {"current_print_ts": -1, "octoprint_data": {}}
2022-05-15 14:52:19,311     DEBUG  obico.tsdconn.ws - sending {"current_print_ts": -1, "octoprint_data": {}}
2022-05-15 14:52:37,897     DEBUG  obico.tsdconn.ws - sending {"current_print_ts": -1, "octoprint_data": {}}
2022-05-15 14:53:27,954     DEBUG  obico.tsdconn.ws - sending {"current_print_ts": -1, "octoprint_data": {}}
2022-05-15 14:54:09,001      INFO  obico - capturing and posting snapshot
2022-05-15 14:54:09,003     DEBUG  obico.webcam - GET http://127.0.0.1:8080/?action=stream
2022-05-15 14:54:09,031     DEBUG  obico.tsdconn - POST https://app.obico.io/api/v1/octo/pic/
2022-05-15 14:54:09,639      INFO  obico - posting snapshot finished
2022-05-15 14:54:18,011     DEBUG  obico.tsdconn.ws - sending {"current_print_ts": -1, "octoprint_data": {}}

image

Minor documentation error? Compatible mode doesn't preserve fps

The documentation (https://www.obico.io/docs/user-guides/webcam-streaming-resolution-framerate/) says:

When the webcam streaming is in "Basic" mode, or "Premium (compatibility)" mode, The Spaghetti Detective plugin won't change the resolution or the frame rate. Instead, they are set by the OctoPrint's original streaming process before The Spaghetti Detective plugin was installed.

However, in compatible mode the routine ffmpeg_from_jmpeg sets fps to 25 (for pro) or 5 for non-pro. Now the underlying content will still be based on 5 fps but the stream will presumably be interpolated up/down to 25 or 5 fps.

Which begs the question, why not match the frame rate of the camera (subject to maximum of 25/5)?

Presumably, one can query using 'ffmpeg -i stream_url'

Flip camera horizontally/vertically

Hi,

I was wondering if there's any way to flip the camera horizontally & vertically. My camera is mounted upside down and when I used OctoPrint, the plugin would automatically detect that I had the camera flipped and would apply the same to the TSD stream.

Now that I switched to Klipper & Moonraker, I noticed that the Moonraker version of TSD does not do that and does not seem to offer this functionality in the configuration (yet?). However, I also understand that this is an early version of the plugin, so I'm not too surprised :)
Is this planned in the future? Does the TSD AI still work properly with an upside-down image?

Handshake status 404 Not Found

Hi, I am getting an error about Handshake error.

(tsd-moonraker) pi@ender3:~/tsd-moonraker $ python3 -m tsd_moonraker.app -c config.ini -l tsd_moonraker.log
2021-12-28 14:33:30,024      INFO  main - starting tsd_moonraker (v0.1)
2021-12-28 14:33:30,028   WARNING  main.moonrakerconn - api key is unset, trying to fetch one
2021-12-28 14:33:30,066      INFO  main.moonrakerconn.ws - connecting to ws://127.0.0.1:7125/websocket
2021-12-28 14:33:30,087      INFO  main.moonrakerconn - waiting for klipper ready
2021-12-28 14:33:30,112      INFO  main.moonrakerconn - printer objects: ['webhooks', 'configfile', 'mcu', 'firmware_retraction', 'gcode_move', 'print_stats', 'virtual_sdcard', 'menu', 'display_status', 'output_pin beeper', 'pause_resume', 'filament_motion_sensor motion_sensor', 'probe', 'bed_mesh', 'heaters', 'heater_bed', 'tmc2209 stepper_x', 'tmc2209 stepper_y', 'tmc2209 stepper_z', 'tmc2209 extruder', 'fan', 'heater_fan extruder_cooler_fan', 'gcode_macro START_PRINT', 'gcode_macro END_PRINT', 'gcode_macro PRIME_LINE', 'gcode_macro CG28', 'gcode_macro G29', 'gcode_macro M125', 'gcode_macro LOW_TEMP_CHECK', 'gcode_macro pause_print', 'gcode_macro resume_print', 'gcode_macro CANCEL_PRINT', 'motion_report', 'query_endstops', 'idle_timeout', 'system_stats', 'toolhead', 'extruder']
2021-12-28 14:33:30,198      INFO  main - linked printer: {'is_pro': True, 'id': 2, 'name': 'Ender3'}
2021-12-28 14:33:30,199      INFO  main.tsdconn.ws - connecting to wss://MYDOMAINNAME/ws/dev/
2021-12-28 14:33:30,275     ERROR  main.tsdconn - Handshake status 404 Not Found (Handshake status 404 Not Found), reconnecting
2021-12-28 14:33:30,276     ERROR  main.tsdconn - backing off 0.196355 seconds: Handshake status 404 Not Found
2021-12-28 14:33:30,364      INFO  main.moonrakerconn - heaters: ['heater_bed', 'extruder']
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/home/pi/tsd-moonraker/tsd_moonraker/wsconn.py", line 241, in start
    self.flow()
  File "/home/pi/tsd-moonraker/tsd_moonraker/app.py", line 131, in flow
    self.wait_for(self._received_last_job)
  File "/home/pi/tsd-moonraker/tsd_moonraker/wsconn.py", line 295, in wait_for
    if self._wait_for(event, process_fn, timeout_msecs):
  File "/home/pi/tsd-moonraker/tsd_moonraker/app.py", line 153, in _wait_for
    event, process_fn, timeout_msecs)
  File "/home/pi/tsd-moonraker/tsd_moonraker/wsconn.py", line 334, in _wait_for
    if process_fn(event):
  File "/home/pi/tsd-moonraker/tsd_moonraker/app.py", line 213, in _received_last_job
    Event(sender=self.id, name='last_job', data=jobs[0])
IndexError: list index out of range

2021-12-28 14:33:30,626      INFO  main.tsdconn.ws - connecting to wss://MYDOMAINNAME/ws/dev/
2021-12-28 14:33:30,627      INFO  main - linked printer: {'is_pro': True, 'id': 2, 'name': 'Ender3'}
2021-12-28 14:33:30,686     ERROR  main.tsdconn - Handshake status 404 Not Found (Handshake status 404 Not Found), reconnecting
2021-12-28 14:33:30,687     ERROR  main.tsdconn - backing off 0.691136 seconds: Handshake status 404 Not Found
2021-12-28 14:33:31,537      INFO  main - linked printer: {'is_pro': True, 'id': 2, 'name': 'Ender3'}
2021-12-28 14:33:31,537      INFO  main.tsdconn.ws - connecting to wss://MYDOMAINNAME/ws/dev/
2021-12-28 14:33:31,591     ERROR  main.tsdconn - Handshake status 404 Not Found (Handshake status 404 Not Found), reconnecting
2021-12-28 14:33:31,592     ERROR  main.tsdconn - backing off 0.633144 seconds: Handshake status 404 Not Found
2021-12-28 14:33:32,383      INFO  main - linked printer: {'is_pro': True, 'id': 2, 'name': 'Ender3'}
2021-12-28 14:33:32,384      INFO  main.tsdconn.ws - connecting to wss://MYDOMAINNAME/ws/dev/
2021-12-28 14:33:32,513     ERROR  main.tsdconn - Handshake status 404 Not Found (Handshake status 404 Not Found), reconnecting
2021-12-28 14:33:32,514     ERROR  main.tsdconn - backing off 1.466053 seconds: Handshake status 404 Not Found
2021-12-28 14:33:34,165      INFO  main.tsdconn.ws - connecting to wss://MYDOMAINNAME/ws/dev/
2021-12-28 14:33:34,165      INFO  main - linked printer: {'is_pro': True, 'id': 2, 'name': 'Ender3'}
2021-12-28 14:33:34,234     ERROR  main.tsdconn - Handshake status 404 Not Found (Handshake status 404 Not Found), reconnecting
2021-12-28 14:33:34,235     ERROR  main.tsdconn - backing off 5.936400 seconds: Handshake status 404 Not Found

This is with latest fluidd, followed the install instructions, successfully linked printer.
running latest tsd software (selfhosted, could this be the problem?) on another machine.

Can't set temperature in the app

Steps to reproduce:

  1. Open the Obico app.
  2. Click one of the heaters and set the target to 80C and click OK.
  3. BUG: Nothing happens. The heater target doesn't change on the printer screen.

It takes too long until Print is paused

When obico detects a failure, it takes between 3 and 5 minutes before printing is actually paused. Is this a bug in the software? If possible, it would be nice to be able to decide for yourself after how long a failure is detected before printing is stopped or paused.

I run obico as a docker self hosted with moonraker.

Streamline installation process

Ideally installation process:

curl -sSL https://raw.githubusercontent.com/TheSpaghettiDetective/tsd-moonraker/main/install.sh | bash

  1. Check if ~/klipper_config/moonraker.conf exists. If not, jump to the manual step below.
  2. Set the moonraker config path to ~/klipper_config/moonraker.conf.
    • Moonraker URL is retrieved from the config file.
    • log_path is also retrieved from the config file.
  3. Check if ~/moonraker-env exists. If not, jump to the manual step below.
  4. Use the python virtualenv located in moonraker-env for TSD plugin
  5. Call moonraker's /server/database/list API to check if "mainsail" or "fluidd" is installed.
  6. Prompts user: TSD has detected that you are running Mainsail /Fluidd . Is it correct? [Y/N]. If the answer is "N", jump to the manual step below.
  7. Download the source code and unzip it under ~/tsd/. Then prompt the user: `The installation process will run "sudo" to install TSD as a service so that it'll start automatically every time your Raspberry Pi reboots. The system will prompt you to enter the password for [current user]. Press 'enter' to continue:'
  8. Prompt the user: What TSD server do you want to use? Just press 'return' if you want to use the TSD cloud: https://app.tsd.com
  9. Prompt the user: Now we need to link your [Mainsail/Fluidd] to your TSD account. Please enter the verification code displayed in the TSD web app or mobile app. If you are not sure where to get it, please follow the guide https://tiny.url/abcde :
  10. When the user successfully link the printer, the script print this and exit:
Your [Mainsail/Fluidd] has been successfully linked to your TSD account as 'My Awesome 3D Printer'. You can change the printer name in the TSD web app or mobile app.

In case you need to re-link [Mainsail/Fluidd], run this command:
~/tsd/install.sh.

You can change the TSD configuration in [path to the config file].
  1. We need to capture the "Ctrl-C" signal in case the user interrupt the installation process and display:
Existing the TSD installation process.

To resume the installation process, please run:
~/tsd/install.sh.

Manual steps:

Prompt the user for all the config items that we would otherwise derive from steps 1-7.

Plugin not sending periodic snapshot

Thanks for the work on this plugin. It works great on a MacBook M1 Pro under arm architecture.

The only thing that I couldn’t get working is a frame rate that matched my fluidd stream. It appears TSD server would only update the stream when I refreshed the page. (Maybe it’s working on snapshots/basic mode)

Is there a command or change to make that can enable compatibility mode like with the full octoprint plugin?

Print progress percentage not showing

I have tried reinstalling several times with no luck. I cannot see the progress of the print. See attached picture. It looks like an issues has been opened on this in the past, but it is not resolved for me. Thanks!

image

Error in installation instructions

pwd is ~/tsd-moonraker per "cd tsd-moonraker" in previous step
source venv/bin/activate fails with directory not found

python3 venv create step was run per instructions prior to these steps with no stderr

Unable to print after first time printing for upload g-codes file

Since the tunnel function is not work for moonraker-obice that the only way is to upload G-codes to obico and printing afterward.
I tried upload G-codes for printing and the upload process is totally OK.
However, I found this is one-time function and I cannot print another gcode anymore.
After first time printing via obico uploaded g-codes, the status always showed "Operational" and always showed "Currently downing or printing!" after you pressed the start printing button.

Cannot Clone Moonraker-Obico Repo

I am logging into (SSH) the RP4 that runs Mainsail on my printer. The RP4 communicates to the BTT v2 control board (Klipper) via USB. I have installed Github CLI on the RP4 but I am not able to clone the moonraker-obico repo. Here is the error:

gh repo clone TheSpaghettiDetective/moonraker-obico
Cloning into 'moonraker-obico'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
failed to run git: exit status 128

I obtained a Github token from Safari on my Mac then used it to login from the RP4 in the printer:

pi@mainsail:~ $ gh auth login
? What account do you want to log into? GitHub.com
? What is your preferred protocol for Git operations? SSH
? Upload your SSH public key to your GitHub account? Skip
? How would you like to authenticate GitHub CLI? Paste an authentication token
Tip: you can generate a Personal Access Token here https://github.com/settings/tokens
The minimum required scopes are 'repo', 'read:org'.
? Paste your authentication token: ****************************************
- gh config set -h github.com git_protocol ssh
✓ Configured git protocol
✓ Logged in as Salty-Doug

I don't understand, did I get the wrong token?

Moonraker-Obico pause stop the bed heater

My Obico is set to stop only the extruder heater when pausing a print when it detect a fail, but it also stop the bed heater.
The turn off bed heater was unchecked.
Any thoughts?
Thanks

Implement Notifications for Klipper Pausing due to Filament Sensor

When using the BTT Smart Filament Sensor, if I get a clog, Klipper properly pauses my print, however Obico does not give a mobile notification when a pause occurs due to this event.

It would be helpful if Obico could give a notification since I'm experimenting with different hotend setups.

Thanks for all your work!

Allow user-configurable fps for compatible mode

Currently, if compatible mode is necessary (e.g., if HW encoded h264 streaming is not possible), then there seem to be only 2 extreme options:

  1. 25 fps using ffmpeg_from_jmpeg which is CPU intensive, especially on most RPI's
  2. 0.1 fps using jpg snapshots every 10 seconds

Why not offer a parameter to set the fps for ffmpeg?
Certainly something like 5 fps (similar to a non-pro user) would be a reasonable compromise allowing a good view of the bed without too much cpu overload.

This would be simple presumably to add a variable for FPS to the code (webcam_stream.py) and a textbox in the Octoprint-Obico settings UI.

Add License

Thanks for your work, im running it and having 0 issues!

Not really an issue, but i thought i would bring it up anyway:
Right now tsd-moonraker doesnt seem to be published under a specific license. If this is not an oversight and intended im sorry, otherwise Id like to suggest to put it under AGPL (just like TSD itself) if possible.
Thanks a lot and keep up the good work!

Time Format Bug - Klipper w/ Moonraker

Screenshot_20220811-004419

Running Obico version 1.66.120 : b187 on Android 12 and the latest versions of Klipper / moonraker-obico on mainsail. The top printer in the screenshot is running on Octoprint, but the bottom printer is running on the following versions of Klipper/Mainsail + Moonraker.

klipper
v0.10.0-546-ga709ba43

moonraker
v0.7.1-625-g413e3b2

moonraker-obico
v0.5.0-0-g574a741

mainsail
v2.2.1

Please let me know if I can help provide any additional information!

FFMPEG bug causes Obico not to respect RFC2396 for stream URLs causing compatible mode to run at 0.1fps

In Octoprint settings, under "Webcam & Timelapse", I set stream url to:
http ://myrpi:8080?action=stream which is a valid RFC2396 URL.

However, ffmpeg fails to recognize the URL and returns:
http://myrpi:8080?action=stream: Server returned 400 Bad Request

See the bug report: https://trac.ffmpeg.org/ticket/8466

Obico doesn't detect this bug and merrily launches ffmpeg with the faulty URL.
ffmpeg fails (silently) and then Obico defaults to 0.1fps snapshots.

Suggested fix is either:

  1. Warn users if malformed URL
  2. Or fix stream_url in webcam_stream.py to insert a slash if missing before '?'

Implement tunneling

I'm pretty sure some users will find it useful to tunnel into the frontend (mainsail or fluidd), similar to OctoPRint users.

The app shows "Connect" when there is an error in Klipper

Steps to reproduce:

  1. Start printing a gcode that will generate error, such as moving print head out of boundary.
  2. Wait for the Klipper to spit out error, such as !! Move out of range: 363.749 277.273 20.200 [-5.000]
  3. BUG: the app shows a "Connect" button, whereas the printer is still connected to Klipper. Clicking "Connect' button will cause the app to "wait for serial port" forever.

Obico eating a lot of memory until pi die

ERROR obico.utils - giving up on error: Janus quit! This should not happen. Exit code: 127
Screen Shot 2022-09-12 at 2 09 26 PM

I verified the H-top and is in fact moonraker-obico. Since I have it installed through kiauh I think that might be the problem I uninstalled and installed directly with the same result. The only reason that I can think of might be an issue is that im running klipper ,moonraker and obico in 1 pi and mainsail in another one.

"Not running on a pi" - any options for video?

I'm running klipper on an Odroid C4 - partly due to the shortage of Raspberry Pis the last couple of years, but also because I've found the USB more stable.

Obico doesn't seem to like it. I can't get a video stream to load on my self-hosted Obico server, and when I look at the logs, I see "Not running on a Pi. Quiting video_pipeline." It seems that because I'm running a different SBC it's not even trying to load the video components. Is there any way around this behaviour? My webcam works fine and I can view the stream through Fluidd, I just can't get Obico to look for it.

Use webcam configuration in moonraker

  1. On plugin launch, we check for the "webcams" namespace. If it is there, we will retrieve its webcam configuration and use that in the subsequent operations.
  2. If the "webcams" namespace is missing, we query https://moonraker.readthedocs.io/en/latest/web_api/#list-namespaces and check for fluidd/cameras. If it is there, we will retrieve its webcam configuration and use that in the subsequent operations. This is a temp solution before fluidd moves to using the "webcams" namespace.
  3. If both failed, we send an alert to the frontend that states "No webcam is configured. Please configure it for TSD to work properly".

Strange ever-increasing logging on server errors

When the server responds errors (401 in this case), the wait_for_auth_token seems to be in an ever-increasing loop based on moonraker-obico.log.

However, the server side seems to be getting 1 API call at a time. So I suspect it's because the logger is set up multiple times, not because the server calls are made multiple times. However, I'd assume logging in Python also follow a common practice of using the singleton design pattern, so I'm puzzled here.

Explicitly set webcam stream/snapshot urls are ignored if retrieved from moonraker

Hi,

Currently, moonraker-obico appears to ignore explicitly set webcam snapshot/stream URLs if it succeeds in retrieving the values from moonraker.

Given the following config (in my environment):

[moonraker]
host = moonraker
port = 7125

[webcam]
disable_video_streaming = False
snapshot_url = http://webcam:8080/snapshot
stream_url = http://webcam:8080/stream

This plugin succeeds in retrieving a different URL from moonraker and proceeds to override my values.

Moonraker responds with a relative paths such as: /webcam/?action=stream, and moonraker-obico ignores my values and tries to connect to localhost/webcam/?action=stream

For context, I am working on running this plugin in a docker container in my local setup based on https://github.com/mkuf/prind

Workaround

Commenting out / removing the following lines:

if result:
# TODO: Just pick the last webcam before we have a way to support multiple cameras
for cfg in result.get('value', {}).values():
self.snapshot_url = self.webcam_full_url(cfg.get('urlSnapshot', None))
self.stream_url = self.webcam_full_url(cfg.get('urlStream', None))
return

resolves the issue as it removes any consideration of values retrieved from moonraker.

Of course, this works as a temporary fix for my personal docker image 😄, but I think a proper solution would be always to use any webcam URLs that are explicitly set in the config (and if not set, continue with the current logic).

Thanks!

Config `disable_video_streaming` is not working

The ffmpeg capture is started on app startup, which results in the ffmpeg process taking about 22% of CPU time on a Raspberry Pi4. However, the capture is not required until the printer is actually printing.

The app already receives events from Moonraker/Klipper and one of those events is "Printing". It would be nice if the ffmpeg capture is started when the printer transitions from a non-printing state to "Printing" and stopped when printing is done.

Install did not query for self-hosted server URL

Hi, I love this and just wanted to point out that when i installed for my self hosted it did not ask me for the server URL, I was unable to get the -S option to work and had to change the server address in install.sh on line 205.

Cheers for the plugin. :)

no video with 1.2.1

Video and heater bed/raspi temp sensors don't seem to work with v1.2.1. Reverting back to v1.2.0 seems to resolve the issue.

Logs showing me restarting v1.2.1 and it failing followed by trying v1.2.0 which works:

2023-02-27 19:31:48,307      INFO  obico.app - starting moonraker-obico (v1.2.1)
2023-02-27 19:31:48,307      INFO  obico.app - Linked printer: {'is_pro': True, 'id': 1, 'name': 'Voron v2.040'}
2023-02-27 19:31:48,541      INFO  obico.app - Starting webcam streamer
2023-02-27 19:31:48,548   WARNING  obico.moonraker_conn - api key is unset, trying to fetch one
2023-02-27 19:31:48,613      INFO  obico.moonraker_conn - connection is open
2023-02-27 19:31:48,723      INFO  obico.moonraker_conn - Klippy ready
2023-02-27 19:31:48,972      INFO  obico.app - detected state change: Offline -> Operational
2023-02-27 19:31:49,576      INFO  backoff - Backing off wait_for_janus(...) for 1.0s (ConnectionRefusedError: [Errno 111] Connection refused)
2023-02-27 21:40:37,993      INFO  backoff - Backing off capture_jpeg(...) for 0.3s (AttributeError: 'ServerConn' object has no attribute 'snapshot_url')
2023-02-27 21:40:38,270      INFO  backoff - Backing off capture_jpeg(...) for 1.1s (AttributeError: 'ServerConn' object has no attribute 'snapshot_url')
2023-02-27 21:40:39,413     ERROR  backoff - Giving up capture_jpeg(...) after 3 tries (AttributeError: 'ServerConn' object has no attribute 'snapshot_url')
2023-02-27 21:54:48,339      INFO  obico.app - detected state change: Operational -> Printing
2023-02-27 21:54:48,462      INFO  obico.app - print event: PrintStarted (1677534888)
2023-02-27 23:17:59,816      INFO  obico.app - detected state change: Printing -> Operational
2023-02-27 23:17:59,817      INFO  obico.app - print event: PrintDone (1677534888)
2023-02-27 23:34:49,774      INFO  obico.app - detected state change: Operational -> Printing
2023-02-27 23:34:49,880      INFO  obico.app - print event: PrintStarted (1677540889)
2023-02-27 23:38:19,345      INFO  obico.app - detected state change: Printing -> Paused
2023-02-27 23:38:19,345      INFO  obico.app - print event: PrintPaused (1677540889)
2023-02-27 23:39:39,109      INFO  obico.app - detected state change: Paused -> Operational
2023-02-27 23:39:39,110      INFO  obico.app - print event: PrintCancelled (1677540889)
2023-02-27 23:39:39,614      INFO  obico.app - print event: PrintFailed (1677540889)
2023-02-27 23:46:48,037      INFO  obico.app - detected state change: Operational -> Printing
2023-02-27 23:46:48,139      INFO  obico.app - print event: PrintStarted (1677541607)
2023-02-28 01:06:15,356      INFO  obico.app - Fetching linked printer...
2023-02-28 01:06:15,447      INFO  obico.app - starting moonraker-obico (v1.2.1)
2023-02-28 01:06:15,448      INFO  obico.app - Linked printer: {'is_pro': True, 'id': 1, 'name': 'Voron v2.040'}
2023-02-28 01:06:15,655      INFO  obico.app - Starting webcam streamer
2023-02-28 01:06:15,670   WARNING  obico.moonraker_conn - api key is unset, trying to fetch one
2023-02-28 01:06:15,746      INFO  obico.moonraker_conn - connection is open
2023-02-28 01:06:15,882      INFO  obico.moonraker_conn - Klippy ready
2023-02-28 01:06:16,136      INFO  obico.app - detected state change: Offline -> Printing
2023-02-28 01:06:16,724      INFO  backoff - Backing off wait_for_janus(...) for 1.0s (ConnectionRefusedError: [Errno 111] Connection refused)
2023-02-28 01:08:17,557      INFO  obico.app - Fetching linked printer...
2023-02-28 01:08:17,612      INFO  obico.app - starting moonraker-obico (v1.2.0)
2023-02-28 01:08:17,613      INFO  obico.app - Linked printer: {'is_pro': True, 'id': 1, 'name': 'Voron v2.040'}
2023-02-28 01:08:17,742      INFO  obico.app - Starting webcam streamer
2023-02-28 01:08:17,755   WARNING  obico.moonraker_conn - api key is unset, trying to fetch one
2023-02-28 01:08:17,824      INFO  obico.moonraker_conn - connection is open
2023-02-28 01:08:18,023      INFO  obico.moonraker_conn - Klippy ready
2023-02-28 01:08:18,276      INFO  obico.app - detected state change: Offline -> Printing
2023-02-28 01:09:50,347      INFO  obico.app - detected state change: Printing -> Operational
2023-02-28 01:09:50,353      INFO  obico.app - print event: PrintDone (1677541607)

Possibility to power on mcu over obico

Currently it is not possible to control / restart a printer / mcu that is turned off. It should possible to turn on the printer over the moonraker power control.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.