Hello guys,
I am pretty new to openHAB and still trying to figure out the easy things.
Have spent a lot of time googling for hints/howtos.
Setup: Raspberry pi running openHABian
Synology DS215j
What I want to accomplish:
Use a simply switch, that tells me if synology is ON /OFF and that I can use to turn it ON or OFF.
What have I accomplished so far?
Status as well as WOL work.
I can shut down the Synology with a bash script which I put in the openhabian home folder /home/openhabian on the raspberry pi.
[I had to configure passwordless ssh and enable all administrators to run the poweroff command on the Synology.
So when running the bash script via PuTTy on openhabian the Synology shuts down.
I seem to be able to run the script:
items file:
Switch DS215j "Diskstation DS-215j" {
channel="network:pingdevice:192_168_178_40:online",
exec=">[OFF:'bash ./synology.sh']",
/*channel="[OFF:exec:command:synoff:run],*/
wol="192.168.178.255#xx-xx-xx-xx-xx-xx"
}
I have included the commented part as I tried to use a simple thing for the command
Thing exec:command:synoff [command="./synology.sh" ]
Both (running thing or direct exec) give the following error
An exception occurred while executing ‘./synology.sh’ : ‘Cannot run program “./synology.sh”: error=2, No such file or directory’
So it must be that openhabian uses a different user or starts in a different folder - I assume.
Additionally the script seems to run every 1 minute although the station is online and I did not use the button.
Exchanging
./synology.sh
with
/home/openhabian/synology.sh
did not do the trick either
I would greatly appreciate a hint in the right direction (link to existing topic) or direct help.
Thanks for your time.
BR