{"id":24624942,"url":"https://github.com/timball/over_engineered_porch_light","last_synced_at":"2026-04-19T07:33:39.342Z","repository":{"id":76087723,"uuid":"296944284","full_name":"timball/over_engineered_porch_light","owner":"timball","description":"An over engineered solution to a dumb porch light. ","archived":false,"fork":false,"pushed_at":"2020-10-26T03:16:16.000Z","size":117,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-07T16:41:29.982Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/timball.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":"2020-09-19T20:12:37.000Z","updated_at":"2020-10-26T03:16:19.000Z","dependencies_parsed_at":"2023-03-31T11:33:22.671Z","dependency_job_id":null,"html_url":"https://github.com/timball/over_engineered_porch_light","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/timball/over_engineered_porch_light","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timball%2Fover_engineered_porch_light","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timball%2Fover_engineered_porch_light/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timball%2Fover_engineered_porch_light/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timball%2Fover_engineered_porch_light/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timball","download_url":"https://codeload.github.com/timball/over_engineered_porch_light/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timball%2Fover_engineered_porch_light/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31998925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"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":[],"created_at":"2025-01-25T04:12:12.731Z","updated_at":"2026-04-19T07:33:39.300Z","avatar_url":"https://github.com/timball.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# over_engineered_porch_light\n##### Sat Sep 19 15:42:49 EDT 2020\n\nThis is some code to run a [bluetooth switchmate light\nswitch](https://www.mysimplysmarthome.com/products/smart-switches/). My\nuse case is for an annoying front porch light that is not connected to a\nbreaker so it can't simply be wired to a smart switch.\n\nThe code in switchmate.py is based on\nhttps://github.com/brianpeiris/switchmate. I refactored the code to be a\npython object. Also it no longer relies on sudo (at least on my raspberrypi). He\nlicensed his MIT so I'm doing the same.\n\nhorizons_to_times.py uses [pyephem](https://rhodesmill.org/pyephem/) to figure out when to\nturn on the light based on local sunrise and sunset. I mostly guessed at\nthe horizon angles that made sense and put those values into conf.yaml-example\n\nlightmachine.py uses [apscheduler](https://github.com/agronholm/apscheduler) to\nflexibly schedule execution times. \n[transitions](https://github.com/pytransitions/transitions) manages\nthe state machine that is a light switch. To be clear the states are \n\"Light.ON\", \"Light.OFF\", and \"Light.UNKN\".\n\nBecause Bt is annoying, every few minutes there has to be a check to\nverify the switch is in the right state. I could have been smarter about\nhow this check worked but Bt is annoying and unreliable.\n\nSome assumptions: \n- raspberry pi configured with bluetooth\n- raspberry pi time synced w/ ntpd or similiar\n- raspberry pi timezone set to UTC\n- switchmate mac addr set in conf.yaml \n    `python ./switchmate.py` can be used to scan for nearby switchmate switches\n\n## Usage\n```\n$ virtualenv -p python3 virt \n$ source virt/bin/activate\n$ pip install -r requirements.txt\n$ cp conf.yaml-example conf.yaml\n$ edit conf.yaml \n$ python ./lightmachine.py\n```\n\nAt somepoint would like to put https://www.cleardarksky.com/c/USNOkey.html or \napi.weather.com data into this to turn a light on based on darkness in the sky.\n\n--timball\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimball%2Fover_engineered_porch_light","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimball%2Fover_engineered_porch_light","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimball%2Fover_engineered_porch_light/lists"}