A few months ago I posted my compact 3D printer card. You guys seemed to really like it so I decided to post my updated version now that I’ve since switched to Mushroom.

Changes

I’m now using the Octoprint MQTT integration to expose even more entities. (Still using the default Octoprint integration – but only to Resume print, couldn’t figure out a way to do that over MQTT). Primary advantages for me was showing an .STL preview of what I’m printing & controlling the nozzle and bed axis. Also, the ETA, elapsed, and printing time sensors report much more accurately with MQTT.

I’m using multiple conditional cards with toggle helpers – if Octo Controls is toggled, show the controls, if webcam is toggled, show the webcam, etc.

Integrations

Note: If you decide to start using Octoprint-MQTT and the Threedy card, make sure to include use_mqtt: true like this:

Note: This guide assumes you’ve already configured MQTT with Octoprint. Lots of good guides out there if you haven’t yet.


G-Code Viewer

If you want to view .STL previews like I’ve done, you’ll need to install PrettyGCode and PruserSlicerThumbnails in the Octoprint plugin store.

Also install Cura Thumbnails plugin in Octoprint: https://github.com/jneilliii/OctoPrint-UltimakerFormatPackage

PrusaSlicerThumbnails enables the STL preview in Octoprint, and PrettyGCode gives you a URL, which we pass into Home Assistant.


Full “Card” YAML

Once you have the above integrations configured, copy and paste the YAML below into a Manual card and change out the entities with your own.

You’ll need to create x3 Toggle helpers (Settings > Devices & Services > Helpers > Create Helper > Toggle)

  • Orange = Toggle helpers
  • Green: Octoprint-MQTT sensors
  • Purple: Default HA Octoprint sensor
  • Blue: Smart plug connected to 3D printer
  • Red: Change with IP address of your Octoprint instance
