{"id":13802318,"url":"https://github.com/costastf/micropython_hourly_sleeper_library","last_synced_at":"2025-04-24T05:30:54.717Z","repository":{"id":70676569,"uuid":"94915260","full_name":"costastf/micropython_hourly_sleeper_library","owner":"costastf","description":"A micropython library that enables an esp8266 to sleep for hourly increments for a setup amount of hours.","archived":false,"fork":false,"pushed_at":"2017-06-20T17:24:20.000Z","size":18,"stargazers_count":13,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-22T12:35:09.940Z","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":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/costastf.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}},"created_at":"2017-06-20T17:00:40.000Z","updated_at":"2021-04-11T19:36:35.000Z","dependencies_parsed_at":"2023-03-31T05:11:20.615Z","dependency_job_id":null,"html_url":"https://github.com/costastf/micropython_hourly_sleeper_library","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/costastf%2Fmicropython_hourly_sleeper_library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/costastf%2Fmicropython_hourly_sleeper_library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/costastf%2Fmicropython_hourly_sleeper_library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/costastf%2Fmicropython_hourly_sleeper_library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/costastf","download_url":"https://codeload.github.com/costastf/micropython_hourly_sleeper_library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250572188,"owners_count":21452326,"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-08-04T00:01:41.961Z","updated_at":"2025-04-24T05:30:54.468Z","avatar_url":"https://github.com/costastf.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["IO"],"readme":"# esp8266 hourly deep sleep for multiple increments\nMicropython library that enables multiple hourly increments of deep sleep.\n\n\n# Problem statement\nBy default micropython can sleep up to 71 minutes. This creates a problem\nwhen one needs code to run once every day or even longer.\n\n# Solution\nThis library is an easy and unintrusive way to run some code once every a\nlong window of hours. The way it works is that it deep sleeps the board for\nan hour and upon waking checks the state of the RTC memory where it keeps an\nincrement.\n\n# Usage\n\n# boot.py\n    from library import HourlySleeper\n    # we instantiate the sleeper with the hours that we want it to sleep after\n    # the first execution of our code.\n    hourly_sleeper = HourlySleeper(24)\n\n   and that is all its needed in boot.py\n\n# main.py\n    import machine\n    import time\n\n\n    def main():\n        try:\n            hourly_sleeper()\n\n            # here is where our code would be\n            # we need the reset after our code so we enter the deep sleep loop\n\n            machine.reset()\n        except Exception:\n            machine.reset()\n\n    if __name__ == '__main__':\n        main()\n\n# Resetting the counter\n\nIf we need to reset the counter we need to hard reset the board through the\nreset button. Its best to try a couple of times to make sure that the signal\nis properly caught.\n\n\n# Debugging\n\nIn order to debug our code and the loop we can set\n\n    HOURLY_SLEEP_DEBUG=True\n\neither in boot.py or in main.py\nIf that variable is set the deepsleep performed is 6 seconds long instead of\nan hour to make the monitoring a bit more manageable.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcostastf%2Fmicropython_hourly_sleeper_library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcostastf%2Fmicropython_hourly_sleeper_library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcostastf%2Fmicropython_hourly_sleeper_library/lists"}