Home Assistant Add-On: Snapmaker Monitor

Home Assistant NRE.Com.Net Add-On: SnapMaker Monitor

GitHub Release Project Stage Github Actions Project Maintenance GitHub Activity

About

This add-on runs a python script, which collects the the current status from the Snapmaker 2.0 3D-Printer API and sends it to a Home Assistant webhook.

I refactored and modified the original version of the script from NiteCrwlr

:books: Read the full add-on documentation

Installation

The installation of this add-on is pretty straightforward and not different in comparison to installing any other Home Assistant add-on.

  1. Click the Home Assistant My button below to add the repositor to your Home Assistant instance or add it manual https://github.com/NRE-Com-Net/hassio-addons

    Add this repository to your Home Assistant instance.

  2. Click the “Add” button to add the add-on repository.

  3. Install the add-on “Snapmaker Monitor” from the Add-on Store

  4. Set at least your snapmaker ip in the add-on configuration

  5. Check the logs of the “Snapmaker Monitor” add-on to see if everything went well.

Repository on GitHub


3 Likes

thx for this.
Is thiscompatible with the new SNapMaker U1

1 Like

I tried it and it doesn’t seem to work. I get a “Set IP not reachable, retrying in 1 minutes” error. AFAIC the port of the snapmaker is regular port 80 and not 8080 (this is the default in the configuration). If i try to start the addon with this port, I get this error message: Request failed: 404 Client Error: Not found for url: http://PRINTER_IP:80/api/v1/connect"
I think the U1 uses a different API for communication.

not tested my self but maybe you have to activate “LAN Mode” on the device?

You can use the hacs moonraker addon for snapmaker U1, see here: GitHub - marcolivierarsenault/moonraker-home-assistant: Home Assistant integration for Moonraker, Klipper and Mainsail

Working here for my U1.

You have to manually configure the:

  • Camera Url: http:///webcam/stream.mjpg
  • Snapshot URL: http:///webcam/snapshot.jpg

Data working fine, what is the Webcam url?
http://myip:7125/snapshot.jpg
just get me a 404 not found

Looks like, you need to a bit more to get it working: How to enable webcam streaming on the Snapmaker U1 | SimplyPrint Helpdesk

I have left Camera and Snapshot URL at default (empty) and yes than it don’t work.

I have installed the paxx12 cfw on the printer and than you can see the available streams here: http://IP/webcam/

Played with all and the motion jpeg causes serious performance issues in the browser when using it.
Also tried to add the various streames to go2rtc or in HA as generic camera. Nothing does work reliable.

What worked is the custom webrtc camera card from HACS with this:

type: custom:webrtc-camera
url: rtsp://192.168.0.12:8554/stream
ui: true

For the rtsp to work you have to enable rtsp in extended firmware-config, Todo this to the following:

  • On the printer touch screen enable “Advanced Mode”
  • Goto http://IP/firmware-config/ and enable rtsp

The stream works good, sometimes it freezes shortly but comes back. Also over mobile data it works.

And for reference here is my complete card:

