Skip to content

Commit f9e2c3e

Browse files
authored
Merge branch 'master' into patch-1
2 parents 8be61e3 + 0db84da commit f9e2c3e

File tree

9 files changed

+306
-108
lines changed

9 files changed

+306
-108
lines changed

.github/workflows/registry.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ jobs:
2424
uses: actions/checkout@v4
2525

2626
- name: 🔑 Log in to the Container registry
27-
uses: docker/#-action@v3.0.0
27+
uses: docker/#-action@v3.3.0
2828
with:
2929
registry: ${{ env.REGISTRY }}
3030
username: ${{ github.actor }}
3131
password: ${{ secrets.GHCR_TOKEN }}
3232

3333
- name: 📋 Extract metadata (tags, labels) for Docker
3434
id: meta
35-
uses: docker/metadata-action@v5.0.0
35+
uses: docker/metadata-action@v5.5.1
3636
with:
3737
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
3838
flavor: |
@@ -41,7 +41,7 @@ jobs:
4141
suffix=
4242
4343
- name: 🐳 Build and push Docker image
44-
uses: docker/build-push-action@v5.0.0
44+
uses: docker/build-push-action@v5.1.0
4545
with:
4646
context: .
4747
push: true

.github/workflows/test.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v4
1717

1818
- name: ⬣ Install Node.js
19-
uses: actions/setup-node@v4.0.0
19+
uses: actions/setup-node@v4.0.3
2020
with:
2121
node-version: 18
2222

@@ -26,7 +26,7 @@ jobs:
2626
echo "##[set-output name=dir;]$(yarn cache dir)"
2727
2828
- name: 🔧 Restore yarn cache
29-
uses: actions/cache@v3.3.2
29+
uses: actions/cache@v4.0.2
3030
id: yarn-cache
3131
with:
3232
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}

.scripts/run-tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ only_models_tests=${only_models_tests:-}
2222
git_branch=$(git rev-parse --abbrev-ref HEAD)
2323

2424
function runComposeCommand() {
25-
docker-compose -p osemapitest -f ./tests/docker-compose.yml "$@"
25+
docker compose -p osemapitest -f ./tests/docker-compose.yml "$@"
2626
}
2727

2828
function cleanup() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
module.exports = {
4+
title: 'Schalldruckpegel',
5+
unit: 'db (A)',
6+
sensorType: 'DNMS',
7+
icon: 'osem-volume-up',
8+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
module.exports = {
4+
title: 'Schalldruckpegel (Max)',
5+
unit: 'db (A)',
6+
sensorType: 'DNMS',
7+
icon: 'osem-volume-up',
8+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
module.exports = {
4+
title: 'Schalldruckpegel (Min)',
5+
unit: 'db (A)',
6+
sensorType: 'DNMS',
7+
icon: 'osem-volume-up',
8+
};

packages/models/src/box/sensorLayouts/sensorDefinitions/index.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22

3-
43
const veml6070_uvintensity = require('./veml6070_uvintensity'),
54
tsl45315_lightintensity = require('./tsl45315_lightintensity'),
65
bmp280_pressure = require('./bmp280_pressure'),
@@ -49,7 +48,10 @@ const veml6070_uvintensity = require('./veml6070_uvintensity'),
4948
sps30_pm4 = require('./sps30_pm4'),
5049
sps30_pm10 = require('./sps30_pm10'),
5150
sht3x_temperature = require('./sht3x_temperature'),
52-
sht3x_humidity = require('./sht3x_humidity');
51+
sht3x_humidity = require('./sht3x_humidity'),
52+
dnms_la_eq = require('./dnms_la_eq'),
53+
dnms_la_min = require('./dnms_la_min'),
54+
dnms_la_max = require('./dnms_la_max');
5355
module.exports = {
5456
hdc1008_temperature,
5557
hdc1080_temperature,
@@ -99,5 +101,8 @@ module.exports = {
99101
sps30_pm4,
100102
sps30_pm10,
101103
sht3x_temperature,
102-
sht3x_humidity
104+
sht3x_humidity,
105+
dnms_la_eq,
106+
dnms_la_min,
107+
dnms_la_max,
103108
};

packages/models/src/measurement/decoding/luftdatenHandler.js

+22-10
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,24 @@ const matchings = {
8282
humidity: ['rel. luftfeuchte', 'luftfeuchtigkeit', 'luftfeuchte'],
8383
pressure: ['luftdruck', 'druck'],
8484
signal: ['stärke', 'signal'],
85+
noise_laeq: ['schallpegel', 'geräuschpegel'],
8586
};
8687

8788
const findSensorId = function findSensorId (sensors, value_type) {
8889
// temperature, humidity and pressure values
8990
// are named either directly or with a prefix
9091
// separated by underscores. The last element
9192
// should be the the desired phenomenon
92-
let [vt_sensortype, vt_phenomenon] = value_type
93-
.toLowerCase()
94-
.split('_');
93+
let [vt_sensortype, vt_phenomenon] = [];
94+
const splitAtIndex = value_type.toLowerCase().indexOf('_');
95+
if (splitAtIndex > 0) {
96+
[vt_sensortype, vt_phenomenon] = [
97+
value_type.toLowerCase().slice(0, splitAtIndex),
98+
value_type.toLowerCase().slice(splitAtIndex + 1),
99+
];
100+
} else {
101+
[vt_sensortype, vt_phenomenon] = value_type.toLowerCase().split('_');
102+
}
95103

96104
// DHT11 and DHT22 sensors have no underscore prefix
97105
if (!vt_phenomenon && ['temperature', 'humidity'].includes(vt_sensortype)) {
@@ -110,9 +118,10 @@ const findSensorId = function findSensorId (sensors, value_type) {
110118
const title = sensor.title.toLowerCase();
111119
const type = sensor.sensorType.toLowerCase();
112120
if (
113-
(title === vt_phenomenon || matchings[vt_phenomenon].includes(title) || matchings[vt_phenomenon].some(alias => title.includes(alias)))
114-
&&
115-
(type.startsWith(vt_sensortype))
121+
(title === vt_phenomenon ||
122+
matchings[vt_phenomenon].includes(title) ||
123+
matchings[vt_phenomenon].some((alias) => title.includes(alias))) &&
124+
type.startsWith(vt_sensortype)
116125
) {
117126
sensorId = sensor._id.toString();
118127
break;
@@ -137,7 +146,6 @@ const transformLuftdatenJson = function transformLuftdatenJson (json, sensors) {
137146
return outArray;
138147
};
139148

140-
141149
module.exports = {
142150
decodeMessage: function (message, { sensors } = {}) {
143151
if (!sensors) {
@@ -159,7 +167,9 @@ module.exports = {
159167
}
160168

161169
if (!json.sensordatavalues) {
162-
return Promise.reject(new Error('Invalid luftdaten json. Missing `sensordatavalues`'));
170+
return Promise.reject(
171+
new Error('Invalid luftdaten json. Missing `sensordatavalues`')
172+
);
163173
}
164174

165175
const transformedMeasurements = transformLuftdatenJson(json, sensors);
@@ -170,6 +180,8 @@ module.exports = {
170180
return transformAndValidateMeasurements(transformedMeasurements);
171181
}
172182

173-
return Promise.reject(new Error('Cannot decode empty message (luftdaten decoder)'));
174-
}
183+
return Promise.reject(
184+
new Error('Cannot decode empty message (luftdaten decoder)')
185+
);
186+
},
175187
};

0 commit comments

Comments
 (0)