iobroker.lorawan 1.18.18 → 1.18.20
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 +6 -0
- package/io-package.json +27 -27
- package/lib/modules/bridge.js +158 -55
- package/package.json +1 -1
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.20 (2025-11-26)
|
|
27
|
+
* (BenAhrdt) Dont write discovery multiple in internal object (in case of reconnect bridge)
|
|
28
|
+
|
|
29
|
+
### 1.18.19 (2025-11-26)
|
|
30
|
+
* (BenAhrdt) possibility to publish one id in spezial and normal entity
|
|
31
|
+
|
|
26
32
|
### 1.18.18 (2025-11-25)
|
|
27
33
|
* (BenAhrdt) Bugfix limit sitch topic to state_topic
|
|
28
34
|
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "lorawan",
|
|
4
|
-
"version": "1.18.
|
|
4
|
+
"version": "1.18.20",
|
|
5
5
|
"news": {
|
|
6
|
+
"1.18.20": {
|
|
7
|
+
"en": "Dont write discovery multiple in internal object (in case of reconnect bridge)",
|
|
8
|
+
"de": "Schreibe nicht mehrere Entdeckungen im internen Objekt (im Falle der Wiederverbindungsbrücke)",
|
|
9
|
+
"ru": "Не записывайте открытие множественного числа во внутренний объект (в случае повторного подключения моста)",
|
|
10
|
+
"pt": "Não escreva múltiplas descobertas em objeto interno (no caso de reconectar ponte)",
|
|
11
|
+
"nl": "Niet schrijven ontdekking meerdere in interne object (in het geval van reconnect brug)",
|
|
12
|
+
"fr": "Ne pas écrire la découverte multiple dans l'objet interne (en cas de reconnect pont)",
|
|
13
|
+
"it": "Non scrivere la scoperta multipla in oggetto interno (in caso di riconnettere il ponte)",
|
|
14
|
+
"es": "No escriba descubrimiento múltiple en objeto interno (en caso de puente de reconexión)",
|
|
15
|
+
"pl": "Nie pisz wielokrotnego odkrycia w obiekcie wewnętrznym (w przypadku ponownego podłączenia mostu)",
|
|
16
|
+
"uk": "Не писати відкриття декількох в внутрішньому об'єкті (у разі відключення мосту)",
|
|
17
|
+
"zh-cn": "不要在内部对象中写入多个发现( 如果是重联桥)"
|
|
18
|
+
},
|
|
19
|
+
"1.18.19": {
|
|
20
|
+
"en": "possibility to publish one id in spezial and normal entity",
|
|
21
|
+
"de": "möglichkeit, eine id in spezial und normal zu veröffentlichen",
|
|
22
|
+
"ru": "возможность публикации одного идентификатора в пространственной и нормальной сущности",
|
|
23
|
+
"pt": "possibilidade de publicar um id em entidade específica e normal",
|
|
24
|
+
"nl": "mogelijkheid om één id te publiceren in een specifieke en normale entiteit",
|
|
25
|
+
"fr": "possibilité de publier un id en entité spezial et normale",
|
|
26
|
+
"it": "possibilità di pubblicare un id in entità spezial e normale",
|
|
27
|
+
"es": "posibilidad de publicar una id en entidad espacial y normal",
|
|
28
|
+
"pl": "możliwość opublikowania jednego identyfikatora w jednostce spezialnej i normalnej",
|
|
29
|
+
"uk": "можливість опублікувати одну ідентифікацію в спорідненому і нормальному суб’єкті",
|
|
30
|
+
"zh-cn": "在普通实体中公布一个标识的可能性"
|
|
31
|
+
},
|
|
6
32
|
"1.18.18": {
|
|
7
33
|
"en": "Bugfix limit sitch topic to state_topic",
|
|
8
34
|
"de": "Bugfix limit sitch Thema zu state_topic",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
93
|
"pl": "dodaj pokrycie do specjalnych urządzeń",
|
|
68
94
|
"uk": "додати чохол на спеціальні пристрої",
|
|
69
95
|
"zh-cn": "将封面添加到特殊设备"
|
|
70
|
-
},
|
|
71
|
-
"1.18.13": {
|
|
72
|
-
"en": "Bugfix: wrong subscribtion of fx ids",
|
|
73
|
-
"de": "Bugfix: falsche Anmeldung von fx ids",
|
|
74
|
-
"ru": "Bugfix: неправильная подписка на fx ids",
|
|
75
|
-
"pt": "Correção de Bugfix: subscrita errada de fx ids",
|
|
76
|
-
"nl": "Bugfix: verkeerde subscriptie van fx ids",
|
|
77
|
-
"fr": "Bugfix : mauvaise subscribtion des ids fx",
|
|
78
|
-
"it": "Bugfix: sottoscrizione sbagliata di fx ids",
|
|
79
|
-
"es": "Bugfix: la subscripción incorrecta de los ids de fx",
|
|
80
|
-
"pl": "Bugfix: błędna subskrypcja fix ids",
|
|
81
|
-
"uk": "Помилки: неправильне підсобнення попелиці",
|
|
82
|
-
"zh-cn": "错误fix: fx ID 的子缩写错误"
|
|
83
|
-
},
|
|
84
|
-
"1.18.12": {
|
|
85
|
-
"en": "Bugfix fx in case of number",
|
|
86
|
-
"de": "Bugfix fx bei Anzahl",
|
|
87
|
-
"ru": "Bugfix fx в случае номера",
|
|
88
|
-
"pt": "Bugfix fx em caso de número",
|
|
89
|
-
"nl": "Bugfix fx bij aantal",
|
|
90
|
-
"fr": "Bugfix fx en cas de nombre",
|
|
91
|
-
"it": "Bugfix fx in caso di numero",
|
|
92
|
-
"es": "Fx Bugfix en caso de número",
|
|
93
|
-
"pl": "Bugfix fx w przypadku liczby",
|
|
94
|
-
"uk": "Виправлення помилок при кількості",
|
|
95
|
-
"zh-cn": "如果出现数字, 错误fx"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
package/lib/modules/bridge.js
CHANGED
|
@@ -753,72 +753,159 @@ class bridgeClass {
|
|
|
753
753
|
}
|
|
754
754
|
}
|
|
755
755
|
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
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
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
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
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
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
|
-
|
|
782
|
-
if (this.PublishedIds[id].
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
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
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
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
|
-
|
|
797
|
-
|
|
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
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
this.PublishedIds[id].values =
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
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
|
/*********************************************************************
|
|
@@ -1567,6 +1665,11 @@ class bridgeClass {
|
|
|
1567
1665
|
// get old Discovered ids
|
|
1568
1666
|
this.OldDiscoveredIds = JSON.parse((await this.adapter.getStateAsync('info.discoveredIds')).val);
|
|
1569
1667
|
this.oldDiscoveredDevices = this.generateOldDevices(this.OldDiscoveredIds);
|
|
1668
|
+
// Clear object of all subscribed Ids and published Topics
|
|
1669
|
+
this.SubscribedTopics = {};
|
|
1670
|
+
this.PublishedIds = {};
|
|
1671
|
+
this.Notifications = {};
|
|
1672
|
+
|
|
1570
1673
|
//this.adapter.log.error(JSON.stringify(this.oldDiscoveredDevices));
|
|
1571
1674
|
await this.discoverGeneralNotification();
|
|
1572
1675
|
|