iobroker.sprinklecontrol 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -35,10 +35,12 @@ Wetterabhängige automatische Steuerung der Gartenbewässerung
35
35
  Placeholder for the next version (at the beginning of the line):
36
36
  ### **WORK IN PROGRESS**
37
37
  -->
38
+ ### 0.2.9 (2022-04-10)
39
+ * (Dirk-Peter-md) Bug-Initialisierungsroutine
38
40
 
39
41
  ### 0.2.8 (2022-03-20)
40
- * Adaptation for js controller 4
41
- * switched main.js to async
42
+ * (Dirk-Peter-md) Adaptation for js controller 4
43
+ * (Dirk-Peter-md) switched main.js to async
42
44
 
43
45
  ### 0.2.7 (16.10.2021)
44
46
  * (Dirk-Peter-md) zusätzliche Testnachrichten gelöscht, Readme aktualisiert
package/io-package.json CHANGED
@@ -1,8 +1,20 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "sprinklecontrol",
4
- "version": "0.2.8",
4
+ "version": "0.2.9",
5
5
  "news": {
6
+ "0.2.9": {
7
+ "en": "Bug initialization routine",
8
+ "de": "Bug-Initialisierungsroutine",
9
+ "ru": "Процедура инициализации ошибки",
10
+ "pt": "Rotina de inicialização de bugs",
11
+ "nl": "Bug initialisatie routine",
12
+ "fr": "Routine d'initialisation de bogue",
13
+ "it": "Routine di inizializzazione dei bug",
14
+ "es": "Rutina de inicialización de errores",
15
+ "pl": "Procedura inicjowania błędów",
16
+ "zh-cn": "错误初始化例程"
17
+ },
6
18
  "0.2.8": {
7
19
  "en": "Adaptation for js controller 4; switched main.js to async",
8
20
  "de": "Anpassung für js-Controller 4; main.js auf async umgestellt",
@@ -253,7 +253,7 @@ const switchTheValvesOffOn = async (threadList, parallel) => {
253
253
  if (err) {
254
254
  return err;
255
255
  } else {
256
- adapter.log.info(`Valve => Set (${myConfig.config[entry.sprinkleID].methodControlSM}) ID: ${entry.sprinkleName}, value: ${entry.enabled}, duration: ${addTime(entry.wateringTime,'')}`);
256
+ adapter.log.info(`Set (${myConfig.config[entry.sprinkleID].methodControlSM}) ID: ${entry.sprinkleName}, value: ${entry.enabled}, duration: ${addTime(entry.wateringTime,'')}`);
257
257
  }
258
258
  });
259
259
  entry.enabledState = entry.enabled;
@@ -576,7 +576,7 @@ function setPumpOnOff(pumpOnOff) {
576
576
  ack: false
577
577
  });
578
578
  currentPumpUse.enable = true;
579
- adapter.log.info('Set pump on');
579
+ adapter.log.info('Set (pump) on');
580
580
  }
581
581
  } else {
582
582
  if (state.val !== false) {
@@ -585,7 +585,7 @@ function setPumpOnOff(pumpOnOff) {
585
585
  ack: false
586
586
  });
587
587
  currentPumpUse.enable = false;
588
- adapter.log.info('Set pump off');
588
+ adapter.log.info('Set (pump) off');
589
589
  }
590
590
  }
591
591
  } else if (err) {
@@ -610,7 +610,7 @@ function setVoltageOnOff(voltageOnOff) {
610
610
  val: true,
611
611
  ack: false
612
612
  });
613
- adapter.log.info('Set voltage on');
613
+ adapter.log.info('Set (voltage) on');
614
614
  }
615
615
  } else {
616
616
  if (state.val !== false) {
@@ -618,7 +618,7 @@ function setVoltageOnOff(voltageOnOff) {
618
618
  val: false ,
619
619
  ack: false
620
620
  });
621
- adapter.log.info('Set voltage off');
621
+ adapter.log.info('Set (voltage) off');
622
622
  }
623
623
  }
