iobroker.lorawan 1.22.31 → 1.22.32

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
@@ -19,11 +19,18 @@ The documentation Wiki is here: https://github.com/BenAhrdt/ioBroker.lorawan/wik
19
19
  <br/>
20
20
  For now there is documentation in English here: https://wiki.hafenmeister.de
21
21
 
22
+ ### Home Assistant sensor discovery
23
+
24
+ For numeric sensor entities, the bridge assigns Home Assistant `device_class` and `state_class` attributes according to the adapter's counter-first convention. Current measurements use `measurement`. Energy values in `Wh`, `kWh`, or `MWh`, as well as values identified by an ioBroker energy or consumption role, are treated as consumption counters and use `total_increasing` for Home Assistant energy statistics. If a quantity cannot be distinguished reliably from a consumption reading, the bridge prefers counter semantics: `m³` and `ft³` are published as `gas` with `total_increasing`, and `L` as `water` with `total_increasing`. `mL` and `gal` remain generic `volume` values. Ambiguous concentration units such as `ppm`, `ppb`, or `µg/m³` do not imply a specific substance. `L/min`, `L/s`, and `m³/h` use `volume_flow_rate`.
25
+
22
26
  ## Changelog
23
27
  <!--
24
28
  Placeholder for the next version (at the beginning of the line):
25
29
  ### **WORK IN PROGRESS**
26
30
  -->
31
+ ### 1.22.32 (2026-08-19)
32
+ - (BenAhrdt) Align Home Assistant sensor device classes, state classes, and units with the current specification
33
+
27
34
  ### 1.22.31 (2026-07-09)
28
35
  - (BenAhrdt) Add selection of ToIob source id
29
36
 
@@ -37,12 +44,18 @@ For now there is documentation in English here: https://wiki.hafenmeister.de
37
44
  ### 1.22.28 (2026-07-05)
38
45
  - (BenAhrdt) Add DewPointTemperature to assignhandler
39
46
 
40
- ### 1.22.27 (2026-07-04)
41
- - (BenAhrdt) Bugfix warning for wrong id
42
- - (BenAhrdt) Add Profile to downloadconfig
43
-
44
47
  [Older changes can be found there](CHANGELOG_OLD.md)
45
48
 
49
+ ## DISCLAIMER
50
+ The rights of the trademarks and company names, remain with their owners and have no relation to this adapter. The fairuse policy must continue to be adhered to by the operator of the adapter. If this repository is forked, it must be cited as the source.
51
+
52
+ LoRa® is a registered trademark or service mark of Semtech Corporation or its affilantes.
53
+
54
+ LoRaWAN® is a licensed mark.
55
+
56
+ I have no affiliation with the mentioned brands or their subsidiaries, logos, or trademarks, nor am I endorsed by them.
57
+
58
+
46
59
  ## License
47
60
  MIT License