type: vertical-stack
cards:
  - type: custom:webrtc-camera
    url: rtsp://192.168.0.12:8554/stream
    ui: true
  - show_name: true
    show_icon: true
    show_state: true
    type: glance
    entities:
      - entity: sensor.snapmaker_u1_current_layer
        name: Akt. Layer
        icon: mdi:layers
      - entity: sensor.snapmaker_u1_total_layer
        name: Gesamt Layers
        icon: mdi:layers
      - entity: sensor.snapmaker_u1_progress
        name: Druck %
        icon: mdi:progress-upload
      - entity: sensor.snapmaker_u1_print_time_left
        name: Verbleibend
    state_color: false
    columns: 4
  - show_name: true
    show_icon: true
    show_state: true
    type: glance
    state_color: true
    columns: 4
    entities:
      - entity: sensor.snapmaker_u1_filename
        name: Dateiname
        icon: mdi:layers
      - entity: sensor.snapmaker_u1_current_print_state
        name: Druck Status
        icon: mdi:file-question
      - entity: light.snapmaker_u1_led_cavity_led
        name: Licht
        tap_action:
          action: toggle
          confirmation:
            text: >-
              Bist du sicher, dass du die Led umschalten willst? (Wird benötigt
              fĂĽr AI Features wie Spaghetti Erkennung)
      - entity: camera.lava_gui
        name: Bildschirm
        icon: mdi:monitor
        show_state: false
        tap_action:
          action: fire-dom-event
          browser_mod:
            service: browser_mod.popup
            data:
              title: Bildschirm
              size: wide
              content:
                type: iframe
                url: http://192.168.0.12/screen/
                aspect_ratio: "16:9"
  - type: glance
    entities:
      - entity: sensor.snapmaker_u1_bed_temperature
        name: Bett
      - entity: sensor.snapmaker_u1_extruder1_temperature
        name: DĂĽse 1
        icon: mdi:printer-3d-nozzle
      - entity: sensor.snapmaker_u1_extruder2_temperature
        name: DĂĽse 2
        icon: mdi:printer-3d-nozzle
      - entity: sensor.snapmaker_u1_extruder3_temperature
        name: DĂĽse 3
        icon: mdi:printer-3d-nozzle
      - entity: number.snapmaker_u1_speed_factor
        name: Geschw.
    columns: 5
  - type: horizontal-stack
    cards:
      - show_name: true
        show_icon: true
        type: button
        tap_action:
          action: toggle
          confirmation:
            text: Bist du sicher, dass du den 3D Drucker pausieren willst?
        entity: button.snapmaker_u1_pause_print
        name: Pausieren
      - show_name: true
        show_icon: true
        type: button
        tap_action:
          action: toggle
        entity: button.snapmaker_u1_resume_print
        name: Fortsetzen
      - show_name: true
        show_icon: true
        type: button
        tap_action:
          action: toggle
          confirmation:
            text: Bist du sicher, dass du den 3D Drucker stoppen willst?
        entity: button.snapmaker_u1_cancel_print
        name: Stoppen
  - type: entities
    entities:
      - entity: sensor.snapmaker_u1_totals_print_time
        name: Gesamte Druckzeit
title: Snapmaker U1

Hope this helps.

Hi,
found this integration on the web:
kbaker827/ha-snapmaker-u1
that version did not allow to enable/disable the light, nor was it possible to trigger camera to update for a bit.
So I forked the code and had AI add the necessary code to do that. It is not perfect (no read-back of light state, so a toggle is needed…) but the camera works.
The updates version can be found here:
HMeuleman/ha-snapmaker-u1: Snapmaker U1 Integration for Home Assistant
Use HACS and add the repository, download it, restart home assistant then add integration snapmaker. Fill in the IP address and the name you want to use and it should work.
I’ve chosen to accept the timeout of the camera and have it stop after some time as that is fine for how I want to use it. Of course a simple yaml can be added to retrigger the camera if you want that. Camera is still 1 fps !!

If you want you can add manual camera:
“http://10.0.0.123/server/files/camera/monitor.jpg”
where 10.0.0.123 should be replaced with IP address of 3d printer. Use frame rate of 1. Add it as integration and then display it where you want.

Now I can watch my printer status even when I’m not home!! while printer is configured for LAN mode.

Note: this was tested with FW 1.1.1 on U1, will be updating that tonight, hope it still works.

Dashboard that was created using the sensors:

Spectacular, could you share the code? Thank you.

Here is a copy of the dashboard, slightly changed from picture.
HA_Dashboard/3D_Printer at main · HMeuleman/HA_Dashboard
The printer I use is called 3d_printer. so all sensors are like (sensor.3d_printer_print_state).
The used cards can be found in hacs.

Thank you very much for your work, the integration is working well. Just one question: With the latest firmware version 1.3.0, I can’t seem to get the webcam stream to work. It says “Streaming,” but I don’t see any image. The webcam works just fine in the Snapmaker app and in Orcaslicer. My Wi-Fi connection to the printer isn’t particularly strong, and I can’t find the webcam in the web interface either, which seems odd to me. Do you have any idea if this is a firmware issue or if it works fine for you?

This looks quite interesting. Can you tell me more about this “camera.lava_gui” entity? And do i need to do some special configuration for browser mod and webrtc-camera?

I am using moonraker addon + paxx12 extended firmware since day 1.
Really happy with it.

Here is a screenshot:

