{"_id":"@agilatech/lynxari-timer-application","_rev":"2-ba43a6771a05f1dca74f65fc3344d9c3","name":"@agilatech/lynxari-timer-application","dist-tags":{"latest":"0.8.1"},"versions":{"0.8.0":{"name":"@agilatech/lynxari-timer-application","version":"0.8.0","description":"Lynxari Server App for controling devices on a timed schedule","main":"loader.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/Agilatech/lynxari-timer-application.git"},"keywords":["transition","timer"],"author":{"name":"scotty","email":"scott@agilatech.com","url":"http://agilatech.com"},"license":"MIT","dependencies":{"cron":"^1.4.1","solar-calc":"^1.1.0"},"gitHead":"ff53e84be2d211d6187d7f9878718d77bc563a32","bugs":{"url":"https://github.com/Agilatech/lynxari-timer-application/issues"},"homepage":"https://github.com/Agilatech/lynxari-timer-application#readme","_id":"@agilatech/lynxari-timer-application@0.8.0","_npmVersion":"6.4.1","_nodeVersion":"10.8.0","_npmUser":{"name":"scotty","email":"scott@agilatech.com"},"dist":{"integrity":"sha512-a4SIxAaos7lG/djX36wi3MAqhYY5ad3fe7gW/tVUZmhnijl7LlYTcrQqlLWpeGBg0Y0eVKHJngPZ4NvCvWH3Zw==","shasum":"7ce123f9fa44eb277e0410342b1664def5560b0e","tarball":"https://registry.npmjs.org/@agilatech/lynxari-timer-application/-/lynxari-timer-application-0.8.0.tgz","fileCount":8,"unpackedSize":24986,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbwNjJCRA9TVsSAnZWagAAnDMP/Rr2BXL4SzQ/i+qascGg\nlmRcLfU/VqEoVK3Eiddx2+dx5qcQEO0gcTA6EqKl5DUy/3Il2u5XswXTv12I\nexBeSUZ29YfeB+XWzSebSPtI/huuUMlwd7fTzwpSykaHeQocLk1IFPLdmjkb\n5kg8ymrNDEASVq8xiV5iYFx/5CHOOqE9uZn1od76PAFz6WN3qoF9SBkk4BYD\nO6EuoREp/IpF30qD80Ggd6ABxd+jLuA4iERjmB1sGPh+YM78Z4T9EbIOwssE\nwSvRUjZTE23zOYDZ3rNMzg6PWL0kuntRJgt8bthwJydM2VuqOj97OiH4+HPC\nf15Fx9hKvrbDcu4cy3NI/eNstSbEvU3rbTEb1NabcOAzLkLAQzpcRWLNixXn\nv0Mqfkjc0mUR/MwIdG4jbhOrzHPm+znegJXNRpXucnIVsJhZmmfy4CCFe/IY\nKNahFCULVDmQuOW1pH5P8Tsn6C0L6cB11IVdbH/XNiEuu/BJz8T0UlxCe4jB\nyX8Zy8ZBqCcNFkAMNd9hmV8zimRQTQi+IOwB5ayPkc/3tvMEWD9gsxG9uQy2\n9t0IpyheMB2lggvGxB1MKQ/eartVt7S4qCa7TaMDcZIhyx0mjMj3fkb/ZLuH\nfXBqfjOWH4qts3Wo0URqCqXR+TUDRGxOwHgL5TxIv1fp7dVXA0po5kSJ3pdF\n9wv5\r\n=evXF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCJ5ZkSt+5T6d3REUL/hz8IHpnwwdb2sILdWPt34KG+qgIhAJ8/fvNXgwam/NIgzAyrJ84rWhpkr8IZeTiZecUFweve"}]},"maintainers":[{"name":"scotty","email":"scott@agilatech.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lynxari-timer-application_0.8.0_1539365064455_0.9817306688461787"},"_hasShrinkwrap":false},"0.8.1":{"name":"@agilatech/lynxari-timer-application","version":"0.8.1","description":"Lynxari Server App for controling devices on a timed schedule","main":"loader.js","repository":{"type":"git","url":"git+https://github.com/Agilatech/lynxari-timer-application.git"},"keywords":["transition","timer"],"author":{"name":"scotty","email":"scott@agilatech.com","url":"http://agilatech.com"},"license":"MIT","dependencies":{"cron":"^1.4.1","solar-calc":"^1.1.0"},"gitHead":"d2c938c64051b29a0e3d679ad7e221b89efc0d69","bugs":{"url":"https://github.com/Agilatech/lynxari-timer-application/issues"},"homepage":"https://github.com/Agilatech/lynxari-timer-application#readme","_id":"@agilatech/lynxari-timer-application@0.8.1","_npmVersion":"6.4.1","_nodeVersion":"10.8.0","_npmUser":{"name":"scotty","email":"scott@agilatech.com"},"dist":{"integrity":"sha512-dU1j+w9pthFXiLzvcRMX4xgcrtntTDCSZS5Sbe6ZUnla7erpmrfRaHHFwyx+FglGaOE4hELgT3uk5lV6ZTYrug==","shasum":"1f6b924d406f46a9031cbd04b53f745848e124a1","tarball":"https://registry.npmjs.org/@agilatech/lynxari-timer-application/-/lynxari-timer-application-0.8.1.tgz","fileCount":8,"unpackedSize":25084,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4P+YCRA9TVsSAnZWagAARaIP/iBrFbQREPIxy+AjYtJe\nkGP6LdMkjDK4juX7sNvR1wokSmFltmXe+SfV3nVeixkqfY2lLIOWstYlf1Bw\nhw6PvXQPYxo5yhkZFYGmGYa0p+Xp2KqGkX+qab8UWF2XRWZsm+5XraBXraNt\nI+s2QVhDkjB4nJQz9rH7oAgdixjOcvkU7EnA4u2f+oapFjNiYNuN7GaD9Q//\njRV+aQBQpVlu9eySlsfTrGZqBF+e5FFrunAuZrGlFGjcDwnozLAt/bjCsl/B\nJ56wzRJ9635h3hAgHY8XE6HL6t0XfyQ55A3axF7R1qcI6ASZBLQ7BD5dZrgI\n5LROrmqXn2tkPaQInTxVHtxgz+hvLso3m2xB54hm1LvRGEgbFHRj9yeMizmc\nqVjfNRjtxUpi4tY5eZmlwIY90fBDWycP6nJxHK8q+4mMBDWlPekQfY6h8gtl\n9vFtylpu+c/3vxZ0CiHtghcTRhel2RYdYrBgRQTaIL3079TnTn1FvhnCzScw\nAk3sNFNvZVL6dAtd0MhQyxt6x/YNITZb0XDzNzt2wGMfmgVjfUxR5CvjB9A8\n3pG01KMBE4SZmTPskqRtpQ2PfSqUdaSTJxWYDTX0+hrU75h+z/D/LADBbHvJ\ncFV2TnbPaeRv7kgy68mzDzL2+cDfb3ZmLJoXyVaU5pJPcgLS25GMwyo1PDFh\nxno2\r\n=84IN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF1D9Z47sE4k8WhyBlaXCFDO7YcbWLiJV2dfwHUolj75AiAu0aWWU5zTstAKCyfZxH27RCxPHOmKfhWk8LGLy0Xe0w=="}]},"maintainers":[{"name":"scotty","email":"scott@agilatech.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lynxari-timer-application_0.8.1_1541472151866_0.14335914228785018"},"_hasShrinkwrap":false}},"time":{"created":"2018-10-12T17:24:24.341Z","0.8.0":"2018-10-12T17:24:24.613Z","modified":"2022-04-04T11:57:15.560Z","0.8.1":"2018-11-06T02:42:32.078Z"},"maintainers":[{"name":"scotty","email":"scott@agilatech.com"}],"description":"Lynxari Server App for controling devices on a timed schedule","homepage":"https://github.com/Agilatech/lynxari-timer-application#readme","keywords":["transition","timer"],"repository":{"type":"git","url":"git+https://github.com/Agilatech/lynxari-timer-application.git"},"author":{"name":"scotty","email":"scott@agilatech.com","url":"http://agilatech.com"},"bugs":{"url":"https://github.com/Agilatech/lynxari-timer-application/issues"},"license":"MIT","readme":"![Lynxari IoT Platform](https://agilatech.com/images/lynxari/lynxari200x60.png) **IoT Platform**\n## Lynxari Timer Application\n\n### Schedule events according to sun position or schedule\n\n\n### Install\n```\n$> npm install @agilatech/lynxari-timer-application\n```\nInstall in the same directory in which lynxari is installed. Create a config.json file to suit.\n\n\n### Purpose\nThe purpose of this application is to schedule actions and trigger events according to time or sun position. Through simple configuration, the app can initiate device transitions and launch shell programs at specific time periods, or at sunrise, sunset, noon, etc. No limits are placed onto the number of scheduled events, and the application may command devices on remotely linked servers as well as local ones.\n\n\n### Usage\nThis application runs on the [Agilatech®](https://agilatech.com) Lynxari IoT platform.  As such, it is not applicable for other environments.\n\nTo use it with Lynxari, simply insert its object definition as an element in the apps array in the _applist.json_ file. On startup, the Lynxari server reads _applist.json_ and starts all applications found there.\n\nA _config.json_ configuration file must be present in the module's main directory. For this module, that will be within the Lynxari home directory in _node\\_modules/@agilatech/lynxari-timer-application/config.json_\n\n\n### Configuration\nThe _config.json_ file defines an array of requests to be scheduled. Each request fully defines the event to be carried out and the schedule to be followed. The three main elements of a request are the class, the command, and the schedule.\n\n**class** : Must be one of **shell | transition** The 'shell' class is used to trigger an operating system call, such as a program or a shell script. The 'transition' class is used to trigger a platform device transition.\n\n**command** : The command is a JSON object which defines the actual instruction to be carried out. It may contain these fields:\n* **execute** : In a transition class, it is the device transition name. In shell class it is the shell program name itself.\n* **arguments** : (optional) Arguments to be passed to the transition or the shell program.\n   The following fields are only applicable in the transition class will be ignored in shell class:\n* **server** : The name of the Lynxari server to which the device is connected.\n* **device_name** : The name of the device itself.  Used in the query to find the device.  Will match all devices with this name.\n* **device_type** : The type of the device. Used in the query to find the device. Will match all devices of this type.\n* **device_id** : The ID tag of the device. This is specific to one and only device.\n\n\n**schedule** : The schedule is a JSON object which defines the time period or sun position at which to trigger the command. Time periods are specified in cron-like fashion and conform to crontab syntax, with the addition of seconds. Examples of sun position are sunrise, dusk, or noon, and take precedence over any time-of-day specification (hours/minutes/seconds).\n    \n* **second** : (optional) Defines the second time period. May be a integer, wildcard (*), set (5,20,45), or range (2-15).\n* **minute** : (optional) Defines the minute time period. May be a integer, wildcard (*), set (5,20,45), or range (2-15).\n* **hour** : (optional) Defines the hour time period. May be a integer, wildcard (*), set (5,20,45), or range (2-15).\n* **day_of_month** : (optional) Defines the numerical day of the month from 1-31. May be a integer, wildcard (*), set (5,20,45), or range (2-15).\n* **month** : (optional) Defines the numerical month from 0-11. May be a integer, wildcard (*), set (3,5,8), or range (2-4).\n* **day_of_week** : (optional) Defines the numerical day of the week from 0-6. May be a integer, wildcard (*), set (1,3,5), or range (0-4).\n* **sun** : sun is itself a JSON object which defines a sun position at a specific latitude and longitude.  If present and completely and correctly defined, it takes precedence over any time of day in the schedule.\n    * **position** : Specifies the sun position. Allowed values are sunrise | sunset | dawn | dusk | solarNoon | civilDawn | civilDusk | nauticalDawn | nauticalDusk | astronomicalDawn | astronomicalDusk . Please see below for further explanation.\n    * **latitude** : The latitude on the earth in decimal form (i.e. 35.642, -45.5475). Valid value range is from -90 to 90.\n    * **longitude** : The longitude on the earth in decimal form (i.e. -78.64342, 124.2526). Valid value range is from -180 to 180.\n   \n\n#### **schedule examples** :\n```\n\"schedule\": {\n    \"second\": \"*\",\n    \"minute\": \"*\",\n    \"hour\": \"*\",\n    \"day_of_month\": \"*\",\n    \"month\": \"*\",\n    \"day_of_week\": \"*\"\n}\n```\nIf all time period commands are wildcards, the command is triggered every second of every day.\n\nNote that any time period not specified defaults to a wildcard. In fact, if the schedule object is _completely omitted_, that is equivalent to the above definition with all wildcards defined.\n\n```\n\"schedule\": {\n    \"second\": \"0\",\n    \"minute\": \"15\",\n    \"day_of_month\": \"10,20\",\n    \"month\": \"2-3\"\n}\n```\nThe command will be triggered after 14:59 minutes after the top of every hour on the 10th and 20th of March and April (note that only the day of month is not zero-based). If the second were not specified to be 0, then the command would be triggered _every_ second during the 14 minute.\n\n**NOTE:** If both day\\_of\\_month and day\\_of\\_week are defined and not wildcard, then precedence is given to day\\_of\\_week. \n\n#### **sun position definitions**\n\n* **sunrise** is when the upper edge of the Sun appears over the eastern horizon in the morning (0.833 degrees)\n* **sunset** is when the upper edge of the Sun disappears below the horizon\n* **civilDawn** or just **dawn** is when there is enough light for objects to be distinguishable. This occurs when the sun is 6 degrees below the horizon in the morning\n* **nauticalDawn** is when there is enough sunlight for the horizon and some objects to be distinguishable. This occurs when the Sun is 12 degrees below the horizon in the morning\n* **astronomicalDawn** is when the sky is no longer completely dark. This occurs when the Sun is 18 degrees below the horizon in the morning\n* **civilDusk** or just **dusk** is when the sun is 6 degrees below the horizon in the evening. At this time objects are distinguishable and some stars and planets are visible to the naked eye.\n* **nauticalDusk** is when the sun is 12 degrees below the horizon in the evening. At this time, objects are no longer distinguishable, and the horizon is no longer visible to the naked eye\n* **astronomicalDusk** is when the sun is 18 degrees below the horizon in the evening. At this time the sun no longer illuminates the sky, and thus no longer interferes with astronomical observations\n* **solarNoon** is when the sun transits the celestial meridian – roughly the time when it is highest above the horizon\n\n\nHere is an example of a valid sun position object definition:\n```\n\"sun\": {\n    \"position\": \"nauticalDusk\",\n    \"latitude\": 32.949009,\n    \"longitude\": -105.140349\n}\n```\n\nCombining the schedule and sun definitions, the following will time an event to occur every Sunday evening at astronomical dusk:\n```\n\"schedule\": {\n    \"day_of_week\": \"6\",\n    \"sun\": {\n        \"position\": \"astronomicalDusk\",\n        \"latitude\": 35.78,\n        \"longitude\": -78.649999\n    }\n}\n```\n#### **example config.json**\nPutting it all together then, a valid example config file looks like:\n```\n{\n    \"requests\": [\n        {\n            \"class\": \"transition\",\n            \"command\": {\n                \"execute\": \"light-switch\",\n                \"arguments\": [\"high\"],\n                \"server\": \"bldg1\",\n                \"device_name\": \"south-flood\",\n            },            \n            \"schedule\": {\n                \"sun\":  {\n                    \"position\": \"dusk\",\n                    \"latitude\": 35.78,\n                    \"longitude\": -78.649999\n                }\n            }\n        },\n        {\n            \"class\": \"transition\",\n            \"command\": {\n                \"execute\": \"light-switch\",\n                \"arguments\": [\"low\"],\n                \"server\": \"bldg1\",\n                \"device_name\": \"south-flood\",\n            },            \n            \"schedule\": {\n                \"sun\":  {\n                    \"position\": \"dawn\",\n                    \"latitude\": 35.78,\n                    \"longitude\": -78.649999\n                }\n            }\n        },\n        {\n            \"class\": \"shell\",\n            \"command\" : {\n                \"execute\": \"mysqldump\",\n                \"arguments\": [\"--dump-date\", \"station\", \"> /home/systems/dbdumps\"]\n            },\n            \"schedule\": {\n                \"second\": \"0\",\n                \"minute\": \"0\",\n                \"hour\": \"2\",\n            }\n        }\n    ]\n}\n```\n\nThis timer configuration will switch on the south flood light on building 1 at dusk and then off at dawn. It will also save the mysql station database every night at 2AM.\n\n### Copyright\nCopyright © 2018 [Agilatech®](https://agilatech.com). All Rights Reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","readmeFilename":"README.md"}