1
0

Add automation to connect octoprint automatically

This commit is contained in:
pgrondek 2021-04-10 11:45:24 +02:00
parent 244e1424c0
commit 3eaff26ea0
2 changed files with 23 additions and 2 deletions

View File

@ -1,6 +1,5 @@
- id: 3dprinter-off - id: 3dprinter-off
alias: '[3D Printer] Turn off' alias: '[3D Printer] Turn off'
description: ''
mode: single mode: single
trigger: trigger:
- type: value - type: value
@ -21,3 +20,13 @@
- service: switch.turn_off - service: switch.turn_off
data: { } data: { }
entity_id: switch.3d_printer_switch 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

View File

@ -26,7 +26,7 @@ zwave:
network_key: !secret zwave_network_key network_key: !secret zwave_network_key
octoprint: octoprint:
host: prusa.lan host: 192.168.50.6
port: 5000 port: 5000
api_key: !secret octoprint_api_key api_key: !secret octoprint_api_key
number_of_tools: 1 number_of_tools: 1
@ -74,6 +74,18 @@ spotify:
shell_command: shell_command:
poweroff_pc: 'ssh -i /config/.ssh/id_rsa -o UserKnownHostsFile=/config/.ssh/known_hosts home-assistant@hulk.lan sudo /sbin/poweroff' 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: tplink:
discovery: true discovery: true
switch: switch: