{"id":16828020,"url":"https://github.com/hyperlink/open-window-service","last_synced_at":"2025-03-17T20:29:19.006Z","repository":{"id":57117014,"uuid":"373856004","full_name":"hyperlink/open-window-service","owner":"hyperlink","description":"http service that queries Open Weather API and Ecobee to answer if you should open your window","archived":false,"fork":false,"pushed_at":"2021-06-09T02:54:11.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-24T17:17:28.273Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/hyperlink.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}},"created_at":"2021-06-04T13:48:05.000Z","updated_at":"2023-04-11T15:37:34.000Z","dependencies_parsed_at":"2022-08-22T22:20:46.990Z","dependency_job_id":null,"html_url":"https://github.com/hyperlink/open-window-service","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperlink%2Fopen-window-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperlink%2Fopen-window-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperlink%2Fopen-window-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperlink%2Fopen-window-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperlink","download_url":"https://codeload.github.com/hyperlink/open-window-service/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244105248,"owners_count":20398830,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-10-13T11:24:11.007Z","updated_at":"2025-03-17T20:29:18.985Z","avatar_url":"https://github.com/hyperlink.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hey Siri, should I open my window?\n\nhttp service that queries Open Weather API and Ecobee to answer the question if you should open your window. Create an iOS shortcut to ask Siri if you should open your window.\n\n## Requirements\n\n#### To register for an account:\n\n* Goto https://www.ecobee.com/developers\n* Click on **Become a Developer**\n* Sign in with your ecobee account\n* Agree to the terms\n\n\u003e ⚠️ The developer sign up doesn't play well with two-factor authentication turned on. If you have 2FA enabled make sure you disable it on your phone before signing up. You can always reenable it after signing up.\n\n### Open Weather Map API Account\n\n* Sign up for an account on: https://openweathermap.org/\n* Once confirming the sign up e-mail\n* Navigate to **My API Keys**\n* Copy the appId from your apps page\n\n\u003e ⚠️ App IDs takes time to get enabled so if you get an error abount an invalid app ID wait awhile.\n\n### Shortcuts app installed on your iOS Device\n\nDownload this app if you don't already have it on your phone:\n[https://apps.apple.com/us/app/shortcuts/id1462947752]()\n\n## Installation\n\n### Clone repo or npm install\n\n```\nnpm install -g @hyperlink/open-window-service\n```\n\n\n### Get token to access ecobee\n\nThis step is a bit manual unfortunately. I didn't take any time to make this easy because is a one time taks. You're all setup once you get your `refresh_token`.\n\n#### Login to Ecobee account\n\nOnce Ecobee developer account is registered login to your account and click **Developer** link to create an app. Fill out Application Name, Application Summary and make note of the **API key**. This key is what you would use in place for `ECOBEE_CLIENT_ID` environment variable\n\nMake an http GET to  `https://api.ecobee.com/authorize?client_id=\u003cyour client ID\u003e\u0026response_type=ecobeePin\u0026scope=smartWrite`\n\nthat gives you a response:\n\n```json\n{\n    \"ecobeePin\": \"XXXX-ABCD\",\n    \"code\": \"\u003ccode needed for next request\u003e\",\n    \"interval\": 5,\n    \"expires_in\": 900,\n    \"scope\": \"openid,offline_access,smartWrite\"\n}\n```\n\nThen make a http `POST` to \n`https://api.ecobee.com/token?grant_type=refresh_token\u0026code=\u003ccode from above\u003e\u0026client_id=\u003cyour client ID\u003e`\n\nTo get the follow result.\n\n```json\n{\n    \"access_token\": \"\u003creally long string\u003e\",\n    \"token_type\": \"Bearer\",\n    \"refresh_token\": \"\u003crefresh_token\u003e\",\n    \"expires_in\": 3600,\n    \"scope\": \"openid,smartWrite,offline_access\"\n}\n```\n\n`ECOBEE_REFRESH_TOKEN` should be the `refresh_token` result.\n\n### Get app ID from Open Weather\n\nSet the app ID to `WEATHER_APP_ID`\n\n\n\n## Start the service\n\nYou can create a script to launch this or use PM2.\n\n\n```\nmodule.exports = {\n  apps: [{\n    name: 'Open Window Service',\n    exec_mode: 'fork',\n    instances: 1,\n    script: 'src/index.ts',\n    time: true,\n    watch: 'src',\n    env: {\n      WEATHER_APP_ID: '\u003cYOUR APP ID\u003e',\n      ECOBEE_REFRESH_TOKEN: '\u003cYOUR TOKEN\u003e',\n      ECOBEE_CLIENT_ID: '\u003cYOUR CLIENT ID\u003e',\n      // port the endpoint it's going to be on\n      PORT: 3000\n    }\n  }]\n};\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperlink%2Fopen-window-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperlink%2Fopen-window-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperlink%2Fopen-window-service/lists"}