Moonraker API (Klipper)

with creality K1 Max, thumbnail not work in HA ,
Any solution?

hello.
Its posible to silence error logs like this:
“Websocket connection error”

My printer is usually power off. and the log report more than 1k messages like this.

What FW are you running on the K1 Max? I just got mine today and was looking to get it into HA.

Actually figured it out…

If you still need to get your camera working add a mjpeg camera the url is http://printerIP:4408/webcam/?action=stream and /webcam/?action=snapshot

Not a webcam… this works fine
i mine the thumbnail of printing

Hi Just had a k1 Max, how did you connect to ha? thanks

In theory, version 10.1 was going to solve it, but that was not the case, I had opened a PR on Github but it has been closed by the author.

Make sure your FW is up to date then enable root access and follow this: https://github.com/CrealityOfficial/K1_Series_Annex/blob/9665dd758eba4c004d3b3587894c19037e8da522/fluidd/README_en

For anyone using a K1 or K1 Max, do you have issues setting fan speeds from Home Assistant?

Fluidd shows the fan speed range as 0-255, but Home Assistant shows the fan speed range as 0-100%, but if you set a fan speed from Home Assistant to something like 92%, the printer receives the data as setting the fan to 0.92 (so less than 1 in the 0-255 range). The LED brightness works though because Fluidd has that range as 0-1, so it translates perfectly fine between the 2 systems.

Getting the thumbnail image would be nice also (I can see it in Fluidd) and I have my internal camera working through Blue Iris, so I just setup a card using the Blue Iris integration as a workaround for now.

1 Like

Did you ever figure this out? I am trying to see if I can disable log errors (since my printer is usually off too) via the configuration.yaml:

recorder:
  purge_keep_days: 60
  exclude:
    domains:
      - automation
      - updater
    entity_globs:
      - sensor.weather_*
      - sensor.moonraker_api*

dang it, didnt work

Anyone have any ideas how to stop these messages from filling up my HA logs?

2024-02-12 19:46:56.123 WARNING (MainThread) [custom_components.moonraker] connection to moonraker down, restarting
2024-02-12 19:46:59.200 ERROR (MainThread) [moonraker_api.websockets.websocketclient] Websocket connection error: Cannot connect to host 192.168.220.135:7125 ssl:default [Connect call failed ('192.168.220.135', 7125)]

I’ll manually disable / enable the integration for now but that sucks…

Also trying to solve this issue but no joy so far.

Only method seems to be the manual enable/disable for me.

1 Like

This works:

logger:   
  filters: 
    moonraker_api.websockets.websocketclient:  
      - ".*Websocket connection error.*"
    custom_components.moonraker:
      - ".*connection to moonraker down, restarting.*"
      - ".*Error requesting moonraker data.*"
1 Like

Can this support multiple printers?

Late to the party. The way i solved this, was that i went into the printers.cfg file and change the scale values for “output_pin fan0,output_pin fan1,output_pin fan2” from 255 to 1. every thing still works as it should on the machine and in fluidd, just means now in HA the slider bar will work as well :slight_smile:
For the camera setup i actually used MJPEG IP Camera HA addon, and pasted from fluid my cameras address for example " http://YourPrintersIp:4408/webcam/?action=stream" .

1 Like

I used the template light and fan templates below to turn the input_number entities into fans and light entities:

- platform: template
  lights:
    k1c_lights:
      friendly_name: "K1C Lights"
      unique_id: k1c_lights
      value_template: "{{ states('number.k1c_output_pin_led')| float(0) > 0 }}"
      level_template: "{{ (states('number.k1c_output_pin_led')| float(0) /100) *255 }}"
      turn_on:
        - service: number.set_value
          target:
            entity_id: number.k1c_output_pin_led
          data:
            value: "100"
      turn_off:
        - service: number.set_value
          target:
            entity_id: number.k1c_output_pin_led
          data:
            value: "0"
      set_level:
        service: number.set_value
        data:
          value: "{{ (brightness /255) *100 }}"
          entity_id: number.k1c_output_pin_led
- platform: template
  fans:
    k1c_hot_end_fan:
      friendly_name: "K1C Hot End Fan"
      unique_id: k1c_hot_end_fan
      value_template: "{{ states('number.k1c_output_pin_fan0')| float(0) > 0 }}"
      percentage_template: "{{ states('number.k1c_output_pin_fan0')| float(0) }}"
      turn_on:
        - service: number.set_value
          target:
            entity_id: number.k1c_output_pin_fan0
          data:
            value: "100"
      turn_off:
        - service: number.set_value
          target:
            entity_id: number.k1c_output_pin_fan0
          data:
            value: "0"
      set_percentage:
        service: number.set_value
        data:
          value: "{{ (percentage /255) *100 }}"
          entity_id: number.k1c_output_pin_fan0

- platform: template
  fans:
    k1c_chamber_fan:
      friendly_name: "K1C Chamber Fan"
      unique_id: k1c_chamber_fan
      value_template: "{{ states('number.k1c_output_pin_fan1')| float(0) > 0 }}"
      percentage_template: "{{ states('number.k1c_output_pin_fan1')| float(0) }}"
      turn_on:
        - service: number.set_value
          target:
            entity_id: number.k1c_output_pin_fan1
          data:
            value: "100"
      turn_off:
        - service: number.set_value
          target:
            entity_id: number.k1c_output_pin_fan1
          data:
            value: "0"
      set_percentage:
        service: number.set_value
        data:
          value: "{{ (percentage /255) *100 }}"
          entity_id: number.k1c_output_pin_fan1

- platform: template
  fans:
    k1c_part_fan:
      friendly_name: "K1C Part Fan"
      unique_id: k1c_part_fan
      value_template: "{{ states('number.k1c_output_pin_fan2')| float(0) > 0 }}"
      percentage_template: "{{ states('number.k1c_output_pin_fan2')| float(0) }}"
      turn_on:
        - service: number.set_value
          target:
            entity_id: number.k1c_output_pin_fan2
          data:
            value: "100"
      turn_off:
        - service: number.set_value
          target:
            entity_id: number.k1c_output_pin_fan2
          data:
            value: "0"
      set_percentage:
        service: number.set_value
        data:
          value: "{{ (percentage /255) *100 }}"
          entity_id: number.k1c_output_pin_fan2
1 Like

Did you ever get the thumbnail to work? Mine always says Idle. The preview works fine in the fluidd interface.

Figured this out too. You have to disable the creality web interface and ensure your slicer is adding the thumbnail and it’ll show up in this integration.

1 Like


TKS!

i am trying to install moonraker in home assistant for k1max and i manage to do it. But the connection is remote because the printer is at work and the home assistant server at home. so i use tailscale to comunicate. The problem is that when there is a print job and navigate to the moonrakers dashboard in home assistant the printer stops with an error. an on klipper i have a error messege shutdown .
Screenshot 2024-12-13 112116