Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用ha远程开关esxi下虚拟机 #8

Open
customsshen opened this issue Apr 8, 2024 · 0 comments
Open

使用ha远程开关esxi下虚拟机 #8

customsshen opened this issue Apr 8, 2024 · 0 comments
Labels
server something about homelab

Comments

@customsshen
Copy link
Owner

customsshen commented Apr 8, 2024

参考 wake_on_lan + shell_command实现ESXi Server开关机 - 『HomeAssistant』综合讨论区 - 『瀚思彼岸』» 智能家居技术论坛 - Powered by Discuz! (hassbian.com)

安装ha主机需要sshpass

docker 下安装sshpass

$ docker exec -it ha bash
 apk add --update --no-cache sshpass

安装成功后 添加configuration文件

switch:

  - platform: command_line

    switches:

      centos:

        command_on: "sshpass -p password ssh -o stricthostkeychecking=no -p22 [email protected] 'vim-cmd vmsvc/power.on 4'"

        command_off: "sshpass -p password ssh -o stricthostkeychecking=no -p22 [email protected] 'vim-cmd vmsvc/power.off 4'"

        command_state: "sshpass -p password  ssh -o stricthostkeychecking=no -p22 [email protected]'vim-cmd vmsvc/power.getstate 4|grep on|wc -l'"

        value_template: '{{ value == "1" }}'

        friendly_name: 虚拟机WIN7开关
@customsshen customsshen added the server something about homelab label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
server something about homelab
Projects
None yet
Development

No branches or pull requests

1 participant