Finally the solution was brought by @FriedCheese and @blackfede. Thanks, you made this a great day.
To summarize:
-
Install and activate ssh on both HA and NAS.
-
Access HA cli and generate keys with
ssh-keygen
don’t set passphrase and when prompted for file path:
-
Type:
/config/.ssh/id_rsa.pub
-
Copy the generated keys to NAS using:
ssh-copy-id -i /config/.ssh/id_rsa.pub user@NAS_IP
using your credentials. -
Run:
chmod 600 /config/.ssh/id_rsa’
-
Create a shell_command entry in config.yaml:
shell_command:
shutdown_nas: ssh -i /config/.ssh/id_rsa -o 'StrictHostKeyChecking=no' -p 9222 user@NAS_IP /sbin/shutdown
using your credentials.
- Restart HA
Now you should be able to call a service called: shutdown_nas
This way, I got rid of the need for a smart UPS.
Please correct me if I badly reported something.
If you encounter an issue, since I mistook almost everything could be mistaken, you’ll likely find the brief solution among replies, so take time to and care of reading.