Skip to content

Instantly share code, notes, and snippets.

@FunDeckHermit
Created March 22, 2022 14:46
Show Gist options
  • Save FunDeckHermit/a1b4ec358f037578765e12f22b261ac1 to your computer and use it in GitHub Desktop.
Save FunDeckHermit/a1b4ec358f037578765e12f22b261ac1 to your computer and use it in GitHub Desktop.
Proxmox switch from Home Assistant
- platform: command_line
switches:
proxmox_lxc:
command_on: "curl -X POST 'https://10.0.0.1:8006/api2/json/nodes/pve/lxc/102/status/start' -H 'Authorization: PVEAPIToken=USER@REALM!TOKENID=UUID' -H 'Content-Type: application/x-www-form-urlencoded'"
command_off: "curl -X POST 'https://10.0.0.1:8006/api2/json/nodes/pve/lxc/102/status/stop' -H 'Authorization: PVEAPIToken=USER@REALM!TOKENID=UUID' -H 'Content-Type: application/x-www-form-urlencoded'"
command_state: "curl -X GET 'https://10.0.0.1:8006/api2/json/nodes/pve/lxc/102/status/current' -H 'Authorization: PVEAPIToken=USER@REALM!TOKENID=UUID' -H 'Content-Type: application/x-www-form-urlencoded' 2>&1 | grep -oc 'running'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment