BTT Knomi with Repetier Server?

Has someone tried the BTT Knomi with Repetier-Server?
It should work out of the box with moonraker / mainsail.
I was able to test it, could get a wifi connection but it always said that the printer is unoperational even if the printer works flawless from the RS GUI.

If I understand right, moonraker enables access to the underlying klipper data of my printer. Knomi looks for these data and displays them. 
Therefore I have to provide the klipper IP address, the klipper port (80 unter moonraker) and the klipper tool ID of the extruder. 
But what are these data on Repetier server? The standard port 3344 did not work. IMHO moonraker uses nginx for that, but what RS does?

Comments

  •  Repetier-Server currently needs direct access to klipper as moonraker has it. So it must run on the device where klipper runs. Can run with moonraker in parallel, but then you must start server with same user as klipper or ensure it can read the klipper sockets.

    In a later stage we plan also connection via Moonraker from other devices to solve the issue easier.
  • So in short: Repetier server does not support knomi!
  • Not in the way you wanted to connect it at least. Only if you add server on the pc inside the printer where klipper runs.
  • Sorry for my limitted knowledge, but I don't understand that:
    I do run Repetier-Server on the "pc" inside the printer (which is a raspberry Pi in my case) and klipper runs on the same raspberry Pi as well. So my server runs on the same machine as klipper does.
    Or do you mean I have to install moonraker on the raspberry pi either?
  • I mean we do not need or use moonraker at all. We need direct access to the klipper socket and if you install klipper inside  Repetier-Server it works good and you can configure the printer even inside server. But if it is preinstalled you normally just set serial to klipper socket which can make problem is it is owned by another user, which is the case when you do it that way. So if you configure klippe ryourself on a pi best is use our image, install klipper and copy the klipper config and set serial path. 
  • Repetier said:
    I mean we do not need or use moonraker at all. We need direct access to the klipper socket and if you install klipper inside  Repetier-Server it works good and you can configure the printer even inside server.
    That is exactly what I have done!
    Repetier said:
    So if you configure klippe ryourself on a pi best is use our image, install klipper and copy the klipper config and set serial path. 
    That is exactly what I have done too. Klipper and Repetier-Server work perfectly together on my machine. 

    But as stated in the first post of this thread: Knomi does not display anything. On the Knomi, a ESP32 is running. This ESP32 uses WLAN to communicate with the klipper/Mainsail/Moonraker/Repetier-Server or whatever machine as part of my network....So Knomi is a simple client in my WLAN network.
    Knomi looks for variable states (which has to be predefined in the klipper.cfg - which I have done) and displays these values.
    To simplify from my point of knowledge: It is just another GUI which communicates with klipper. But this communication does not take place with Repetier server. 
    Regards


  • Ah, sought Knomi was a new printer model. Yes we have no special things written. Guess knomi would need to use server api but does not support it. However you can add moonraker to pi if you need this. Just configure it to use the server klipper instance and it would work. I have this working on my klipper so I can test with both.
  • Ok, we are coming further .-)
    Repetier said:
    Ah, sought Knomi was a new printer model.
    :-) No, it is just a WLAN Touch Display. You can add it e.g. to the center of your Stealthburner extruder to display printing parameters :-))
    Guess knomi would need to use server api but does not support it.
    This is my assumption too.
    However you can add moonraker to pi if you need this. Just configure it to use the server klipper instance and it would work.
    I will try that and let you know, if it works. 
    I could imagine it is more difficult as the Repetier-Server installation of klipper is at different places compared to a standard klipper.
    I have this working on my klipper so I can test with both.
    But you don´t have a description how you installed moonraker on the RS- eco system? And which configuration files have to be changed/redirected to RS standard pathes?


  • Actually it is a default installation

    https://moonraker.readthedocs.io/en/latest/installation/#installing-moonraker

     but in moonraker.conf you set socket to
    klippy_uds_address: /var/lib/klipper/sockets/Sidewinder_X1_Klipper.api

    here Sidewinder_X1_Klipper was the prionter slug name to reference it. It will tell you it can not access the configs correctly (because server has them at different place and you edit them in server) but it works quite simple.
  • I thought it is more complicated as klipper is not in the default place (~/klipper).
    Will try that! Thanks for your efforts and help!
  • Fortunately moonraker is quite independent, just needing the communication socket and access. If you run it as use repetierserver you might also just make the klipper config folder a link to server folder for klipper configs and both would see them.
  • We are coming further:
    Installed moonraker as suggest and it runs with one hint: "No access to communication socket."
    pi@VoronGold:~/printer_data/config $ systemctl status moonraker.service          
    ● moonraker.service - API Server for Klipper SV1   Loaded: loaded (/etc/systemd/system/moonraker.service; enabled; vendor preset: enabled)   Active: active (running) since Tue 2024-01-30 09:25:59 CET; 15s ago Main PID: 22380 (python)    Tasks: 20 (limit: 3596)   CGroup: /system.slice/moonraker.service           └─22380 /home/pi/moonraker-env/bin/python -m moonraker Jan 30 09:26:01 VoronGold python[22380]: **User=pi Jan 30 09:26:01 VoronGold python[22380]: [server.py:_initialize_component()] - Performing Component Post Init: [proc_stats] Jan 30 09:26:01 VoronGold python[22380]: [server.py:_initialize_component()] - Performing Component Post Init: [announcements] Jan 30 09:26:01 VoronGold python[22380]: [server.py:_initialize_component()] - Performing Component Post Init: [webcam] Jan 30 09:26:01 VoronGold python[22380]: [webcam.py:_set_default_host_ip()] - Default public webcam address set: http://192.168.1.64 Jan 30 09:26:01 VoronGold python[22380]: [server.py:_initialize_component()] - Performing Component Post Init: [klippy_connection] Jan 30 09:26:01 VoronGold python[22380]: [extensions.py:start_unix_server()] - Creating Unix Domain Socket at '/home/pi/printer_data/comms/moonraker.sock' Jan 30 09:26:01 VoronGold python[22380]: [server.py:start_server()] - Starting Moonraker on (0.0.0.0, 7125), Hostname: VoronGold Jan 30 09:26:01 VoronGold python[22380]: [application.py:listen()] - SSL Certificate/Key not configured, aborting HTTPS Server startup Jan 30 09:26:01 VoronGold python[22380]: [klippy_connection.py:_do_connect()] - Cannot connect to Klippy, Linux user 'pi' lacks permission to open Unix Domain Socket: /var/lib/klipper/s
    ockets/VoronGold.api
    Connection to klippy stops due to missing permissions. So I changed the Systemd service file to start as user repetierserver (former it was pi):
    # systemd service file for moonraker
    [Unit]
    Description=API Server for Klipper SV1
    Requires=network-online.target
    After=network-online.target
    
    [Install] WantedBy=multi-user.target
    [Service] Type=simple User=repetierserver SupplementaryGroups=moonraker-admin RemainAfterExit=yes EnvironmentFile=/home/pi/printer_data/systemd/moonraker.env ExecStart=/home/pi/moonraker-env/bin/python $MOONRAKER_ARGS Restart=always RestartSec=10
    After restarting the service:
    pi@VoronGold:/etc/init.d $ sudo systemctl status moonraker.service
    ● moonraker.service - API Server for Klipper SV1
       Loaded: loaded (/etc/systemd/system/moonraker.service; enabled; vendor preset: enabled)
       Active: activating (auto-restart) (Result: exit-code) since Tue 2024-01-30 09:38:50 CET; 2s ago
      Process: 5753 ExecStart=/home/pi/moonraker-env/bin/python $MOONRAKER_ARGS (code=exited, status=1/FAILURE)
     Main PID: 5753 (code=exited, status=1/FAILURE)
    
    Jan 30 09:38:50 VoronGold systemd[1]: moonraker.service: Main process exited, code=exited, status=1/FAILURE Jan 30 09:38:50 VoronGold systemd[1]: moonraker.service: Failed with result 'exit-code'.
    Now the service does not start. I assume it is because the moonraker files are in pi´s home directory on which the user repetierserver has no access to.
    Any ideas? How did you solve that? The user repetierserver has no home directory...

    Repetier said:
    Fortunately moonraker is quite independent, just needing the communication socket and access. If you run it as use repetierserver you might also just make the klipper config folder a link to server folder for klipper configs and both would see them.
    And howto do that?
    Regards

  • Files are in folder of user pi belonging to pi. Make them accessible
    sudo chown -r repetierserver /home/pi/moonraker-env
    and eventually also home dir readable for anyone
    sudo chmod a+rx /home/pi

    then try restarting service.

  • Very good repetier, now it works! (with sudo chown -R)
    Knomi has access to moonraker and moonraker has access to klipper. The Display shows the actual printer status. Very nice!

    The disadvantage is that the user pi has now files in his home which he does not own, but anyway.
    If I would do it the stringent linux way, should I move moonraker to /opt/moonraker/<printers_Slugname>/?  Would that be the right place from your point of view?
    Anyway Thanks a lot again for your excellent support!!!
  • You are right, it is not nicest solution to run it inside a home directory of wrong user. Actually I think software should not be installed in home directories at all, so any other directory would be better. /opt/moonraker would be a great place for it.
  • Inspite of my posting -2 unfortunately most of the Knomi functions do not work correctly: 
    If I send commands to the printer from Repetier-Server GUI or from the attached LCD-Display these commands 
    get recognized by moonraker and Knomi sees these commands and changes his display (This is OK). So adjusting temperature or sending command (like homing or quad gantry leveling) from the Knomi-Touchdisplay work either. They will send to moonraker/klipper and get executed. (OK too). 
    But the problem is: Status and temperatures were not displayed correct on Knomi Touch! So I can set the temperature but it stays 0 on display, even if the temperature on the printer gets adjusted. Displaying printer status (ready, printing, shutdown, etc.) does not work. So during print the Knomi displays always ready/standby. Reading the temperatures from the printer/klipper does not work, always 0 °C.

    I looked into the log files and moonraker documentation: This is obviously realized inside Knomi firmware by sending web requests in the form:
    http://<printerIP>:7125/api/printer
    Moonraker should answer these requests but could not (here relevant part of the log):
    [application.py:log_request()] - 404 GET /api/printer (<KNOMI-IP-Address>) [_TRUSTED_USER_] 2.39ms

    /api/printer is according to the moonraker docs a part of the Octoprint API emulation, which is not present as I see it:

    Get Printer status

    HTTP request:

    GET /api/printer
    
    JSON-RPC request: Not Available

    Returns:

    An object containing OctoPrint Printer status

    {
        "temperature": {
            "tool0": {
                "actual": 22.25,
                "offset": 0,
                "target": 0
            },
            "bed": {
                "actual": 22.25,
                "offset": 0,
                "target": 0
            }, ...<additional heaters>
        },
        "state": {
            "text": "state",
            "flags": {
                "operational": true,
                "paused": false,
                "printing": false,
                "cancelling": false,
                "pausing": false,
                "error": false,
                "ready": false,
                "closedOrError": false
            }
        }
    }
    I fear this is the kiss of death for Knomi on repetier Server. The only solution I see is to recode the knomi firmware (which is ESP32 based but badly documented). Or do you see something as solution, if the OctoprintAPI is needed?
    Regards



  • Solution is very simple. In moonraker.conf just add

    [octoprint_compat]

    to enable the octoprint api and your call will work. Was the same on my system.
  • Works!
    Your are the godfather of the Gurus!
    Thanks again and have nice evening!
  • And again myself:-)
    Query the temperatures (targets and actual) is ok now. They get shown in the knomi display, are changeable and the display shows when it is heating. Very good.
    Still one thing is missing: The printer state.
    {"temperature": {"bed": {"actual": 109.96, "offset": 0, "target": 110.0}, "tool0": {"actual": 239.98, "offset": 0, "target": 240.0}}, "state": {"text": "Operational", "flags": {"operational": true, "paused": false, "printing": false, "cancelling": false, "pausing": false, "error": false, "ready": true, "closedOrError": false}}}
    or as picture:


    temperature
    bed
    actual109.96
    offset0
    target110
    tool0
    actual239.98
    offset0
    target240
    state
    text"Operational"
    flags
    operationaltrue
    pausedfalse
    printingfalse
    cancellingfalse
    pausingfalse
    errorfalse
    readytrue
    closedOrErrorfalse

    As this was during a print the state should be printing : true and ready :false.
    So why the state does not change (I assume it is klipper which does not change it...)

Sign In or Register to comment.