diff --git a/.npmignore b/.npmignore index d2cf0b0..097021f 100644 --- a/.npmignore +++ b/.npmignore @@ -6,3 +6,4 @@ examples/ *.lock .eslintrc.js .travis.yml +archive/ diff --git a/examples/queue.js b/examples/queue.js index bda1d81..34a0d4f 100644 --- a/examples/queue.js +++ b/examples/queue.js @@ -1,5 +1,5 @@ import Schedule from '../src/schedule.js' -import Queue from '../src/queue.js' +import Runner from '../src/runner.js' const HOUR = 0 const MINUTE = 0 @@ -26,11 +26,11 @@ for (let zone=0; zone < NZONES; zone++) { zones[zone].update() } -const queue = new Queue ({ +const runner = new Runner ({ name: 'irrigation', // one: true, schedules: zones, }) -queue.start() -setTimeout(() => {queue.kill()},10*1000) +runner.start() +setTimeout(() => {runner.stop(true)},10*1000) diff --git a/package.json b/package.json index 2394313..cdefeac 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,9 @@ { - "name": "scheduler", - "version": "0.0.1", + "name": "@uci-utils/scheduler", + "version": "0.0.4", "description": "an irrigation style scheduler interfacing with Home Assistant", "type": "module", + "main": "src/index.js", "scripts": { "start": "node ./example/scheduler.js", "dev": "UCI_ENV=dev nodemon -r esm ./", diff --git a/src/schedule.js b/src/schedule.js index 2d4166d..4ec3bf4 100644 --- a/src/schedule.js +++ b/src/schedule.js @@ -9,8 +9,9 @@ import 'moment-duration-format' class UCISchedule extends EventEmitter { constructor(opts) { super(opts) - this.name = opts.name || 'test_schedule' - this.id = opts.id || this.name + this.name = opts.name || 'test' + this.id = opts.id || this.name.replace(/ /g, '_') + this.desc = opts.desc this.hour = opts.hour || 0 this.dev = opts.dev || process.env.UCI_ENV==='dev' this.minute = opts.minute || 0