Control OctoPrint in HomeAssistant

Can u share above code?

@ryci Thank you for this comprehensive explanation. I have installed the Octoprint plugins and the threedy card and everything works fine. I have the following question: how did you added the extra entities, webcamera feed, switches, buttons and temperatures to the standard threedy card?

Hi KixMan
The camera feed and the buttons are not included in the threedy card. The card only shows the percent finished and the temperatures.
For the buttons and camera feed I used the built in picture element card and the button card.

Hi Ryci! Thank you. It is clear now.

I got an error in the threedy-card > e is undefined

What does this mean?

I do not use the thrredy card anymore. Having a look at the developers git repo issues page shows that there is an open issue for e is undefined:

Disable the ETA or Time remaining function of the card should remove the error for now.

1 Like

Yes Please share the code @DSHAESP

Hi:

Is it possible to see the octorelay entities in mqtt? I want to add the 4 relay board to the rpi to control the fan and LED.

1 Like

I have the same question ?

I found another way to automate my relay via octoprint API and home assistant rest_command.
Here is the code:

  3d_printer_internal_relay_on:
    url: http://octopi.local/api/plugin/octorelay
    method: POST
    headers:
      X-Api-Key: your_api_key
      content-type: 'application/json'
    payload: '{ "v": 2, "command": "update", "subject": "r2", "target": true }'

This is thanks to this doc: GitHub - borisbu/OctoRelay: OctoPrint / Octopi plugin to control relays

after migration from FHEM ( I think with API) to HA (with both MQTT and normal integration) I canā€™t find a solution to just ā€œpress the start buttonā€. I do this very often to just repeat the last print. It was possible with FHEM to just start.
Can anyone help how to do this now?

I have Octoprint configured and working in HA, I am wondering, is there any way to upload a gcode from HA and start printing it ?

This is awesome! One feature I miss is to set the temperature of the nozzle and bed. Why donā€™t we have this feature and all of those axis-moving options in the standard integration?
Can we start a feature request or isnā€™t it worth it? I mean modern 3d-printers have their own ā€œOctoPrintā€-like system what connects them to the network, so they donā€™t need a separate computer which does just that.
So might OctoPrint be slowly dying or what do you think?

Iā€™ve found it simpler to bypass the Octoprint MQTT plugin and use the Octoprint API directly from HA using the RESTful command integration. This way, almost everything can be controlled by sending one or more GCODEs directly to Octoprint for plugin parsing and onward transmission to the printer.

Printer operations ā€” OctoPrint master documentation

E.g. by using a payload template

rest_command:
  octoprint_gcode:
    url: http://<OctoPrint IP or HOSTNAME>/api/printer/command
    method: POST
    headers: 
        x-api-key: !secret octoprint_api_key
    payload: '{"command":"{{ gcode }}"}'
    content_type:  'application/json'

GCODEs can be sent in automations:

action: rest_command.octoprint_gcode
data:
  gcode: M300

(M300 is the beep command)

You can use the arbitrary command endpoint to set bed temp (M140/M190) & hotend temp (M104/M109), move the print head (G0), pause (G4) a print, bascially anything that a GCODE can doā€¦ https://marlinfw.org/meta/gcode/

An alternative to directly control OctoPrint (rather than the printer) is use specific API endpoints, e.g. call the job endpoint to start/cancel/restart/pause/resume an OctoPrint job:

rest_command:
  octoprint_job:
    url: http://<OctoPrint IP or HOSTNAME>/api/job
    method: POST
    headers: 
        x-api-key: !secret octoprint_api_key
    payload: '{"command":"{{ job }}"}'
    content_type:  'application/json'

To start (or re-print) an already loaded print job:

action: rest_command.octoprint_job
data:
  job: start