square: false
columns: 1
type: grid
cards:
  - type: horizontal-stack
    cards:
      - type: custom:threedy-card
        base_entity: sensor.octoprint
        monitored:
          - Status
          - Bed
          - Hotend
          - ETA
          - Elapsed
          - Remaining
        printer_type: I3
        name: Ender 3 S1
        theme: Default
        temperature_unit: F
        round_temperature: true
        use_mqtt: true
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-entity-card
        entity: input_boolean.octo_controls
        tap_action:
          action: toggle
        icon_color: indigo
        name: Control
        secondary_info: none
      - type: horizontal-stack
        cards:
          - type: custom:mushroom-entity-card
            entity: input_boolean.octoprint_webcam
            name: Webcam
            tap_action:
              action: toggle
            secondary_info: none
      - type: custom:mushroom-entity-card
        entity: input_boolean.octo_info
        name: Info
        tap_action:
          action: toggle
        secondary_info: none
  - type: conditional
    conditions:
      - entity: input_boolean.octo_controls
        state: 'on'
    card:
      type: custom:mushroom-title-card
      title: Axis Controls
  - type: conditional
    conditions:
      - entity: input_boolean.octo_controls
        state: 'on'
    card:
      type: horizontal-stack
      cards:
        - type: horizontal-stack
          cards:
            - type: custom:mushroom-entity-card
              entity: input_boolean.octo_controls
              tap_action:
                action: call-service
                service: mqtt.publish
                target: {}
                data:
                  topic: octoPrint/hassControl/home
                  payload: '["x", "y", "z"]'
                  qos: 0
                  retain: false
              primary_info: none
              icon_color: green
              fill_container: false
              icon: mdi:home
              secondary_info: none
              layout: horizontal
            - type: custom:mushroom-entity-card
              entity: input_boolean.octo_controls
              icon: mdi:arrow-up-bold
              tap_action:
                action: call-service
                service: mqtt.publish
                target: {}
                data:
                  topic: octoPrint/hassControl/jog
                  payload: '{"z": 10, "speed": 0.5}'
                  qos: 0
                  retain: false
              primary_info: none
              icon_color: orange
              fill_container: false
              secondary_info: none
              layout: horizontal
            - type: custom:mushroom-entity-card
              entity: input_boolean.octo_controls
              icon: mdi:arrow-down-bold
              tap_action:
                action: call-service
                service: mqtt.publish
                target: {}
                data:
                  topic: octoPrint/hassControl/jog
                  payload: '{"z": -10, "speed": 0.5}'
                  qos: 0
                  retain: false
              primary_info: none
              icon_color: orange
              fill_container: false
              secondary_info: none
              layout: horizontal
            - type: custom:mushroom-entity-card
              entity: input_boolean.octo_controls
              icon: mdi:arrow-left-bold
              tap_action:
                action: call-service
                service: mqtt.publish
                target: {}
                data:
                  topic: octoPrint/hassControl/jog
                  payload: '{"x": -10, "speed": 0.5}'
                  qos: 0
                  retain: false
              primary_info: none
              icon_color: orange
              fill_container: false
              secondary_info: none
              layout: horizontal
            - type: custom:mushroom-entity-card
              entity: input_boolean.octo_controls
              icon: mdi:arrow-right-bold
              tap_action:
                action: call-service
                service: mqtt.publish
                target: {}
                data:
                  topic: octoPrint/hassControl/jog
                  payload: '{"x": 10, "speed": 0.5}'
                  qos: 0
                  retain: false
              primary_info: none
              icon_color: orange
              fill_container: false
              secondary_info: none
              layout: horizontal
  - type: conditional
    conditions:
      - entity: input_boolean.octo_controls
        state: 'on'
    card:
      type: custom:mushroom-title-card
      title: Power Controls
  - type: conditional
    conditions:
      - entity: input_boolean.octo_controls
        state: 'on'
    card:
      type: horizontal-stack
      cards:
        - type: custom:stack-in-card
          cards:
            - type: custom:layout-card
              layout_type: custom:grid-layout
              layout:
                grid-template-columns: auto 63px
                margin: '-4px -4px -8px -4px'
              cards:
                - type: custom:stack-in-card
                  mode: horizontal
                  keep:
                    background: true
                    border_radius: true
                    margin: true
                  cards:
                    - type: custom:mushroom-template-card
                      primary: ''
                      secondary: Ender 3 Switch
                      icon: mdi:fan
                      tap_action:
                        action: toggle
                      layout: vertical
                      entity: switch.ender3_s1
                      icon_color: |-
                        {% if is_state(entity, 'on') %}
                          green
                        {% endif %}
                        {% if is_state(entity, 'off') %}
                          white
                        {% endif %}
                      double_tap_action:
                        action: toggle
                    - type: custom:mushroom-template-card
                      entity: button.octoprint_restart_server
                      secondary: Restart Octo
                      icon: mdi:restart-alert
                      icon_color: orange
                      layout: vertical
                      tap_action:
                        action: toggle
                    - type: custom:mushroom-template-card
                      entity: button.octoprint_resume_job
                      secondary: Resume
                      icon: mdi:play
                      icon_color: green
                      layout: vertical
                      tap_action:
                        action: toggle
  - type: conditional
    conditions:
      - entity: input_boolean.octo_controls
        state: 'on'
    card:
      type: horizontal-stack
      cards:
        - type: custom:stack-in-card
          cards:
            - type: custom:layout-card
              layout_type: custom:grid-layout
              layout:
                grid-template-columns: auto 63px
                margin: '-4px -4px -8px -4px'
              cards:
                - type: custom:stack-in-card
                  mode: horizontal
                  keep:
                    background: true
                    border_radius: true
                    margin: true
                  cards:
                    - type: custom:mushroom-template-card
                      entity: switch.octoprint_pause_print
                      secondary: Pause
                      icon: mdi:pause
                      icon_color: yellow
                      layout: vertical
                      tap_action:
                        action: toggle
                    - type: custom:mushroom-template-card
                      entity: button.octoprint_stop_job
                      secondary: Stop
                      icon: mdi:stop
                      icon_color: red
                      layout: vertical
                      tap_action:
                        action: toggle
                    - type: custom:mushroom-template-card
                      entity: button.octoprint_cancel_print
                      icon: mdi:cancel
                      secondary: Cancel
                      icon_color: red
                      layout: vertical
                      tap_action:
                        action: toggle
  - type: conditional
    conditions:
      - entity: input_boolean.octoprint_webcam
        state: 'on'
    card:
      camera_view: auto
      type: picture-glance
      title: Ender 3 S1
      image: http://192.168.68.145/webcam/?action=stream
      entities: []
      tap_action:
        action: toggle
      hold_action:
        action: toggle
  - type: conditional
    conditions:
      - entity: input_boolean.octo_info
        state: 'on'
    card:
      type: vertical-stack
      cards:
        - type: horizontal-stack
          cards:
            - type: custom:mushroom-entity-card
              entity: sensor.octoprint_print_progress
              icon: mdi:printer-3d
              icon_color: lime
              name: Progress
            - type: custom:mushroom-entity-card
              entity: sensor.octoprint_print_time_left
              name: ETA
              icon: mdi:home-clock
              icon_color: lime
        - type: horizontal-stack
          cards:
            - type: custom:mushroom-entity-card
              entity: switch.octoprint_connect_to_printer
              tap_action:
                action: toggle
              icon_color: teal
              name: Connect to Octo
            - type: custom:mushroom-entity-card
              entity: binary_sensor.octoprint_connected
              name: Octo Connection
              icon: mdi:check-network
              icon_color: teal
  - type: conditional
    conditions:
      - entity: input_boolean.octo_info
        state: 'on'
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.octoprint_print_file
      camera_image: camera.cura_print_thumbnail
      tap_action:
        action: toggle

Similar Posts

2 Comments

  1. How do we tell what out base sensor is? i have 3 octoprint integrations on my home assistant

  2. Man that was a lot of work to set up from scratch, mqtt gave me some grief. The end result is awesome though! I had to take some additional steps that weren’t mentioned here, such as enabling the thumbnails plugin in Cura. I also had to modify the code you posted on reddit to add a generic camera for the stl thumbnails. I used:
    {{ “http://xxx.xxx.xx.xx/plugin/prusaslicerthumbnails/thumbnail/” + states(“sensor.octoprint_print_file”).split(“.”)[0] + “.png” }}

    Thanks a ton for all your work!

Leave a Reply

Your email address will not be published. Required fields are marked *