diff --git a/automations/files/automations/3d-printer.yaml b/automations/files/automations/3d-printer.yaml index d22e34a..f4935a1 100644 --- a/automations/files/automations/3d-printer.yaml +++ b/automations/files/automations/3d-printer.yaml @@ -1,6 +1,5 @@ - id: 3dprinter-off alias: '[3D Printer] Turn off' - description: '' mode: single trigger: - type: value @@ -21,3 +20,13 @@ - service: switch.turn_off data: { } entity_id: switch.3d_printer_switch +- id: 3dprinter-on + alias: '[3D Printer] Turn on' + mode: single + trigger: + - platform: state + entity_id: switch.3d_printer_switch + to: 'on' + for: '00:00:05' + action: + - service: rest_command.octoprint_connect diff --git a/automations/files/configuration.yaml b/automations/files/configuration.yaml index c080b70..da6b96c 100644 --- a/automations/files/configuration.yaml +++ b/automations/files/configuration.yaml @@ -26,7 +26,7 @@ zwave: network_key: !secret zwave_network_key octoprint: - host: prusa.lan + host: 192.168.50.6 port: 5000 api_key: !secret octoprint_api_key number_of_tools: 1 @@ -74,6 +74,18 @@ spotify: shell_command: poweroff_pc: 'ssh -i /config/.ssh/id_rsa -o UserKnownHostsFile=/config/.ssh/known_hosts home-assistant@hulk.lan sudo /sbin/poweroff' +rest_command: + octoprint_connect: + url: 'http://192.168.50.6:5000/api/connection' + method: post + content_type: 'application/json' + headers: + X-Api-Key: !secret octoprint_api_key + payload: | + { + "command": "connect" + } + tplink: discovery: true switch: