{"action":"created","issue":{"url":"https://api.github.com/repos/smarthomeNG/smarthome/issues/267","repository_url":"https://api.github.com/repos/smarthomeNG/smarthome","labels_url":"https://api.github.com/repos/smarthomeNG/smarthome/issues/267/labels{/name}","comments_url":"https://api.github.com/repos/smarthomeNG/smarthome/issues/267/comments","events_url":"https://api.github.com/repos/smarthomeNG/smarthome/issues/267/events","html_url":"https://github.com/smarthomeNG/smarthome/issues/267","id":343400247,"node_id":"MDU6SXNzdWUzNDM0MDAyNDc=","number":267,"title":"Ipython in webinterface","user":{"login":"henfri","id":5280909,"node_id":"MDQ6VXNlcjUyODA5MDk=","avatar_url":"https://avatars2.githubusercontent.com/u/5280909?v=4","gravatar_id":"","url":"https://api.github.com/users/henfri","html_url":"https://github.com/henfri","followers_url":"https://api.github.com/users/henfri/followers","following_url":"https://api.github.com/users/henfri/following{/other_user}","gists_url":"https://api.github.com/users/henfri/gists{/gist_id}","starred_url":"https://api.github.com/users/henfri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henfri/subscriptions","organizations_url":"https://api.github.com/users/henfri/orgs","repos_url":"https://api.github.com/users/henfri/repos","events_url":"https://api.github.com/users/henfri/events{/privacy}","received_events_url":"https://api.github.com/users/henfri/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-07-22T11:56:53Z","updated_at":"2018-07-22T12:32:27Z","closed_at":null,"author_association":"NONE","body":"was ich wirklich vermisse an sh.py ist die Möglichkeit im Webinterface Zugriff auf IPython zu haben.\r\nIch hatte damals sogar an einem Plugin begonnen\r\n\r\n```\r\nimport logging\r\nfrom lib.model.smartplugin import SmartPlugin\r\nimport sys\r\nfrom IPython.terminal.ipapp import launch_new_instance\r\nfrom IPython.lib import passwd\r\nfrom socket import gethostname\r\nimport warnings\r\n\r\n\r\nclass IpythonServer(SmartPlugin):\r\n    PLUGIN_VERSION = \"1.1.2\"\r\n    ALLOW_MULTIINSTANCE = False\r\n\r\n    def __init__(self, smarthome):\r\n        self._sh = smarthome\r\n        self.logger     = logging.getLogger(__name__)\r\n        self.start_server()\r\n\r\n    def run(self):\r\n        self.alive = True\r\n        # if you want to create child threads, do not make them daemon = True!\r\n        # They will not shutdown properly. (It's a python bug)\r\n\r\n    def start_server(self):\r\n        #http://stackoverflow.com/questions/26338688/start-ipython-notebook-with-python-file\r\n        #http://www.xavierdupre.fr/app/pyquickhelper/helpsphinx/ipython_notebook_args.html\r\n        warnings.filterwarnings(\"ignore\", module = \"zmq.*\")\r\n        sys.argv.append(\"notebook\")\r\n        sys.argv.append(\"--IPKernelApp.pylab='inline'\")\r\n        sys.argv.append(\"--NotebookApp.ip=\" + gethostname())\r\n        sys.argv.append(\"--NotebookApp.open_browser=False\")\r\n        sys.argv.append(\"--NotebookApp.password=\"+passwd(\"dummy\"))\r\n        sys.argv.append(\"--ip=\\\"*\\\"\")\r\n        self.logger.info(\"[IPython] Starting server\")\r\n        launch_new_instance()\r\n\r\n    def stop(self):\r\n        self.alive = False\r\n\r\n    def parse_item(self, item):\r\n        if 'plugin_attr' in item.conf:\r\n            logger.debug(\"parse item: {0}\".format(item))\r\n            return self.update_item\r\n        else:\r\n            return None\r\n\r\n    def parse_logic(self, logic):\r\n        if 'xxx' in logic.conf:\r\n            # self.function(logic['name'])\r\n            pass\r\n\r\n    def update_item(self, item, caller=None, source=None, dest=None):\r\n        if caller != 'plugin':\r\n            logger.info(\"update item: {0}\".format(item.id()))\r\n\r\nif __name__ == '__main__':\r\n    logging.basicConfig(level=logging.DEBUG)\r\n    myplugin = IpythonServer('smarthome-dummy')\r\n    myplugin.run()\r\n```\r\nAber da reichten meine Fähigkeiten nicht aus.\r\nIch denke aus dem code oben ist am nützlich sind v.a. die zwei Links.\r\n\r\nWas denkt ihr?\r\n\r\nGruß,\r\nHendrik"},"comment":{"url":"https://api.github.com/repos/smarthomeNG/smarthome/issues/comments/406863272","html_url":"https://github.com/smarthomeNG/smarthome/issues/267#issuecomment-406863272","issue_url":"https://api.github.com/repos/smarthomeNG/smarthome/issues/267","id":406863272,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjg2MzI3Mg==","user":{"login":"henfri","id":5280909,"node_id":"MDQ6VXNlcjUyODA5MDk=","avatar_url":"https://avatars2.githubusercontent.com/u/5280909?v=4","gravatar_id":"","url":"https://api.github.com/users/henfri","html_url":"https://github.com/henfri","followers_url":"https://api.github.com/users/henfri/followers","following_url":"https://api.github.com/users/henfri/following{/other_user}","gists_url":"https://api.github.com/users/henfri/gists{/gist_id}","starred_url":"https://api.github.com/users/henfri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henfri/subscriptions","organizations_url":"https://api.github.com/users/henfri/orgs","repos_url":"https://api.github.com/users/henfri/repos","events_url":"https://api.github.com/users/henfri/events{/privacy}","received_events_url":"https://api.github.com/users/henfri/received_events","type":"User","site_admin":false},"created_at":"2018-07-22T12:32:27Z","updated_at":"2018-07-22T12:32:27Z","author_association":"NONE","body":"Das habe ich doch geschrieben.\r\nAktuell vs. Dann.\r\n\r\nDas eine ist interaktiv (Vorteile s.o.), das andere nicht.\r\nDa vergleichen wir Äpfel mit Birnen.\r\n"}}
{"actor":{"display_login":"henfri"}}