624
624
  } else if (err) {
package/main.js CHANGED
@@ -443,24 +443,24 @@ async function checkActualStates () {
443
443
  if (adapter.config.publicHolidays === true && (adapter.config.publicHolInstance !== 'none' || adapter.config.publicHolInstance !== '')) {
444
444
  /**
445
445
  * Feiertag Heute
446
- * @type {ioBroker.GetStatePromise}
446
+ * @type {ioBroker.State | void}
447
447
  * @private
448
448
  */
449
- const _publicHolInstanceHeute = adapter.getForeignStateAsync(
449
+ const _publicHolInstanceHeute = await adapter.getForeignStateAsync(
450
450
  adapter.config.publicHolInstance + '.heute.boolean'
451
451
  ).catch((e) => adapter.log.warn(e));
452
- if (await _publicHolInstanceHeute && _publicHolInstanceHeute.val) {
453
- publicHolidayStr = _publicHolInstanceHeute.val;
454
- }
452
+ if (_publicHolInstanceHeute && _publicHolInstanceHeute.val) {
453
+ publicHolidayStr = _publicHolInstanceHeute.val;
454
+ }
455
455
  /**
456
456
  * Feiertag MORGEN
457
- * @type {ioBroker.GetStatePromise}
457
+ * @type {ioBroker.State | void}
458
458
  * @private
459
459
  */
460
- const _publicHolInstanceMorgen = adapter.getForeignStateAsync(
460
+ const _publicHolInstanceMorgen = await adapter.getForeignStateAsync(
461
461
  adapter.config.publicHolInstance + '.morgen.boolean'
462
462
  ).catch((e) => adapter.log.warn(e));
463
- if (await _publicHolInstanceMorgen && _publicHolInstanceMorgen.val) {
463
+ if (_publicHolInstanceMorgen && _publicHolInstanceMorgen.val) {
464
464
  publicHolidayTomorrowStr = _publicHolInstanceMorgen.val;
465
465
  }
466
466
  }
@@ -468,13 +468,13 @@ async function checkActualStates () {
468
468
  if (adapter.config.weatherForecast === true && (adapter.config.weatherForInstance !== 'none' || adapter.config.weatherForInstance !== '')) {
469
469
  /**
470
470
  * Niederschlagsmenge HEUTE in mm
471
- * @type {ioBroker.GetStatePromise}
471
+ * @type {ioBroker.State | void}
472
472
  * @private
473
473
  */
474
- const _weatherForInstanceToday = adapter.getForeignStateAsync(
474
+ const _weatherForInstanceToday = await adapter.getForeignStateAsync(
475
475
  adapter.config.weatherForInstance + '.NextDaysDetailed.Location_1.Day_1.rain_value'
476
476
  ).catch((e) => adapter.log.warn(e));
477
- if (await _weatherForInstanceToday && _weatherForInstanceToday.val) {
477
+ if (_weatherForInstanceToday && _weatherForInstanceToday.val) {
478
478
  if (typeof _weatherForInstanceToday.val == 'string') {
479
479
  weatherForecastTodayNum = parseFloat(_weatherForInstanceToday.val);
480
480
  } else if (typeof _weatherForInstanceToday.val == 'number') {
@@ -491,28 +491,30 @@ async function checkActualStates () {
491
491
 
492
492
  /**
493
493
  * Niederschlagsmenge MORGEN in mm
494
- * @type {ioBroker.GetStatePromise}
494
+ * @type {ioBroker.State | void}
495
495
  * @private
496
496
  */
497
- const _weatherForInstance = adapter.getForeignStateAsync(
497
+ const _weatherForInstance = await adapter.getForeignStateAsync(
498
498
  adapter.config.weatherForInstance + '.NextDaysDetailed.Location_1.Day_2.rain_value'
499
499
  ).catch((e) => adapter.log.warn(e));
500
- if (_weatherForInstance && _weatherForInstance.val) {
501
- weatherForecastTomorrowNum = _weatherForInstance.val;
502
- await adapter.setStateAsync(
503
- 'info.rainTomorrow',
504
- weatherForecastTomorrowNum,
505
- true
506
- );
507
- }
500
+ if (_weatherForInstance && _weatherForInstance.val) {
501
+ weatherForecastTomorrowNum = _weatherForInstance.val;
502
+ await adapter.setStateAsync(
503
+ 'info.rainTomorrow',
504
+ weatherForecastTomorrowNum,
505
+ true
506
+ );
507
+ }
508
508
  }
509
509
  if (adapter.config.actualValueLevel){
510
510
  /**
511
511
  * Füllstand der Zisterne in %
512
- * @type {ioBroker.GetStatePromise}
512
+ * @type {ioBroker.State | void}
513
513
  * @private
514
514
  */
515
- const _actualValueLevel = adapter.getForeignStateAsync(adapter.config.actualValueLevel).catch((e) => adapter.log.warn(e));
515
+ const _actualValueLevel = await adapter.getForeignStateAsync(
516
+ adapter.config.actualValueLevel
517
+ ).catch((e) => adapter.log.warn(e));
516
518
  if (_actualValueLevel && typeof _actualValueLevel.val !== undefined) {
517
519
  valveControl.setFillLevelCistern(parseFloat(_actualValueLevel.val));
518
520
  }
@@ -520,6 +522,8 @@ async function checkActualStates () {
520
522
  /**
521
523
  * return the saved objects under sprinkle.*
522
524
  * rückgabe der gespeicherten Objekte unter sprinkle.*
525
+ * @type {ioBroker.NonNullCallbackReturnTypeOf<(err?: (Error | null), objects?: Record<string, ioBroker.AnyObject & {type: "channel"}>) => void> | void}
526
+ * @private
523
527
  */
524
528
  const _list = await adapter.getForeignObjectsAsync(adapter.namespace + '.sprinkle.*', 'channel').catch((e) => adapter.log.warn(e));
525
529
  if (_list) {
@@ -1082,14 +1086,14 @@ async function createSprinklers() {
1082
1086
  'type': 'boolean',
1083
1087
  'read': true,
1084
1088
  'write': true,
1085
- 'def': false
1089
+ 'def': true
1086
1090
  },
1087
1091
  'native': {},
1088
1092
  }).catch((e) => adapter.log.warn(`${objectName}.autoOn ${e}`));
1089
1093
  // Create Object for .actualSoilMoisture
1090
1094
  const _actualSoilMoistureNotExist = await adapter.setObjectNotExistsAsync(objPfad + '.actualSoilMoisture',
1091
1095
  objMetConSM
1092
- ).catch((e) => adapter.log.warn(`${objectName}.autoOn ${e}`));
1096
+ ).catch((e) => adapter.log.warn(`${objectName}.actualSoilMoisture ${e}`));
1093
1097
  // Create Object for .countdown => Countdown des Ventils
1094
1098
  const _countdownNotExist = adapter.setObjectNotExistsAsync(objPfad + '.countdown', {
1095
1099
  'type': 'state',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.sprinklecontrol",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Control of several sprinklers depending on weather conditions and pump performance.",
5
5
  "author": {
6
6
  "name": "Dirk Peter",
@@ -33,15 +33,15 @@
33
33
  "@types/chai-as-promised": "^7.1.5",
34
34
  "@types/gulp": "^4.0.9",
35
35
  "@types/mocha": "^9.1.0",
36
- "@types/node": "^17.0.21",
36
+ "@types/node": "^17.0.23",
37
37
  "@types/node-schedule": "^1.3.2",
38
38
  "@types/proxyquire": "^1.3.28",
39
39
  "@types/sinon": "^10.0.11",
40
- "@types/sinon-chai": "^3.2.5",
40
+ "@types/sinon-chai": "^3.2.8",
41
41
  "axios": "^0.26.1",
42
42
  "chai": "^4.3.4",
43
43
  "chai-as-promised": "^7.1.1",
44
- "eslint": "^8.11.0",
44
+ "eslint": "^8.12.0",
45
45
  "gulp": "^4.0.2",
46
46
  "mocha": "^9.1.2",
47
47
  "proxyquire": "^2.1.3",