How to make an on/off slider to send ssh shell commands?

I am very new to HAOS, so I am quite likely not asking this in the clearest sense possible, but here goes:

I already have the ssh shell command worked out and I have created a basic button that will send a shell command to the remote server. That works but I want to go deeper.

# SSH Shell Command
shell_command:
  ssh_vmstart: ssh -i /config/ssh_keys/id_ed25519 -o 'StrictHostKeyChecking=no' [email protected] 'bash /home/tazzy/bin/vmstart'  
  ssh_vmstop: ssh -i /config/ssh_keys/id_ed25519 -o 'StrictHostKeyChecking=no' [email protected] 'bash /home/tazzy/bin/vmstop'

I am wanting to start/stop a VM on Proxmox and have created a vmstart and vmstop script on Proxmox.

What I really want is a button/slider/control that when slid to the right would send the vmstart shell command (and maybe turn green), and then when slid to the left would send the vmstop shell command (and turn red).

As I search around online, I haven’t found a button or control like this.

Can someone guide me in the right direction?

You can either create a helper toggle with automation or you can create a template switch, both will serve your purpose.

Have you tried the Proxmox integration in HACS?
GitHub - dougiteixeira/proxmoxve: Proxmox VE Custom Integration Home Assistant

Not to dissuade you from your efforts, just why reinvent the wheel if not necessary.

1 Like

I can understand the point of what you are telling me, but I don’t know how to perform either of those tasks. Could you help me with a link to a walk-through?

The official HA document link I provided gives you examples of how to implement. For turn on/turn off you simply call a service to execute your shell commands.

- service: shell_command.ssh_vmstart
  data:

I had seen this before but misunderstood what it was. I just installed it now and am trying to learn how to use it.

Ok, cool. I will read this and see what I can do. I definitely appreciate the fast feedback and I’ll be sure to post back with results.