SOLVED: Remote ON & OFF an ILO server (HP Microserver) with SSH script and key

Still would love to do this with Hass.io but cannot figure the user permissions out so if anyone can help appreciated :slight_smile:

Kudos to @frenck and @cogneato on Discord who pointed me to this:

https://developers.home-assistant.io/docs/en/next/hassio_debugging.html#hassos-based-hassio

which helped solve the SSH connection issue and has allowed me to work this on Hass.io. Will work on a tutorial for it when I can retrace my steps!

2 Likes

So isnā€™t learning fun! With all of this you ended up learning a ton and will be more prepared for future curves.
Superb!

1 Like

Quick question, where in your hassio containerā€™s file system did you place your key file?

EDIT: Oh, dur. I guess I can put it anywhere so long as it has the right perms. Thanks!

1 Like

For future readers interested in this topic, and controlling remote devices via SSH, the link to ā€œA thorough guide on controlling anything SSH with Homeassistantsā€™s Hass.ioā€ above is broken but the material can still be found at https://dovydas.xyz/homeassistant/hyperion/ssh/hassio/2018/01/22/controlling-anything-via-ssh.html
Thanks for your useful contributions in this thread, John

1 Like

Useful thread

1 Like

I know its old thread, but stumbled upon it when looking to integrate my HP home server with iLO, and I did it via iLO API:

iLO 4 API: iLO RESTful API Data Model Reference (iLO 4)

My solution via RESTful Command: RESTful Command - Home Assistant

#RestAPI iLO start server
rest_command:
  server_poweron:
    url: "https://<IPADDRESS>/rest/v1/systems/1"
    method: POST
    headers:
      accept: "application/json"
    payload: '{"Action":"Reset","ResetType":"On"}'
    content_type:  'application/json; charset=utf-8'
    username: apiuser
    password: apipassword
    verify_ssl: false

I think that this is cleaner way of doing the same thing without the ssh, and you can create apiuser with only specific permissions on iLO.

happy iLOing :wink:

3 Likes

I was looking how to improve the binding off my HP Homeserver with ILO4.

After reading all the posts and the RESTful API DataModel Refernce i giot a bit an other solution as Above with one advatage, both directions of power control are possible

Start Server

  server_poweron:
    url: "https://<IPADDRESS>/rest/v1/systems/1"
    method: POST
    headers:
      accept: "application/json"
    payload: '{ "Action": "PowerButton", "PushType": "Press", "Target": "/Oem/Hp"}'
    content_type:  'application/json; charset=utf-8'
    username: apiuser
    password: apipassword
    verify_ssl: false

Stop Server

  server_poweroff:
    url: "https://<IPADDRESS>/rest/v1/systems/1"
    method: POST
    headers:
      accept: "application/json"
    payload: '{ "Action": "PowerButton", "PushType": "Press", "Target": "/Oem/Hp"}'
    content_type:  'application/json; charset=utf-8'
    username: apiuser
    password: apipassword
    verify_ssl: false

Blockquote