And my card code (the text is german, but you get the idea).
It also features a screen popup, toggling the light and so on…

type: vertical-stack
cards:
  - type: custom:webrtc-camera
    url: rtsp://192.168.0.12:8554/stream
    ui: true
  - show_name: true
    show_icon: true
    show_state: true
    type: glance
    entities:
      - entity: sensor.snapmaker_u1_current_layer
        name: Akt. Layer
        icon: mdi:layers
      - entity: sensor.snapmaker_u1_total_layer
        name: Gesamt Layers
        icon: mdi:layers
      - entity: sensor.snapmaker_u1_progress
        name: Druck %
        icon: mdi:progress-upload
      - entity: sensor.snapmaker_u1_print_time_left
        name: Verbleibend
    state_color: false
    columns: 4
  - show_name: true
    show_icon: true
    show_state: true
    type: glance
    state_color: true
    columns: 4
    entities:
      - entity: number.snapmaker_u1_speed_factor
        name: Geschw.
      - entity: sensor.snapmaker_u1_filename
        name: Dateiname
        icon: mdi:layers
      - entity: sensor.snapmaker_u1_current_print_state
        name: Druck Status
        icon: mdi:file-question
      - entity: light.snapmaker_u1_led_cavity_led
        name: Licht
        tap_action:
          action: toggle
          confirmation:
            text: >-
              Bist du sicher, dass du die Led umschalten willst? (Wird benötigt
              fĂĽr AI Features wie Spaghetti Erkennung)
  - type: glance
    entities:
      - entity: sensor.snapmaker_u1_bed_temperature
        name: Bett
      - entity: sensor.snapmaker_u1_extruder_temperature
        name: DĂĽse 1
        icon: mdi:printer-3d-nozzle
      - entity: sensor.snapmaker_u1_extruder1_temperature
        name: DĂĽse 2
        icon: mdi:printer-3d-nozzle
      - entity: sensor.snapmaker_u1_extruder2_temperature
        name: DĂĽse 3
        icon: mdi:printer-3d-nozzle
      - entity: sensor.snapmaker_u1_extruder3_temperature
        name: DĂĽse 4
        icon: mdi:printer-3d-nozzle
    columns: 5
  - type: horizontal-stack
    cards:
      - show_name: true
        show_icon: true
        type: button
        tap_action:
          action: toggle
          confirmation:
            text: Bist du sicher, dass du den 3D Drucker pausieren willst?
        entity: button.snapmaker_u1_pause_print
        name: Pausieren
      - show_name: true
        show_icon: true
        type: button
        tap_action:
          action: toggle
        entity: button.snapmaker_u1_resume_print
        name: Fortsetzen
      - show_name: true
        show_icon: true
        type: button
        tap_action:
          action: toggle
          confirmation:
            text: Bist du sicher, dass du den 3D Drucker stoppen willst?
        entity: button.snapmaker_u1_cancel_print
        name: Stoppen
      - entity: camera.snapmaker_u1_gui
        name: Bildschirm
        icon: mdi:monitor
        type: button
        show_state: false
        tap_action:
          action: fire-dom-event
          browser_mod:
            service: browser_mod.popup
            data:
              title: Bildschirm
              size: wide
              content:
                type: iframe
                url: http://192.168.0.12/screen/
                aspect_ratio: "16:9"
  - type: entities
    entities:
      - entity: sensor.snapmaker_u1_totals_print_time
        name: Gesamte Druckzeit
  - type: picture
    image:
      media_content_id: media-source://camera/camera.snapmaker_u1_thumbnail
      media_content_type: image/jpeg
      metadata:
        title: Snapmaker U1 Thumbnail
        thumbnail: /api/camera_proxy/camera.snapmaker_u1_thumbnail
        media_class: video
        children_media_class: null
        navigateIds:
          - {}
          - media_content_type: app
            media_content_id: media-source://camera
title: Snapmaker U1

Hope this helps.

2 Likes

Where is the template called nozzle_temp?

Sorry, forgot about that. Added a file in the repo called button_card_template_nozzle_temp. The contents can added to the raw yaml in the top and it should work.

HA_Dashboard/button_card_template_nozzle_temp at main · HMeuleman/HA_Dashboard

1 Like