{ "info": { "author": "Wojciech Bana\u015b", "author_email": "fizista+scron@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: Implementation :: MicroPython" ], "description": ".. role:: bash(code)\n :language: bash\n\n.. role:: python(code)\n :language: python\n\n***************************\nSimple CRON for MicroPython\n***************************\n\nSimpleCRON is a time-based task scheduling program inspired by the well-known\nCRON program for Unix systems.\n\nThe software was tested under micropython 1.10 (esp32, esp8266) and python 3.5.\n\n`Project documentation. `_\n\nWhat you can do with this library:\n##################################\n* Run any task at precisely defined intervals\n* Delete and add tasks while the program is running.\n* Run the task a certain number of times and many more.\n\nRequirements:\n#############\n* The board on which the micropython is installed(v1.10)\n* The board must have support for hardware timers.\n\n\nInstall\n#######\nYou can install using the upip:\n\n.. code-block:: python\n\n import upip\n upip.install(\"micropython-scron\")\n\nor\n\n.. code-block:: bash\n\n micropython -m upip install -p modules micropython-scron\n\n\nYou can also clone this repository, and install it manually:\n\n.. code-block:: bash\n\n git clone https://github.com/fizista/micropython-scron.git\n cd ./micropython-scron\n ./flash-src.sh\n\n\n\n\nESP8266\n*******\n\nThe library on this processor must be compiled into binary code.\n\nThe MicroPython cross compiler is needed for this.\n\nIf you already have the mpy-cross command available, then run the bash script:\n\n.. code-block:: bash\n\n ./compile.sh\n\nand then upload the library to the device, e.g. using the following script:\n\n.. code-block:: bash\n\n ./flash-byte.sh\n\n**Important!** An even better solution is to integrate this module into the firmware.\nThe module takes up much less RAM.\n\nTo do this, copy the :python:`scron` module to :bash:`micropython/ports/esp8266/modules`.\nThen compile the sources, and upload them to your device.\n\n\n\nSimple examples\n###############\n\nSimple code to run every second:\n\n.. code-block:: python\n\n from scron.week import simple_cron\n # OR\n # SimpleCRON single-class library, with minimal recursion depth.\n # This is mainly for ESP8266, because we have very few possible recursions.\n from scron.cweek import simple_cron\n # Depending on the device, you need to add a task that\n # will be started at intervals shorter than the longest\n # time the timer can count.\n # esp8266 about 5 minutes\n # esp32 - for processor ESP32D0WDQ6, the problem did not occur\n simple_cron.add('null', lambda *a, **k: None, seconds=0, minutes=range(0,59,5), removable=False)\n simple_cron.add('helloID', lambda *a,**k: print('hello'))\n simple_cron.run()\n\n\nCode, which is activated once a Sunday at 12:00.00:\n\n.. code-block:: python\n\n simple_cron.add(\n 'Sunday12.00',\n lambda *a,**k: print('wake-up call'),\n weekdays=6,\n hours=12,\n minutes=0,\n seconds=0\n )\n\n\nEvery second minute:\n\n.. code-block:: python\n\n simple_cron.add(\n 'Every second minute',\n lambda *a,**k: print('second call'),\n minutes=range(0, 59, 2),\n seconds=0\n )\n\n\nOther usage samples can be found in the 'examples' directory.\n\nHow to use it\n#############\n\nSomewhere in your code you have to add the following code,\nand from then on SimpleCRON is ready to use.\n\n.. code-block:: python\n\n from scron.week import simple_cron\n simple_cron.run() # You have to run it once. This initiates the SimpleCRON action,\n # and reserve one timmer.\n\n\n\nTo add a task you are using:\n\n.. code-block:: python\n\n simple_cron.add(, , ...)\n\n\nCallbacks\n#########\n\nExample of a callback:\n\n.. code-block:: python\n\n def some_counter(scorn_instance, callback_name, pointer, memory):\n if 'counter' in memory:\n memory['counter'] += 1\n else:\n memory['counter'] = 1\n\n\nwhere:\n\n* :python:`scorn_instance` - SimpleCRON instance, in this case scron.weekend.simple_cron\n* :python:`callback_name` - Callback ID\n* :python:`pointer` - This is an indicator of the time in which the task was to be run.\n Example: (6, 13, 5, 10). This is **(** Sunday **,** 1 p.m. **,** minutes 5 **,** seconds 10 **)**\n* :python:`memory` - Shared memory for this particular callback, between all calls.\n By default this is a dictionary.\n\nIf for some reason a running callback throws an exception,\nthen it is possible to process this event with special functions.\nThe default exception processing function is print().\n\nTo add new processing functions for callback exceptions, simply add them to the list below:\n\n.. code-block:: python\n\n simple_cron.callback_exception_processors(processor_function)\n\n\nwhere:\n\n processor_function is function(exception_instance)\n\nImportant notes:\n################\n\n* If a task takes a very long time, it blocks the execution of other tasks!\n* If there are several functions to run at a given time, then they are\n started without a specific order.\n* If the time has been changed (time synchronization with the network,\n own time change), run the :python:`simple_cron._sync_time()` function,\n which will set a specific point in time. Without this setting,\n it may happen that some callbacks will not be started.\n\n\nWhat has not been tested:\n#########################\n\n* SimpleCRON operation during sleep\n\nHow to test\n###########\n\nFirst install the following things:\n\n.. code-block:: bash\n\n git clone https://github.com/fizista/micropython-scron.git\n cd micropython-scron/\n micropython -m upip install -p modules micropython-unittest\n micropython -m upip install -p modules micropython-time\n\n\nThen run the tests:\n\n.. code-block:: bash\n\n ./run_tests.sh\n\nTesting directly on the device:\n\n.. code-block:: bash\n\n pip install pyserial adafruit-ampy\n\n ./run_tests_esp.sh upload_combined\n ./run_tests_esp.sh run /dev/ttyUSB0\n\n ./run_tests_esp.sh upload\n ./run_tests_esp.sh run /dev/ttyUSB0\n\n\n*******************\nSupport and license\n*******************\n\nIf you have found a mistake or other problem, write in the issues.\n\nIf you need a different license for this library (e.g. commercial),\nplease contact me: fizista+scron@gmail.com.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/fizista/micropython-scron", "keywords": "cron scheduler micropython", "license": "GPL3", "maintainer": "", "maintainer_email": "", "name": "micropython-scron", "package_url": "https://pypi.org/project/micropython-scron/", "platform": "", "project_url": "https://pypi.org/project/micropython-scron/", "project_urls": { "Homepage": "https://github.com/fizista/micropython-scron" }, "release_url": "https://pypi.org/project/micropython-scron/0.8.0/", "requires_dist": null, "requires_python": "", "summary": "Simple CRON for MicroPython.", "version": "0.8.0" }, "last_serial": 5729609, "releases": { "0.3.1": [ { "comment_text": "", "digests": { "md5": "3830c90590297087b14b57818617fb96", "sha256": "7d1dece0f4b679af07aa50a43eb1f1cd6cd8c62825c9c7bfa2adf3fdf12150d3" }, "downloads": -1, "filename": "micropython-scron-0.3.1.tar.gz", "has_sig": false, "md5_digest": "3830c90590297087b14b57818617fb96", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9136, "upload_time": "2019-02-18T16:28:25", "url": "https://files.pythonhosted.org/packages/97/7c/795606067121b0bd2775307ffb5bd1f910633ee7c2a88461c4753696be79/micropython-scron-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "6a3458d1a820cb8b022c990f9ab03ad8", "sha256": "a7e0288b0a094a2ba6332b8c9330f3f1c9a650968b9bcc39a367e2257841d6df" }, "downloads": -1, "filename": "micropython-scron-0.3.2.tar.gz", "has_sig": false, "md5_digest": "6a3458d1a820cb8b022c990f9ab03ad8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9264, "upload_time": "2019-02-18T16:53:47", "url": "https://files.pythonhosted.org/packages/5a/2d/dafe999686536184efaa1eefde683fb057d529a331cd1d6c0956a79b0fd6/micropython-scron-0.3.2.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "bb64e2358fac594d3ebcb78ef90fe42f", "sha256": "10fafc7e112336f40ffbe74b01ea38f9adf8d48ec8bec8d02c342af6999990aa" }, "downloads": -1, "filename": "micropython-scron-0.4.0.tar.gz", "has_sig": false, "md5_digest": "bb64e2358fac594d3ebcb78ef90fe42f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9567, "upload_time": "2019-02-20T11:58:29", "url": "https://files.pythonhosted.org/packages/9c/fc/3dcec37c16e78bcac940d442040db45a1fae076c715efc483a7b22ad3925/micropython-scron-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "6ae01b7ac335a730744a466566469da0", "sha256": "72ab0d5dc835922ad1b80c83cba88d448b7fd828d39ff6aafd3ed637d9fa522c" }, "downloads": -1, "filename": "micropython-scron-0.4.1.tar.gz", "has_sig": false, "md5_digest": "6ae01b7ac335a730744a466566469da0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9649, "upload_time": "2019-02-20T13:56:17", "url": "https://files.pythonhosted.org/packages/eb/b6/6fe721b26cb801c5c5e3157be48c12913b2911400542b00e88a22e4da9d3/micropython-scron-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "b26007a8e7a013b79a55c2d3cc017d87", "sha256": "17f275da9eb3556e4cf04dbe7b2b2ab25d97973abaebafe08be4550c32f36848" }, "downloads": -1, "filename": "micropython-scron-0.4.2.tar.gz", "has_sig": false, "md5_digest": "b26007a8e7a013b79a55c2d3cc017d87", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9656, "upload_time": "2019-02-20T15:04:07", "url": "https://files.pythonhosted.org/packages/1a/b1/fe1c5f1e991c9ee283a30f70e8c9fca935c81946af554840c5db4f9dd220/micropython-scron-0.4.2.tar.gz" } ], "0.4.3": [ { "comment_text": "", "digests": { "md5": "d722cf098fcffc731d6dfb4a875a2748", "sha256": "42a0fd7f15ded5afa93fcd1899b20f50836ee386c05445d403c5ba6ebd574df7" }, "downloads": -1, "filename": "micropython-scron-0.4.3.tar.gz", "has_sig": false, "md5_digest": "d722cf098fcffc731d6dfb4a875a2748", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9652, "upload_time": "2019-02-20T15:10:32", "url": "https://files.pythonhosted.org/packages/00/6d/6bd1cbfa3f57d084c312c968bb4163c9c89044cf4d517eff55573544ab0b/micropython-scron-0.4.3.tar.gz" } ], "0.4.4": [ { "comment_text": "", "digests": { "md5": "e339fa090d268533bef50f8d8e35bb08", "sha256": "4a6483e56963b1e367bc5b836918ea95f4ab248aa643e99681cddeac1eb55b87" }, "downloads": -1, "filename": "micropython-scron-0.4.4.tar.gz", "has_sig": false, "md5_digest": "e339fa090d268533bef50f8d8e35bb08", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9673, "upload_time": "2019-02-20T15:19:47", "url": "https://files.pythonhosted.org/packages/58/30/5c63c6c44b94f99856672841d9b8673b2d76f1541498164489ff0d54a88d/micropython-scron-0.4.4.tar.gz" } ], "0.4.5": [ { "comment_text": "", "digests": { "md5": "221e11849a56090a949be86dc5e780e0", "sha256": "3ae65b286a02b3ce80a8f62bbbce203d4034af1bb3d827883371e418f316240d" }, "downloads": -1, "filename": "micropython-scron-0.4.5.tar.gz", "has_sig": false, "md5_digest": "221e11849a56090a949be86dc5e780e0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9666, "upload_time": "2019-02-20T15:27:01", "url": "https://files.pythonhosted.org/packages/5a/f5/f58792ffc6faed95915cee3c2be8d3a10a7fd1b2afc40661aa3915745044/micropython-scron-0.4.5.tar.gz" } ], "0.4.6": [ { "comment_text": "", "digests": { "md5": "1bc357a61e33fb74a910b2e96ef51c16", "sha256": "bf6d0793f9892d2b8a4ead59093e84bd83b602f60e404b04625a9b0b0054d397" }, "downloads": -1, "filename": "micropython-scron-0.4.6.tar.gz", "has_sig": false, "md5_digest": "1bc357a61e33fb74a910b2e96ef51c16", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9702, "upload_time": "2019-04-13T11:54:42", "url": "https://files.pythonhosted.org/packages/02/13/51cfa2bda798d1aabe3d4f2257f7420936c5a0ef81edfe6f91e806fcc823/micropython-scron-0.4.6.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "fb38ee2d15360406ef2d19415e3847f5", "sha256": "8df66717ac7666f10bcb5d9dbeda4bf4b060f84df405c7875ddf28b796e6db66" }, "downloads": -1, "filename": "micropython-scron-0.5.0.tar.gz", "has_sig": false, "md5_digest": "fb38ee2d15360406ef2d19415e3847f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10156, "upload_time": "2019-04-13T16:46:45", "url": "https://files.pythonhosted.org/packages/fd/7c/38bc7f910f6c73a5eb29b504ff96703fc531a39d3cde5538d8270ba65080/micropython-scron-0.5.0.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "d30dfbe7e97c52af4512dce537c67acc", "sha256": "8b0e6cb6e056d5cafa9400816031381867f33d693851d59297a76a9631eaabc9" }, "downloads": -1, "filename": "micropython-scron-0.5.1.tar.gz", "has_sig": false, "md5_digest": "d30dfbe7e97c52af4512dce537c67acc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10206, "upload_time": "2019-04-15T07:01:32", "url": "https://files.pythonhosted.org/packages/f5/4f/7513cdf93827b5fbc85ad522564008552c4b502db0d885e00b66c2080045/micropython-scron-0.5.1.tar.gz" } ], "0.5.3": [ { "comment_text": "", "digests": { "md5": "c86de85bb1d6c507609453e1011ffe5a", "sha256": "9a406556b94f344dbd5b407c22cc0262abe822b70b037c6025ff730429569bc5" }, "downloads": -1, "filename": "micropython-scron-0.5.3.tar.gz", "has_sig": false, "md5_digest": "c86de85bb1d6c507609453e1011ffe5a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10204, "upload_time": "2019-04-15T08:18:13", "url": "https://files.pythonhosted.org/packages/83/ca/cbf2010befecdd59e1a6816bfe08d41196bcc7ac6c2968c38e9417f45522/micropython-scron-0.5.3.tar.gz" } ], "0.5.4": [ { "comment_text": "", "digests": { "md5": "83fbc2c4a374f37197f881fd962822be", "sha256": "91faee9e945a12534aacede5e93136ced92bf54667b1c95296f210e8122ab6b0" }, "downloads": -1, "filename": "micropython-scron-0.5.4.tar.gz", "has_sig": false, "md5_digest": "83fbc2c4a374f37197f881fd962822be", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10207, "upload_time": "2019-04-15T08:29:31", "url": "https://files.pythonhosted.org/packages/c4/51/abcba45a9c1e190f19945df3e9f623f2dcb1718acd10901506d65555ff80/micropython-scron-0.5.4.tar.gz" } ], "0.5.5": [ { "comment_text": "", "digests": { "md5": "34e5bbbbe5ce6787dc96c17ce9c70d71", "sha256": "b51636f2352383bd81ac9d231bfeec7216d81eaee2ada35c1d13081f31447f96" }, "downloads": -1, "filename": "micropython-scron-0.5.5.tar.gz", "has_sig": false, "md5_digest": "34e5bbbbe5ce6787dc96c17ce9c70d71", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10327, "upload_time": "2019-04-19T12:23:54", "url": "https://files.pythonhosted.org/packages/b1/f0/fb6819d5a11879287487731b9e903ecbbfc347dbfe11d39a61c0f8e37c54/micropython-scron-0.5.5.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "174c079e7d29eeca7751ee01209deca0", "sha256": "99fd0a2cb4c83a5d6d515a8f1ffe27d7afb9989e1435680f724d6ec305ec816a" }, "downloads": -1, "filename": "micropython-scron-0.6.0.tar.gz", "has_sig": false, "md5_digest": "174c079e7d29eeca7751ee01209deca0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10680, "upload_time": "2019-04-20T07:26:00", "url": "https://files.pythonhosted.org/packages/2e/ee/76d830d068bdceb9f447b56d82322dad2915ab5990f81556cd2d1715172f/micropython-scron-0.6.0.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "4a6e54e055954c70c7c516dbd11ce798", "sha256": "47bc9d9cd90eca9e213d3d077fc280c9bcedbf9f49734b2072049de7cb4cab8f" }, "downloads": -1, "filename": "micropython-scron-0.6.1.tar.gz", "has_sig": false, "md5_digest": "4a6e54e055954c70c7c516dbd11ce798", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10676, "upload_time": "2019-04-20T07:34:29", "url": "https://files.pythonhosted.org/packages/aa/dc/7b814e096e48c1b37b0204693ec2c8082dd1c5c5dd4068f3aa0d075fbb56/micropython-scron-0.6.1.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "62f882bcffd76c3b3a03a8a8cf23f1b7", "sha256": "27888eb3a875365b8cf96952cee7742459e77cd6cbf8dcc1d1ad0bd94edbf6a5" }, "downloads": -1, "filename": "micropython-scron-0.7.0.tar.gz", "has_sig": false, "md5_digest": "62f882bcffd76c3b3a03a8a8cf23f1b7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11209, "upload_time": "2019-04-27T07:58:34", "url": "https://files.pythonhosted.org/packages/ea/63/defcfa23949e301a2a0812048c470528fc4f3b96ae762dadfce007a21d22/micropython-scron-0.7.0.tar.gz" } ], "0.7.1": [ { "comment_text": "", "digests": { "md5": "ced7b06e2b7e2ecc5793358536667bc0", "sha256": "c6fbadd9520c9c05b2b9c5b3ce5c442da18b8d4fe06a5f54c599ead428a38079" }, "downloads": -1, "filename": "micropython-scron-0.7.1.tar.gz", "has_sig": false, "md5_digest": "ced7b06e2b7e2ecc5793358536667bc0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11176, "upload_time": "2019-04-27T08:05:49", "url": "https://files.pythonhosted.org/packages/f7/80/c141032a3276e329772ca0f6f6e29a9b241e30f61788ba2e9ccb138f7ca3/micropython-scron-0.7.1.tar.gz" } ], "0.8.0": [ { "comment_text": "", "digests": { "md5": "d7213bd303b9060f8dfaadd668e7310d", "sha256": "b8d758226958f94306085252a47fd6eb5ff4d52ddad03a1edcd181938c623bc9" }, "downloads": -1, "filename": "micropython-scron-0.8.0.tar.gz", "has_sig": false, "md5_digest": "d7213bd303b9060f8dfaadd668e7310d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17355, "upload_time": "2019-08-26T08:28:39", "url": "https://files.pythonhosted.org/packages/19/e8/a0389d7e156245f45f4a0d0705b6529bbace88d5b691369fac7326768c69/micropython-scron-0.8.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d7213bd303b9060f8dfaadd668e7310d", "sha256": "b8d758226958f94306085252a47fd6eb5ff4d52ddad03a1edcd181938c623bc9" }, "downloads": -1, "filename": "micropython-scron-0.8.0.tar.gz", "has_sig": false, "md5_digest": "d7213bd303b9060f8dfaadd668e7310d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17355, "upload_time": "2019-08-26T08:28:39", "url": "https://files.pythonhosted.org/packages/19/e8/a0389d7e156245f45f4a0d0705b6529bbace88d5b691369fac7326768c69/micropython-scron-0.8.0.tar.gz" } ] }