iobroker.lorawan 1.18.17 → 1.18.19

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,12 @@ For now there is documentation in English here: https://wiki.hafenmeister.de
23
23
  Placeholder for the next version (at the beginning of the line):
24
24
  ### **WORK IN PROGRESS**
25
25
  -->
26
+ ### 1.18.19 (2025-11-26)
27
+ * (BenAhrdt) possibility to publish one id in spezial and normal entity
28
+
29
+ ### 1.18.18 (2025-11-25)
30
+ * (BenAhrdt) Bugfix limit sitch topic to state_topic
31
+
26
32
  ### 1.18.17 (2025-11-25)
27
33
  * (BenAhrdt) Bugfix limit switch closed
28
34
 
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.18.17",
4
+ "version": "1.18.19",
5
5
  "news": {
6
+ "1.18.19": {
7
+ "en": "possibility to publish one id in spezial and normal entity",
8
+ "de": "möglichkeit, eine id in spezial und normal zu veröffentlichen",
9
+ "ru": "возможность публикации одного идентификатора в пространственной и нормальной сущности",
10
+ "pt": "possibilidade de publicar um id em entidade específica e normal",
11
+ "nl": "mogelijkheid om één id te publiceren in een specifieke en normale entiteit",
12
+ "fr": "possibilité de publier un id en entité spezial et normale",
13
+ "it": "possibilità di pubblicare un id in entità spezial e normale",
14
+ "es": "posibilidad de publicar una id en entidad espacial y normal",
15
+ "pl": "możliwość opublikowania jednego identyfikatora w jednostce spezialnej i normalnej",
16
+ "uk": "можливість опублікувати одну ідентифікацію в спорідненому і нормальному суб’єкті",
17
+ "zh-cn": "在普通实体中公布一个标识的可能性"
18
+ },
19
+ "1.18.18": {
20
+ "en": "Bugfix limit sitch topic to state_topic",
21
+ "de": "Bugfix limit sitch Thema zu state_topic",
22
+ "ru": "Bugfix ограничивает тему ситча state_topic",
23
+ "pt": "Assunto de configuração limite de Bugfix para state_topic",
24
+ "nl": "Bugfix limit sitch topic to state_topic",
25
+ "fr": "Bugfix limit sitch topic to state_topic",
26
+ "it": "Bugfix limit sitch argomento a state_topic",
27
+ "es": "Bugfix límite de sitch tema a state_topic",
28
+ "pl": "Temat limit bugfix do stanu _ topic",
29
+ "uk": "Виправлення ліміту висихання до стану_topic",
30
+ "zh-cn": "错误fix 将 sitch 话题限制为状态_ title"
31
+ },
6
32
  "1.18.17": {
7
33
  "en": "Bugfix limit switch closed",
8
34
  "de": "Bugfix Endschalter geschlossen",
@@ -67,32 +93,6 @@
67
93
  "pl": "Bugfix: błędna subskrypcja fix ids",
68
94
  "uk": "Помилки: неправильне підсобнення попелиці",
69
95
  "zh-cn": "错误fix: fx ID 的子缩写错误"
70
- },
71
- "1.18.12": {
72
- "en": "Bugfix fx in case of number",
73
- "de": "Bugfix fx bei Anzahl",
74
- "ru": "Bugfix fx в случае номера",
75
- "pt": "Bugfix fx em caso de número",
76
- "nl": "Bugfix fx bij aantal",
77
- "fr": "Bugfix fx en cas de nombre",
78
- "it": "Bugfix fx in caso di numero",
79
- "es": "Fx Bugfix en caso de número",
80
- "pl": "Bugfix fx w przypadku liczby",
81
- "uk": "Виправлення помилок при кількості",
82
- "zh-cn": "如果出现数字, 错误fx"
83
- },
84
- "1.18.11": {
85
- "en": "Bugfix fx for published ids",
86
- "de": "Bugfix fx für veröffentlichte ids",
87
- "ru": "Bugfix fx для опубликованных идентификаторов",
88
- "pt": "Bugfix fx para IDs publicados",
89
- "nl": "Bugfix fx voor gepubliceerde id's",
90
- "fr": "Bugfix fx pour les ids publiés",
91
- "it": "Bugfix fx per ids pubblicati",
92
- "es": "Fx Bugfix para los ids publicados",
93
- "pl": "Bugfix fx dla opublikowanych idów",
94
- "uk": "Bugfix fx для опублікованих ids",
95
- "zh-cn": "已发布 ID 的臭虫fx"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -753,72 +753,159 @@ class bridgeClass {
753
753
  }
754
754
  }
755
755
 
756
- if (this.PublishedIds[id].light) {
757
- val = {};
758
- val.state = (await this.adapter.getForeignStateAsync(this.PublishedIds[id].LightIds.onOff)).val;
759
- val.state = val.state === true ? 'ON' : 'OFF';
760
- if (this.PublishedIds[id].LightIds.brightness) {
761
- val.brightness = (
762
- await this.adapter.getForeignStateAsync(this.PublishedIds[id].LightIds.brightness)
756
+ // Iterate the state_topics
757
+ for (const publishTopic in this.PublishedIds[id].publish) {
758
+ if (this.PublishedIds[id].publish[publishTopic].light) {
759
+ val = {};
760
+ val.state = (
761
+ await this.adapter.getForeignStateAsync(
762
+ this.PublishedIds[id].publish[publishTopic].publish[publishTopic].LightIds.onOff,
763
+ )
763
764
  ).val;
765
+ val.state = val.state === true ? 'ON' : 'OFF';
766
+ if (this.PublishedIds[id].publish[publishTopic].LightIds.brightness) {
767
+ val.brightness = (
768
+ await this.adapter.getForeignStateAsync(
769
+ this.PublishedIds[id].publish[publishTopic].LightIds.brightness,
770
+ )
771
+ ).val;
772
+ }
773
+ if (this.PublishedIds[id].publish[publishTopic].LightIds.color) {
774
+ val.color_mode = 'rgb';
775
+ val.color = this.hexToRgb(
776
+ (
777
+ await this.adapter.getForeignStateAsync(
778
+ this.PublishedIds[id].publish[publishTopic].LightIds.color,
779
+ )
780
+ ).val,
781
+ );
782
+ }
783
+ if (this.PublishedIds[id].publish[publishTopic].LightIds.effects) {
784
+ const effect = (
785
+ await this.adapter.getForeignStateAsync(
786
+ this.PublishedIds[id].publish[publishTopic].LightIds.effects,
787
+ )
788
+ ).val;
789
+ val.effect = '';
790
+ if (this.PublishedIds[id].publish[publishTopic].effects[effect]) {
791
+ val.effect = this.PublishedIds[id].publish[publishTopic].effects[effect];
792
+ }
793
+ }
764
794
  }
765
- if (this.PublishedIds[id].LightIds.color) {
766
- val.color_mode = 'rgb';
767
- val.color = this.hexToRgb(
768
- (await this.adapter.getForeignStateAsync(this.PublishedIds[id].LightIds.color)).val,
769
- );
795
+
796
+ if (this.PublishedIds[id].publish[publishTopic].cover) {
797
+ if (this.PublishedIds[id].publish[publishTopic].message) {
798
+ if (this.PublishedIds[id].publish[publishTopic].message[val]) {
799
+ val = this.PublishedIds[id].publish[publishTopic].message[val];
800
+ } else {
801
+ val = '';
802
+ }
803
+ }
770
804
  }
771
- if (this.PublishedIds[id].LightIds.effects) {
772
- const effect = (await this.adapter.getForeignStateAsync(this.PublishedIds[id].LightIds.effects))
773
- .val;
774
- val.effect = '';
775
- if (this.PublishedIds[id].effects[effect]) {
776
- val.effect = this.PublishedIds[id].effects[effect];
805
+
806
+ // safe old values (5 last values)
807
+ if (this.PublishedIds[id].publish[publishTopic].values) {
808
+ if (!this.PublishedIds[id].publish[publishTopic].oldValues) {
809
+ this.PublishedIds[id].publish[publishTopic].oldValues = [];
810
+ }
811
+ if (this.PublishedIds[id].publish[publishTopic].oldValues.length >= this.MaxValueCount) {
812
+ this.PublishedIds[id].publish[publishTopic].oldValues.pop();
777
813
  }
814
+ this.PublishedIds[id].publish[publishTopic].oldValues.unshift(
815
+ structuredClone(this.PublishedIds[id].publish[publishTopic].values),
816
+ );
817
+ }
818
+ if (!this.PublishedIds[id].publish[publishTopic].values) {
819
+ this.PublishedIds[id].publish[publishTopic].values = {};
820
+ }
821
+ this.PublishedIds[id].publish[publishTopic].values.val = val;
822
+ this.PublishedIds[id].publish[publishTopic].values.ts = Date.now();
823
+ this.PublishedIds[id].publish[publishTopic].values.time = new Date(Date.now()).toLocaleString(
824
+ this.Timeoutput.Argument,
825
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
826
+ // @ts-expect-error
827
+ this.Timeoutput.Format,
828
+ );
829
+ if (typeof val !== 'string') {
830
+ val = JSON.stringify(val);
831
+ }
832
+ if (!options) {
833
+ options = { retain: true };
834
+ } else if (options.retain === undefined) {
835
+ options.retain = true;
778
836
  }
837
+ await this.bridgeMqttClient.publish(publishTopic, val, options);
838
+ await this.adapter.setState('info.publishedIds', JSON.stringify(this.PublishedIds), true);
779
839
  }
780
840
 
781
- if (this.PublishedIds[id].cover) {
782
- if (this.PublishedIds[id].message) {
783
- if (this.PublishedIds[id].message[val]) {
784
- val = this.PublishedIds[id].message[val];
785
- } else {
786
- val = '';
841
+ /* alt 26.11.2025
842
+ if (this.PublishedIds[id].light) {
843
+ val = {};
844
+ val.state = (await this.adapter.getForeignStateAsync(this.PublishedIds[id].LightIds.onOff)).val;
845
+ val.state = val.state === true ? 'ON' : 'OFF';
846
+ if (this.PublishedIds[id].LightIds.brightness) {
847
+ val.brightness = (
848
+ await this.adapter.getForeignStateAsync(this.PublishedIds[id].LightIds.brightness)
849
+ ).val;
850
+ }
851
+ if (this.PublishedIds[id].LightIds.color) {
852
+ val.color_mode = 'rgb';
853
+ val.color = this.hexToRgb(
854
+ (await this.adapter.getForeignStateAsync(this.PublishedIds[id].LightIds.color)).val,
855
+ );
856
+ }
857
+ if (this.PublishedIds[id].LightIds.effects) {
858
+ const effect = (await this.adapter.getForeignStateAsync(this.PublishedIds[id].LightIds.effects))
859
+ .val;
860
+ val.effect = '';
861
+ if (this.PublishedIds[id].effects[effect]) {
862
+ val.effect = this.PublishedIds[id].effects[effect];
863
+ }
787
864
  }
788
865
  }
789
- }
790
866
 
791
- // safe old values (5 last values)
792
- if (this.PublishedIds[id].values) {
793
- if (!this.PublishedIds[id].oldValues) {
794
- this.PublishedIds[id].oldValues = [];
867
+ if (this.PublishedIds[id].cover) {
868
+ if (this.PublishedIds[id].message) {
869
+ if (this.PublishedIds[id].message[val]) {
870
+ val = this.PublishedIds[id].message[val];
871
+ } else {
872
+ val = '';
873
+ }
874
+ }
795
875
  }
796
- if (this.PublishedIds[id].oldValues.length >= this.MaxValueCount) {
797
- this.PublishedIds[id].oldValues.pop();
876
+
877
+ // safe old values (5 last values)
878
+ if (this.PublishedIds[id].values) {
879
+ if (!this.PublishedIds[id].oldValues) {
880
+ this.PublishedIds[id].oldValues = [];
881
+ }
882
+ if (this.PublishedIds[id].oldValues.length >= this.MaxValueCount) {
883
+ this.PublishedIds[id].oldValues.pop();
884
+ }
885
+ this.PublishedIds[id].oldValues.unshift(structuredClone(this.PublishedIds[id].values));
798
886
  }
799
- this.PublishedIds[id].oldValues.unshift(structuredClone(this.PublishedIds[id].values));
800
- }
801
- if (!this.PublishedIds[id].values) {
802
- this.PublishedIds[id].values = {};
803
- }
804
- this.PublishedIds[id].values.val = val;
805
- this.PublishedIds[id].values.ts = Date.now();
806
- this.PublishedIds[id].values.time = new Date(Date.now()).toLocaleString(
807
- this.Timeoutput.Argument,
808
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
809
- // @ts-expect-error
810
- this.Timeoutput.Format,
811
- );
812
- if (typeof val !== 'string') {
813
- val = JSON.stringify(val);
814
- }
815
- if (!options) {
816
- options = { retain: true };
817
- } else if (options.retain === undefined) {
818
- options.retain = true;
819
- }
820
- await this.bridgeMqttClient.publish(this.PublishedIds[id].state_topic, val, options);
821
- await this.adapter.setState('info.publishedIds', JSON.stringify(this.PublishedIds), true);
887
+ if (!this.PublishedIds[id].values) {
888
+ this.PublishedIds[id].values = {};
889
+ }
890
+ this.PublishedIds[id].values.val = val;
891
+ this.PublishedIds[id].values.ts = Date.now();
892
+ this.PublishedIds[id].values.time = new Date(Date.now()).toLocaleString(
893
+ this.Timeoutput.Argument,
894
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
895
+ // @ts-expect-error
896
+ this.Timeoutput.Format,
897
+ );
898
+ if (typeof val !== 'string') {
899
+ val = JSON.stringify(val);
900
+ }
901
+ if (!options) {
902
+ options = { retain: true };
903
+ } else if (options.retain === undefined) {
904
+ options.retain = true;
905
+ }
906
+ await this.bridgeMqttClient.publish(this.PublishedIds[id].state_topic, val, options);
907
+ await this.adapter.setState('info.publishedIds', JSON.stringify(this.PublishedIds), true);
908
+ */
822
909
  } else {
823
910
  this.adapter.log.debug(`Id ${id} is not set for publish.`);
824
911
  }
@@ -1004,12 +1091,13 @@ class bridgeClass {
1004
1091
  */
1005
1092
  assignIdStructure(assignObject, indexId, informations, topic, payload, state_topic, options) {
1006
1093
  if (!assignObject[indexId]) {
1007
- assignObject[indexId] = { discovery: [] };
1094
+ assignObject[indexId] = { discovery: [], publish: {} };
1008
1095
  }
1009
1096
  assignObject[indexId].discovery.push({
1010
1097
  topic: topic,
1011
1098
  payload: structuredClone(payload),
1012
1099
  });
1100
+ /* alt 26.11.2025
1013
1101
  assignObject[indexId].state_topic = state_topic;
1014
1102
  assignObject[indexId].informations = structuredClone(informations);
1015
1103
  if (options) {
@@ -1017,6 +1105,16 @@ class bridgeClass {
1017
1105
  assignObject[indexId][option] = options[option];
1018
1106
  }
1019
1107
  }
1108
+ */
1109
+ if (!assignObject[indexId].publish[state_topic]) {
1110
+ assignObject[indexId].publish[state_topic] = {};
1111
+ assignObject[indexId].publish[state_topic].informations = structuredClone(informations);
1112
+ if (options) {
1113
+ for (const option in options) {
1114
+ assignObject[indexId].publish[state_topic][option] = options[option];
1115
+ }
1116
+ }
1117
+ }
1020
1118
  }
1021
1119
 
1022
1120
  /*********************************************************************
@@ -2706,7 +2804,7 @@ class bridgeClass {
2706
2804
  },
2707
2805
  DiscoveryTopic,
2708
2806
  DiscoveryPayload,
2709
- `${config.CoverIds.openSignal}${this.EndingState}`,
2807
+ `${coverTopic}${this.EndingState}`,
2710
2808
  { cover: true, message: { [openKey]: 'open', [closingKey]: 'closing' } },
2711
2809
  );
2712
2810
  }
@@ -2723,7 +2821,7 @@ class bridgeClass {
2723
2821
  },
2724
2822
  DiscoveryTopic,
2725
2823
  DiscoveryPayload,
2726
- `${config.CoverIds.closedSignal}${this.EndingState}`,
2824
+ `${coverTopic}${this.EndingState}`,
2727
2825
  {
2728
2826
  cover: true,
2729
2827
  message: { [closedKey]: 'closed', [openingKey]: 'opening' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "1.18.17",
3
+ "version": "1.18.19",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",