iobroker.lorawan 1.18.18 → 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 +3 -0
- package/io-package.json +14 -14
- package/lib/modules/bridge.js +153 -55
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,6 +23,9 @@ 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
|
+
|
|
26
29
|
### 1.18.18 (2025-11-25)
|
|
27
30
|
* (BenAhrdt) Bugfix limit sitch topic to state_topic
|
|
28
31
|
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "lorawan",
|
|
4
|
-
"version": "1.18.
|
|
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
|
+
},
|
|
6
19
|
"1.18.18": {
|
|
7
20
|
"en": "Bugfix limit sitch topic to state_topic",
|
|
8
21
|
"de": "Bugfix limit sitch Thema zu state_topic",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "Bugfix: błędna subskrypcja fix ids",
|
|
81
94
|
"uk": "Помилки: неправильне підсобнення попелиці",
|
|
82
95
|
"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
|
/*********************************************************************
|