{"id":19185803,"url":"https://github.com/getraid/desktopkillswitch","last_synced_at":"2026-03-19T08:35:22.162Z","repository":{"id":125372571,"uuid":"211740079","full_name":"getraid/DesktopKillSwitch","owner":"getraid","description":"An App that should be hosted on a Raspberry Pi to kill the electrictiy after shutdown of your PC","archived":false,"fork":false,"pushed_at":"2022-10-01T21:14:40.000Z","size":302,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-23T02:44:21.475Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getraid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-29T23:37:13.000Z","updated_at":"2022-10-01T21:11:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"5e084af0-0feb-47bf-a158-cb372e77c9f6","html_url":"https://github.com/getraid/DesktopKillSwitch","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/getraid/DesktopKillSwitch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getraid%2FDesktopKillSwitch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getraid%2FDesktopKillSwitch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getraid%2FDesktopKillSwitch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getraid%2FDesktopKillSwitch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getraid","download_url":"https://codeload.github.com/getraid/DesktopKillSwitch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getraid%2FDesktopKillSwitch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29968444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T10:55:55.490Z","status":"ssl_error","status_checked_at":"2026-03-01T10:55:55.175Z","response_time":124,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T11:11:59.489Z","updated_at":"2026-03-01T11:31:19.254Z","avatar_url":"https://github.com/getraid.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DesktopKillSwitch\n\n![img](docs/icon.png)\n\nAn App that should be hosted on a Raspberry Pi to kill the electricity after shutdown of your PC\n\n# Requirements\n\n- [DesktopKillSwitch-Client](https://github.com/getraid/DesktopKillSwitch-client)\n- Raspberry Pi or other server, that is always running with a network connection.\n- Running Node, NPM\n- Hue-Bridge with Hue compatible SmartPlug (In my case OSRAM Smart+ Plug )\n- If you use something other than the OSRAM Smart+ Plug, you might need a bit of knowledge about the Hue API.\n\n# Motivation / Idea\n\nSince a recent Windows update my machine started to boot itself up after some random hours or even minutes. I first thought it was magic packet that looped through the switch somehow. But it came so unexpectedly and every night, that I decided I'd use a more \"traditional\" approach (with like... killing the electricity... you know).  \nSo I bought myself this OSRAM Smart+ Plug, while it was on a discount and thought to myself: \"I need to automate this on shutdown somehow.\"\nAnd so here I am writing this script. For maybe you, who may be in the same situation. So yeah, you're welcome ✌\n\n# Setup\n\n## Hue\n\nFind your local IP adress of your Hue Bridge and go to `http://\u003c\u003cip of hue\u003e\u003e/debug/clip.html`\n\nType into the URL textbox: `/api` and **hit the physical Hue Bridge button** in your living room or somewhere else.\n\nPaste this text into the Message Body:\n\n```json\nBody:\n{\n \"devicetype\": \"DesktopKillSwitch#specificuser\"\n}\n```\n\nand hit **`POST`**\n\nThe `#specificuser` can be changed. But it doesn't matter since we only have one user.\n\nNow you get a response that looks like this:\n\n```json\n[\n  {\n    \"success\": {\n      \"username\": \"N3-Ml1833byTd3L2LJcR7PuzUz1QktG3bc2nXmUu\"\n    }\n  }\n]\n```\n\nSave this username, as it is important for this application to work.\n\nNext we're going to find our hue power outlet by searching through all our lamps.\nWe do that with a **`GET`** request to `/api/{username}/lights` in our hue debug window.\n\nIf you gave your outlet a name in the Hue app before, you can just CTRL+F for the given name.\nWe're just searching for the top most number of the object.\n\nIn my case it would be `4`, as seen by my output:\n\n```json\n\t\"4\": {\n\t\t\"state\": {\n\t\t\t\"on\": true,\n\t\t\t\"alert\": \"select\",\n\t\t\t\"mode\": \"homeautomation\",\n\t\t\t\"reachable\": false\n\t\t},\n\t\t\"swupdate\": {\n\t\t\t\"state\": \"notupdatable\",\n\t\t\t\"lastinstall\": \"2019-09-18T20:46:08\"\n\t\t},\n\t\t\"type\": \"On/Off plug-in unit\",\n\t\t\"name\": \"PC Switch\",\n\t\t\"modelid\": \"Plug 01\",\n\t\t\"manufacturername\": \"OSRAM\",\n\t\t\"productname\": \"On/Off plug\",\n\t\t\"capabilities\": {\n\t\t\t\"certified\": false,\n\t\t\t\"control\": {},\n\t\t\t\"streaming\": {\n\t\t\t\t\"renderer\": false,\n\t\t\t\t\"proxy\": false\n\t\t\t}\n\t\t},\n\t\t\"config\": {\n\t\t\t\"archetype\": \"classicbulb\",\n\t\t\t\"function\": \"functional\",\n\t\t\t\"direction\": \"omnidirectional\"\n\t\t},\n\t\t\"swversion\": \"V1.04.12\"\n\t}\n\n```\n\nSave this number as well.\n\n## Install on a Raspberry Pi\n\nMy recommendation for this setup would be a Raspberry Pi Zero W, that would be _chilling_ under your table.\n\n[Install Node.js on your Pi](https://www.w3schools.com/nodejs/nodejs_raspberrypi.asp)\nBut watch out for the version.\nMy Pi runs on Node Version`v9.11.2`, so I guess above version 9 should be fine.\n\nNext install git and clone this repo:\n\n```bash\nsudo apt install git\ncd ~\ngit clone https://github.com/getraid/DesktopKillSwitch.git\ncd DesktopKillSwitch\n```\n\nInstall the node packages:\n\n```bash\nnpm install\n```\n\n## Program settings\n\nOpen main.js with nano\n\n```\nnano main.js\n```\n\nScroll to the `---settings---` section and fill in the variables\n\nExample:\n\n```js\n//For example LAN and WLAN adresses of your computer\nlet hosts = [\"192.168.178.21\", \"192.168.178.25\"];\n\n//hueIp is the local Ip of your Hue Bridge\n//The username is your previously fetched name from the Hue Bridge API\n//The hue lightid is your outlet that we also previously fetched before.\nvar hueIp = \"192.168.178.30\";\nvar hueUsername = \"N3-Ml1833byTd3L2LJcR7PuzUz1QktG3bc2nXmUu\";\nvar hueLightId = \"4\";\n```\n\nNow you can save and exit this with CTRL+X and then Y\n\n## Run\n\njust run `npm run serve` and you are good to go!\n\n... well only if you never let your terminal session die.\n\nYou can either use something like tmux and deattach the window or go the clean route and install this as a service\nBut frankly I'm too lazy to describe this to you, since there are many tutorials out there.\nJust google for something like `linux create service node`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetraid%2Fdesktopkillswitch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetraid%2Fdesktopkillswitch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetraid%2Fdesktopkillswitch/lists"}