Home Assistant Community

Octoprint reconnect after Printer 3D turn on

#1

Hi,

I have some connected switch. My printers 3D are plugged on it.
After i turn on my printers, Octoprints were not connected automatically.

To resolve that :

a script octopiconnect.sh

/usr/bin/curl 'http://[IP_OCTOPI]/api/connection' -H 'X-Api-Key: API_KEY' -H 'Content-Type: application/json' --data-binary '{"command":"connect"}'

You need to get your Octoprint API Key for that

automations.yaml

   trigger:
     - platform: state
       entity_id: switch.creality_cr10
       to: 'on'
    action:
      - delay: '00:00:03'
      - service: shell_command.octocr10

in shell_commands.yaml

octocr10: /home/gano/.homeassistant/scripts/octopiconnect.sh
0 Likes