{"id":15188483,"url":"https://github.com/keybuk/homebridge-sun-position","last_synced_at":"2025-07-26T12:06:31.558Z","repository":{"id":57266089,"uuid":"131794796","full_name":"keybuk/homebridge-sun-position","owner":"keybuk","description":"Homebridge plugin to expose the position of the sun for automation","archived":false,"fork":false,"pushed_at":"2021-11-20T02:03:44.000Z","size":11,"stargazers_count":25,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-08T08:07:51.948Z","etag":null,"topics":["altitude","azimuth","homebridge","homekit","javascript","nodejs","sun-position"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keybuk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-02T03:45:31.000Z","updated_at":"2025-02-19T00:12:21.000Z","dependencies_parsed_at":"2022-08-25T03:40:49.429Z","dependency_job_id":null,"html_url":"https://github.com/keybuk/homebridge-sun-position","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/keybuk/homebridge-sun-position","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keybuk%2Fhomebridge-sun-position","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keybuk%2Fhomebridge-sun-position/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keybuk%2Fhomebridge-sun-position/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keybuk%2Fhomebridge-sun-position/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keybuk","download_url":"https://codeload.github.com/keybuk/homebridge-sun-position/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keybuk%2Fhomebridge-sun-position/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267162709,"owners_count":24045506,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["altitude","azimuth","homebridge","homekit","javascript","nodejs","sun-position"],"created_at":"2024-09-27T19:21:15.438Z","updated_at":"2025-07-26T12:06:31.492Z","avatar_url":"https://github.com/keybuk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# homebridge-sun-position\n[![npm](https://img.shields.io/npm/v/homebridge-sun-position.svg)](https://www.npmjs.com/package/homebridge-sun-position)\n[![npm](https://img.shields.io/npm/dt/homebridge-sun-position.svg)](https://www.npmjs.com/package/homebridge-sun-position)\n\nThis is a plugin for [Homebridge](https://github.com/nfarina/homebridge) to create a [HomeKit](https://www.apple.com/uk/ios/home/) accessory representing the position of the sun in the sky.\n\nThe intended use is with automation rules when combined with accessories such as window coverings, to adjust their position based on the true position of the sun.\n\nYou can download it from [npm](https://www.npmjs.com/package/homebridge-sun-position).\n\n## Installation\n\n1. Install and setup [Homebridge](https://github.com/nfarina/homebridge).\n\n2. Install this plugin:\n```\nnpm install -g homebridge-sun-position\n```\n3. Add a `SunPosition` accessory to your Homebridge `config.json`, providing the latitude and longitude of your location:\n\n```\n    \"accessories\" : [\n        {   \n            \"accessory\" : \"SunPosition\",\n            \"name\" : \"Sun\",\n            \"location\" : {\n            \t\"lat\" : 37.2343,\n            \t\"long\" : -115.8067\n            }\n        }\n    ]\n```\n\n## Screenshots\n\nA single \"Sun\" accessory is added to your home, represented as a Light Sensor; the lux values are somewhat arbitrary and are based on the current phase of the day. HomeKit requires a recognized service for automation, and this seemed like the closest thing.\n\nTo use the Altitude and Azimuth characteristics, you will need an app such as Matthias Hochgatterer's [Home - Smart Home Automation](https://itunes.apple.com/us/app/home-smart-home-automation/id995994352?mt=8) app. Using this app you can see the current position of the sun, and create automations based on it:\n\n![Characteristics](https://i.imgur.com/lRAdM0S.png)\n![Automation](https://i.imgur.com/ZHUVaKQ.png?)\n\n## Usage\n\nTo use this plugin you need to be reasonably comfortable with HomeKit automation, and understand the differences between Triggers and Conditions, and their limitations.\n\nAs of iOS 11.3, Threshold Range Event triggers do not seem to work with custom characteristics. Fortunately you can still check for *Any Change*, and combine that with conditions to verify the range.\n\nIf your HomeKit Automation app does not allow you to set two different conditions for the same characteristic, simply create two Sun accessories (Sun A and Sun B) in your `config.json`.\n\nIn addition, a trigger's End Event only seems to support Time Events, and not full characteristics as documented. You will need a second automation to \"undo\" the first, use a dummy switch such as from [homebridge-dummy](https://www.npmjs.com/package/homebridge-dummy) to track the state.\n\nHere is an example of rules to close window blinds when the sun shines through a South-facing window, and open them again once it passes:\n\n**Close Blinds**\n\u003e **Triggers:**\u003cbr\u003e\n\u003e Sun Azimuth *Any Change*\n\u003e \n\u003e **Conditions:**\u003cbr\u003e\n\u003e Sun Azimuth \u0026ge; 115.0\u0026deg;\u003cbr\u003e\n\u003e Sun Azimuth \u0026lt; 235.0\u0026deg;\n\u003e \n\u003e **Actions:**\u003cbr\u003e\n\u003e Set Scene *blinds down*\u003cbr\u003e\n\u003e Set Dummy Switch *on*\n\n**Open Blinds**\n\u003e **Triggers:**\u003cbr\u003e\n\u003e Sun Azimuth *Any Change*\n\u003e \n\u003e **Conditions:**\u003cbr\u003e\n\u003e Sun Azimuth \u0026ge; 235.0\u0026deg;\u003cbr\u003e\n\u003e Dummy Switch = on\n\u003e \n\u003e **Actions:**\u003cbr\u003e\n\u003e Set Scene *blinds up*\u003cbr\u003e\n\u003e Set Dummy Switch *off*\n\nMore advanced rules can be created by combing the azimuth and altitude of the sun, and by combing weather information such as from [homebridge-weather-extended](https://www.npmjs.com/package/homebridge-weather-station-extended).\n\nHe is an example for west-facing blinds that, only on a sunny day, come down in two phases based on the altitude of the sun, and go back up again once it's behind the houses or hills.\n\n**Half-close Blinds**\n\u003e **Triggers:**\u003cbr\u003e\n\u003e Sun Azimuth *Any Change*\n\u003e \n\u003e **Conditions:**\u003cbr\u003e\n\u003e Weather Condition Category = 0\u003cbr\u003e\n\u003e Sun Azimuth \u0026ge; 220.0\u0026deg;\u003cbr\u003e\n\u003e Sun Altitude \u0026le; 50.0\u0026deg;\u003cbr\u003e\n\u003e Sun Altitude \u0026gt; 30.0\u0026deg;\n\u003e \n\u003e **Actions:**\u003cbr\u003e\n\u003e Set Scene *blinds half down*\u003cbr\u003e\n\u003e Set Dummy Switch *on*\n\n**Fully-close Blinds**\n\u003e **Triggers:**\u003cbr\u003e\n\u003e Sun Azimuth *Any Change*\n\u003e \n\u003e **Conditions:**\u003cbr\u003e\n\u003e Weather Condition Category = 0\u003cbr\u003e\n\u003e Sun Azimuth \u0026ge; 220.0\u0026deg;\u003cbr\u003e\n\u003e Sun Altitude \u0026le; 30.0\u0026deg;\u003cbr\u003e\n\u003e Sun Altitude \u0026gt; 10.0\u0026deg;\n\u003e \n\u003e **Actions:**\u003cbr\u003e\n\u003e Set Scene *blinds fully down*\u003cbr\u003e\n\u003e Set Dummy Switch *on*\n\n**Open Blinds at Sunset**\n\u003e **Triggers:**\u003cbr\u003e\n\u003e Sun Azimuth *Any Change*\n\u003e \n\u003e **Conditions:**\u003cbr\u003e\n\u003e Sun Azimuth \u0026ge; 220.0\u0026deg;\u003cbr\u003e\n\u003e Sun Altitude \u0026le; 10.0\u0026deg;\u003cbr\u003e\n\u003e Dummy Switch = on\n\u003e \n\u003e **Actions:**\u003cbr\u003e\n\u003e Set Scene *blinds up*\u003cbr\u003e\n\u003e Set Dummy Switch *off*\n\n**Open Blinds when Cloudy**\n\u003e **Triggers:**\u003cbr\u003e\n\u003e Weather Condition Category *Any Change*\n\u003e \n\u003e **Conditions:**\u003cbr\u003e\n\u003e Weather Condition Category \u0026gt; 0\u003cbr\u003e\n\u003e Dummy Switch = on\n\u003e \n\u003e **Actions:**\u003cbr\u003e\n\u003e Set Scene *blinds up*\u003cbr\u003e\n\u003e Set Dummy Switch *off*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeybuk%2Fhomebridge-sun-position","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeybuk%2Fhomebridge-sun-position","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeybuk%2Fhomebridge-sun-position/lists"}