Home Assistant Integration of OMV Start/Shutdown Commands

  • Hi everyone!
    I am getting a little bit into home automation and have been implementing bit by bit small actions and automations into my Home Assistant interface. I am sure there are some people here have messed around with it but if not the question is independent so the answer for proficient linux users is likely a simple one....for me I am still learning.


    In my Home Assistant (installed on a Rasppi) I have figured out how to create a "switch" in the configuration.yaml which sends a WOL signal using the MAC address of my OMV installation


    - platform: wake_on_lan
    name: "OMV Server"
    mac_address: "xx-xx-xx-xx-xx-xx-xx"
    host: "192.168.x.xxx"


    Ok so far so good. It wakes up the OMV server and the switch registers the the server is on by the highlighted symbol. That was of course easy.
    Now for how can I integrate a shutdown command by toggling the switch to the "off" position. Here is where I am a little lost after digging the the OMV and Home Assistant forums, but so far I understand the easiest and best way to achieve this is through generating an RSA key on the Home Assistant Rasppi and transferring that to OMV, thus allowing a "one-liner" shutdown command. I am unsure of where to put these keys on the OMV side and before I go and break something I though I would throw this out there if anyone could correct or refine my steps:


    1) using root account on Rasppi (with Home Assistant) generate RSA Key: ssh-keygen -t rsa
    2) save key to ~/.ssh. This generates apparently two files- a id-rsa and and id-rsa.pub
    3 login to OMV: ssh user@192.168.x.xxx (or do I login as root?)
    4) cp id-rsa.pub (or is it the id-rsa without the .pub?) to OMV in /root/.ssh


    The shudown command in the configuration.yaml should then be: "sudo ssh root@192.168.x.xxx poweroff"


    I am little lost if I need a subfolder in the .ssh directory 'authorized_keys'. I had a look in the the root/.ssh of OMV and there are already two files with the same id-rsa and id-rsa.pub, so how I differentiate the new key to authenticate with the user account on Home Assistant?


    Thanks for the help!
    -Jay

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!