48
61
 
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.22.31",
4
+ "version": "1.22.32",
5
5
  "news": {
6
+ "1.22.32": {
7
+ "en": "Align Home Assistant sensor device classes, state classes, and units with the current specification",
8
+ "de": "Richten Sie die Sensorgeräteklassen, Statusklassen und Einheiten von Home Assistant an die aktuelle Spezifikation aus.",
9
+ "ru": "Приведите классы сенсорных устройств Home Assistant, классы состояний и единицы измерения в соответствие с текущими спецификациями.",
10
+ "pt": "Alinhe as classes de dispositivos de sensores, classes de estado e unidades do Home Assistant com a especificação atual.",
11
+ "nl": "Stem de apparaatklassen, statusklassen en eenheden van de Home Assistant-sensoren af op de huidige specificaties.",
12
+ "fr": "Alignez les classes de périphériques de capteurs, les classes d'état et les unités de Home Assistant avec les spécifications actuelles.",
13
+ "it": "Allineare le classi dei dispositivi sensore di Home Assistant, le classi di stato e le unità con le specifiche attuali",
14
+ "es": "Alinee las clases de dispositivos de sensores, las clases de estado y las unidades de Home Assistant con la especificación actual.",
15
+ "pl": "Dostosuj klasy urządzeń czujników Home Assistant, klasy stanów i jednostki do bieżącej specyfikacji",
16
+ "uk": "Узгодьте класи сенсорних пристроїв, класи станів та одиниці Home Assistant із поточною специфікацією",
17
+ "zh-cn": "将 Home Assistant 传感器设备类、状态类和单位与当前规范保持一致。"
18
+ },
6
19
  "1.22.31": {
7
20
  "en": "Add selection of ToIob source id",
8
21
  "de": "Auswahl der ToIob-Quell-ID hinzufügen",
@@ -80,19 +93,6 @@
80
93
  "pl": "Dodaj stacje do encji blokady dla urządzeń ToIob",
81
94
  "uk": "Додати станції до сутності блокування для пристроїв ToIob",
82
95
  "zh-cn": "将状态添加到锁定实体中,用于 ToIob 设备"
83
- },
84
- "1.22.25": {
85
- "en": "Change Assignhandler for case intensive Check\nAdd subAssign for a part of name",
86
- "de": "Ändern Sie den Zuweisungshandler für die fallintensive Prüfung.\nFüge Unterzuweisung für einen Teil des Namens hinzu",
87
- "ru": "Изменить обработчик назначений для проверки с интенсивным использованием регистров.\nДобавить подназначение для части имени",
88
- "pt": "Alterar o Assignhandler para verificação que exige alta sensibilidade a maiúsculas e minúsculas.\nAdicionar subatribuição para uma parte do nome",
89
- "nl": "Wijzig de Assignhandler voor case-intensieve controles.\nVoeg een subtoewijzing toe voor een deel van de naam.",
90
- "fr": "Modifier le gestionnaire d'affectation pour la vérification intensive des cas\nAjouter une sous-affectation pour une partie du nom",
91
- "it": "Cambia Assegnatore gestore per controllo intensivo dei casi\nAggiungi subAssegna per una parte del nome",
92
- "es": "Modificar Assignhandler para comprobación intensiva de casos\nAgregar subAsignación para una parte del nombre",
93
- "pl": "Zmień Assignhandler na kontrolę intensywnie wykorzystującą przypadek\nDodaj podprzypisanie dla części nazwy",
94
- "uk": "Змінити обробник присвоєння для перевірки з інтенсивним виконанням регістрів\nДодати subAssign для частини імені",
95
- "zh-cn": "更改案例密集型检查的分配处理程序\n为名称的一部分添加子分配"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -115,20 +115,25 @@ class bridgeClass extends EventEmiter {
115
115
  var: { device_class: 'reactive_power' },
116
116
  kvar: { device_class: 'reactive_power' },
117
117
 
118
+ // Energy values bridged by this adapter represent consumption
119
+ // counters and need TOTAL_INCREASING for Home Assistant's energy
120
+ // statistics and Energy Dashboard.
118
121
  Wh: { device_class: 'energy', state_class: 'total_increasing' },
119
122
  kWh: { device_class: 'energy', state_class: 'total_increasing' },
120
123
  MWh: { device_class: 'energy', state_class: 'total_increasing' },
121
124
 
125
+ // For ambiguous consumption units, this adapter deliberately
126
+ // prefers counter semantics so Home Assistant can evaluate them.
122
127
  'm³': { device_class: 'gas', state_class: 'total_increasing' },
123
128
  'ft³': { device_class: 'gas', state_class: 'total_increasing' },
124
129
 
125
- l: { device_class: 'water', state_class: 'total_increasing' },
126
- ml: { device_class: 'volume' },
130
+ L: { device_class: 'water', state_class: 'total_increasing' },
131
+ mL: { device_class: 'volume' },
127
132
  gal: { device_class: 'volume' },
128
133
 
129
- 'L/min': { device_class: 'volumetric_flow_rate' },
130
- 'L/s': { device_class: 'volumetric_flow_rate' },
131
- 'm³/h': { device_class: 'volumetric_flow_rate' },
134
+ 'L/min': { device_class: 'volume_flow_rate' },
135
+ 'L/s': { device_class: 'volume_flow_rate' },
136
+ 'm³/h': { device_class: 'volume_flow_rate' },
132
137
 
133
138
  Pa: { device_class: 'pressure' },
134
139
  hPa: { device_class: 'pressure' },
@@ -137,9 +142,11 @@ class bridgeClass extends EventEmiter {
137
142
  bar: { device_class: 'pressure' },
138
143
  psi: { device_class: 'pressure' },
139
144
 
140
- ppm: { device_class: 'carbon_dioxide' },
141
- ppb: { device_class: 'volatile_organic_compounds_parts' },
142
- 'µg/m³': { device_class: 'volatile_organic_compounds' },
145
+ // Concentration units are shared by CO2, CO, VOC and several
146
+ // other device classes, so a device class cannot be inferred.
147
+ ppm: {},
148
+ ppb: {},
149
+ 'µg/m³': {},
143
150
 
144
151
  'W/m²': { device_class: 'irradiance' },
145
152
  mm: { device_class: 'precipitation' },
@@ -1667,6 +1674,9 @@ class bridgeClass extends EventEmiter {
1667
1674
  (role.includes('power.consumption') && normalizedUnitLower.includes('wh'))
1668
1675
  ) {
1669
1676
  attributes.device_class = 'energy';
1677
+ // Energy and consumption roles represent monotonically
1678
+ // increasing counters used by Home Assistant's energy
1679
+ // statistics and Energy Dashboard.
1670
1680
  attributes.state_class = 'total_increasing';
1671
1681
  attributes.unit_of_measurement = normalizedUnit || 'Wh';
1672
1682
  } else if (role.includes('weight')) {
@@ -1683,7 +1693,9 @@ class bridgeClass extends EventEmiter {
1683
1693
  attributes.unit_of_measurement = normalizedUnit;
1684
1694
 
1685
1695
  if (this.unitMap[normalizedUnit]) {
1686
- attributes.device_class = this.unitMap[normalizedUnit].device_class;
1696
+ if (this.unitMap[normalizedUnit].device_class) {
1697
+ attributes.device_class = this.unitMap[normalizedUnit].device_class;
1698
+ }
1687
1699
 
1688
1700
  // Falls es in unitMap einen gültigen Eintrag gibt UND noch keine state_class gesetzt wurde
1689
1701
  if (!attributes.state_class && this.unitMap[normalizedUnit].state_class) {
@@ -1706,11 +1718,29 @@ class bridgeClass extends EventEmiter {
1706
1718
  attributes.max = common.max;
1707
1719
  }
1708
1720
 
1709
- // Es muss eine Device Class zugewiesen sein und der State darf kein String sein.
1710
- // String ist kein Measurement
1711
- if (!attributes.state_class && type !== 'string') {
1721
+ // state_class is a sensor-only property. Home Assistant does
1722
+ // not allow MEASUREMENT for classes representing totals.
1723
+ const classesWithoutMeasurement = new Set([
1724
+ 'date',
1725
+ 'energy',
1726
+ 'enum',
1727
+ 'gas',
1728
+ 'monetary',
1729
+ 'timestamp',
1730
+ 'volume',
1731
+ 'water',
1732
+ ]);
1733
+ if (
1734
+ entityType === 'sensor' &&
1735
+ !attributes.state_class &&
1736
+ type !== 'string' &&
1737
+ !classesWithoutMeasurement.has(attributes.device_class)
1738
+ ) {
1712
1739
  attributes.state_class = 'measurement';
1713
1740
  }
1741
+ if (entityType !== 'sensor') {
1742
+ delete attributes.state_class;
1743
+ }
1714
1744
  }
1715
1745
 
1716
1746
  if (entityType === 'valve') {
@@ -1800,8 +1830,8 @@ class bridgeClass extends EventEmiter {
1800
1830
  .replace(/^mcg\/m3$/i, 'µg/m³')
1801
1831
  .replace(/^um\/m3$/i, 'µg/m³')
1802
1832
 
1803
- .replace(/^L\/min$/i, 'l/min')
1804
- .replace(/^L\/s$/i, 'l/s')
1833
+ .replace(/^L\/min$/i, 'L/min')
1834
+ .replace(/^L\/s$/i, 'L/s')
1805
1835
 
1806
1836
  .replace(/^m\^?3\/h$/i, 'm³/h')
1807
1837
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "1.22.31",
3
+ "version": "1.22.32",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",
@@ -26,10 +26,10 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@iobroker/adapter-core": "^3.4.1",
29
- "@iobroker/dm-utils": "^3.0.19",
29
+ "@iobroker/dm-utils": "^3.1.4",
30
30
  "easy-crc": "^1.1.0",
31
31
  "lodash": "^4.18.1",
32
- "mqtt": "^5.15.1",
32
+ "mqtt": "^5.15.2",
33
33
  "node-schedule": "^2.1.1"
34
34
  },
35
35
  "devDependencies": {
@@ -39,10 +39,10 @@
39
39
  "@alcalzone/release-script-plugin-manual-review": "^5.2.0",
40
40
  "@iobroker/adapter-dev": "^1.5.0",
41
41
  "@iobroker/eslint-config": "^2.2.0",
42
- "@iobroker/testing": "^5.2.2",
42
+ "@iobroker/testing": "^5.3.0",
43
43
  "@tsconfig/node22": "^22.0.5",
44
44
  "@types/lodash": "^4.17.24",
45
- "@types/node": "^22.19.19",
45
+ "@types/node": "^22.20.1",
46
46
  "typescript": "~5.9.3"
47
47
  },
48
48
  "main": "main.js",