Kodi Community Forum

Full Version: Is there an addon which allows shutting down of NAS on exit?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
What it could / should do:

You exit or shutdown XBMC and it logs in in your NAS and shutting it down via SSH

Is there something like that?
Hello

I have written a service for Kodi. I tested it on Windows 7 32bit and Kodi 13.2

You need to have .NET 4.0 installed because i use a win32.exe to execute remote commands.
Maybe in future i'm able to get this to work in python.

Extract https://dl.dropboxusercontent.com/u/2116...Client.zip this zipfile to your Kodi addon directory. In my case because i use the portable mode c:\Program Files (x86)\XBMC13\portable_data\addons
Go into the directory service.SSHClient and open default.py with you favorite texteditor.

you find 3 #subprocess... lines. comment out by deleteing the # when the script should start.

e.g. Shutdown your NAS when KODI reboots the method looks like
Code:
def onNotification(self,sender, method, data):
        if method == "System.OnQuit":
            if data == "0":
                #KODI quits
                xbmc.log("SSH Client:KODI quits")
                #                                                       "host"        "user" "pass"            "command"
                #subprocess.call('"' + __addonpath__ + '\exe\EXESSH.exe" "192.168.1.1" "root" "mypass" "shutdown -h now"', shell=True)
                                
            elif data == "64":
                #KODI shutdown
                xbmc.log("SSH Client:KODI shutdown")
                #subprocess.call('"' + __addonpath__ + '\exe\EXESSH.exe" "192.168.1.1" "root" "mypass" "shutdown -h now"', shell=True)
                
            elif data == "66":
                #KODI reboot
                xbmc.log("SSH Client:KODI reboot")
                subprocess.call('"' + __addonpath__ + '\exe\EXESSH.exe" "192.168.1.1" "root" "mypass" "shutdown -h now"', shell=True)

At last fill in your host,user,pass and your shutdown command.
If you have any issues or some feedback let me know.