if i understand you right it shouldnt be that hard. I have a created a switch in pimatic to power off/on my media server:
{
"id": "servergreen",
"name": "Media-Server",
"class": "ShellSwitch",
"onCommand": "sudo etherwake 6c:f0:49:74:xx:xx",
"offCommand": "ssh georg@192.168.1.37 sudo poweroff"
}
note: Etherwake infos here: Has to be installed on your NAS.
There were some problems because pimatic creates the ssh session as the wrong user. You have to transfer the right rsa-keys so pimatic is allowed to ssh poweroff (also described here). If this is what you search i have to take some time and look up what exactly i did.