iobroker.drag-indicator 2.0.0 → 2.0.1

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
@@ -23,6 +23,9 @@ e.g. you can use it for power or temperature values.
23
23
  ### **WORK IN PROGRESS**
24
24
  -->
25
25
 
26
+ ### 2.0.1 (2022-06-08) - Bugfix unsubscribe additional value
27
+ * (BenAhrdt) Do not unsubscribe additional values with deactivate object
28
+
26
29
  ### 2.0.0 (2022-06-04)
27
30
  * (BenAhrdt) deploy implemented
28
31
 
package/io-package.json CHANGED
@@ -1,8 +1,20 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "drag-indicator",
4
- "version": "2.0.0",
4
+ "version": "2.0.1",
5
5
  "news": {
6
+ "2.0.1": {
7
+ "en": "Do not unsubscribe additional values with deactivate object",
8
+ "de": "Abmelden Sie zusätzliche Werte nicht mit deaktiviertem Objekt",
9
+ "ru": "Не отписывайте дополнительные значения с деактивируемым объектом",
10
+ "pt": "Não cancelar a assinatura de valores adicionais com objeto desativado",
11
+ "nl": "Beschrijf geen extra waarden met deactive",
12
+ "fr": "Ne pas désabonner des valeurs supplémentaires avec objet désactivé",
13
+ "it": "Non cancellare i valori aggiuntivi con oggetto disattivato",
14
+ "es": "No descríbete valores adicionales con objeto desactivado",
15
+ "pl": "Niepodpisuje dodatkowych wartości z deaktywacją obiektów",
16
+ "zh-cn": "未用其他价值加以限制"
17
+ },
6
18
  "2.0.0": {
7
19
  "en": "deploy implemented",
8
20
  "de": "bereitstellen implementiert",
package/main.js CHANGED
@@ -151,7 +151,9 @@ class DragIndicator extends utils.Adapter {
151
151
  },
152
152
  native: {},
153
153
  });
154
- this.log.debug(`state ${tempId} added / activated`);
154
+ if(this.common.loglevel == "debug"){
155
+ this.log.debug(`state ${tempId} added / activated`);
156
+ }
155
157
  this.subscribeStates(tempId);
156
158
  this.activeStatesLastAdditionalValues[this.namespace + "." + tempId] = id;
157
159
  this.setState(tempId,false,true);
@@ -169,7 +171,9 @@ class DragIndicator extends utils.Adapter {
169
171
  },
170
172
  native: {},
171
173
  });
172
- this.log.debug(`state ${tempId} added / activated`);
174
+ if(this.common.loglevel == "debug"){
175
+ this.log.debug(`state ${tempId} added / activated`);
176
+ }
173
177
  this.subscribeStates(tempId);
174
178
  const lastState = await this.getStateAsync(tempId);
175
179
  if(lastState !== undefined && lastState !== null){
@@ -209,7 +213,9 @@ class DragIndicator extends utils.Adapter {
209
213
  delete this.cronJobs[cronJob][this.createStatestring(id)];
210
214
  if(Object.keys(this.cronJobs[cronJob]).length <= 1)
211
215
  {
212
- this.log.debug("job canceled: " + cronJob);
216
+ if(this.common.loglevel == "debug"){
217
+ this.log.debug("job canceled: " + cronJob);
218
+ }
213
219
  schedule.cancelJob(this.cronJobs[cronJob][this.jobId]);
214
220
  delete this.cronJobs[cronJob];
215
221
  }
@@ -227,11 +233,20 @@ class DragIndicator extends utils.Adapter {
227
233
  // Unsubscribe and delete states if exists
228
234
  if(this.activeStates[id]){
229
235
  this.removefromCronJob(this.activeStates[id].lastCronJob,id);
230
- this.unsubscribeForeignStates(id);
231
- this.log.debug(`state ${id} not longer subscribed`);
232
236
  delete this.activeStates[id];
233
237
  this.subscribecounter -= 1;
234
238
  this.setState(this.subscribecounterId,this.subscribecounter,true);
239
+ if(!this.activeStatesLastAdditionalValues[id]){ // Dont unsubscribe in case of is additional value
240
+ this.unsubscribeForeignStates(id);
241
+ if(this.common.loglevel == "debug"){
242
+ this.log.debug(`state ${id} not longer subscribed`);
243
+ }
244
+ }
245
+ else{
246
+ if(this.common.loglevel == "debug"){
247
+ this.log.debug(`state ${id} not longer subscribed as active state, but still as additional`);
248
+ }
249
+ }
235
250
  }
236
251
  if(this.config.deleteStatesWithDisable || deleteState){
237
252
  for(const myId in this.additionalIds){
@@ -239,9 +254,13 @@ class DragIndicator extends utils.Adapter {
239
254
  const myObj = await this.getObjectAsync(tempId);
240
255
  if(myObj){
241
256
  this.unsubscribeStatesAsync(tempId);
242
- this.log.debug(`state ${tempId} removed`);
257
+ if(this.common.loglevel == "debug"){
258
+ this.log.debug(`state ${tempId} removed`);
259
+ }
243
260
  this.delObjectAsync(tempId);
244
- this.log.debug(`state ${this.namespace}.${tempId} deleted`);
261
+ if(this.common.loglevel == "debug"){
262
+ this.log.debug(`state ${this.namespace}.${tempId} deleted`);
263
+ }
245
264
  }
246
265
  }
247
266
  // Delete channel Object
@@ -255,6 +274,7 @@ class DragIndicator extends utils.Adapter {
255
274
 
256
275
  async onObjectChange(id, obj) {
257
276
  if (obj) {
277
+ this.log.info("Object");
258
278
  try {
259
279
  if(!obj.common.custom || !obj.common.custom[this.namespace]){
260
280
  if(this.activeStates[id])
@@ -362,7 +382,9 @@ class DragIndicator extends utils.Adapter {
362
382
 
363
383
  } else {
364
384
  // The state was deleted
365
- this.log.debug(`state ${id} deleted`);
385
+ if(this.common.loglevel == "debug"){
386
+ this.log.debug(`state ${id} deleted`);
387
+ }
366
388
  }
367
389
  }
368
390
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.drag-indicator",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Shows the min and max of a selected value",
5
5
  "author": {
6
6
  "name": "BenAhrdt",