@cryptotaxi247 / netdata-1 / commits / e343e69e9

New Sensors (Windows.plugin) (#21319)

thiagoftsm committed Nov 24, 2025 at 12:17 UTC e343e69e93350fdb66373702ced88857c2d8112f
3 files changed +72 -4
src/collectors/all.h
+5
@@ -467,7 +467,12 @@
467 #define NETDATA_CHART_PRIO_SENSOR_FORCE 70017
468 #define NETDATA_CHART_PRIO_SENSOR_GAUGE_PRESSURE 70018
469 #define NETDATA_CHART_PRIO_SENSOR_DISTANCE 70019
470 +#define NETDATA_CHART_PRIO_SENSOR_HUMAN 70020
471 +#define NETDATA_CHART_PRIO_SENSOR_PROXIMITY 70021
472 #define NETDATA_CHART_PRIO_SENSOR_ACCELERATION 70022
473 +#define NETDATA_CHART_PRIO_SENSOR_CAPACITANCE 70023
474 +#define NETDATA_CHART_PRIO_SENSOR_INDUCTANCE 70024
475 +
476 #define NETDATA_CHART_PRIO_SENSOR_MIN_CUSTOM 70100 // Windows only
477 #define NETDATA_CHART_PRIO_SENSOR_MAX_CUSTOM 70128 // Windows only
478
src/collectors/windows.plugin/GetSensors.c
+42 -3
@@ -26,11 +26,15 @@ enum netdata_win_sensor_monitored {
26 NETDATA_WIN_SENSOR_DATA_TYPE_LIGHT_TEMPERATURE,
27 NETDATA_WIN_SENSOR_VOLTAGE,
28 NETDATA_WIN_SENSOR_RESISTENCE,
29 + NETDATA_WIN_SENSOR_CAPACITANCE_FARAD,
30 + NETDATA_WIN_SENSOR_INDUCTANCE_HENRY,
31 NETDATA_WIN_SENSOR_ATMOSPHERE_PRESSURE,
32 NETDATA_WIN_SENSOR_LATITUDE_DEGREES,
33 NETDATA_WIN_SENSOR_LONGITUDE_DEGREES,
34 NETDATA_WIN_SENSOR_FORCE_NEWTONS,
35 NETDATA_WIN_SENSOR_GAUGE_PRESSURE,
36 + NETDATA_WIN_SENSOR_HUMAN_PRESENCE,
37 + NETDATA_WIN_SENSOR_HUMAN_PROXIMITY_METERS,
38
39 // Add only one vector axis here
40 NETDATA_WIN_SENSOR_TYPE_DISTANCE_X,
@@ -87,11 +91,15 @@ REFPROPERTYKEY sensor_keys[] = {
91 &SENSOR_DATA_TYPE_LIGHT_TEMPERATURE_KELVIN,
92 &SENSOR_DATA_TYPE_VOLTAGE_VOLTS,
93 &SENSOR_DATA_TYPE_RESISTANCE_OHMS,
94 + &SENSOR_DATA_TYPE_CAPACITANCE_FARAD,
95 + &SENSOR_DATA_TYPE_INDUCTANCE_HENRY,
96 &SENSOR_DATA_TYPE_ATMOSPHERIC_PRESSURE_BAR,
97 &SENSOR_DATA_TYPE_LATITUDE_DEGREES,
98 &SENSOR_DATA_TYPE_LONGITUDE_DEGREES,
99 &SENSOR_DATA_TYPE_FORCE_NEWTONS,
100 &SENSOR_DATA_TYPE_GAUGE_PRESSURE_PASCAL,
101 + &SENSOR_DATA_TYPE_HUMAN_PRESENCE,
102 + &SENSOR_DATA_TYPE_HUMAN_PROXIMITY_METERS,
103
104 // Add only one vector axis here
105 &SENSOR_DATA_TYPE_DISTANCE_X_METERS,
@@ -190,19 +198,33 @@ static struct win_sensor_config {
198 .priority = NETDATA_CHART_PRIO_SENSOR_TEMPERATURE,
199 },
200 {
193 - .title = "Electrical potential.",
201 + .title = "Electrical potential",
202 .units = "V",
203 .context = "system.hw.sensor.voltage.input",
204 .family = "Potential",
205 .priority = NETDATA_CHART_PRIO_SENSOR_VOLTAGE,
206 },
207 {
200 - .title = "Electrical resistence.",
208 + .title = "Electrical resistence",
209 .units = "Ohms",
210 .context = "system.hw.sensor.resistence.input",
211 .family = "Resistence",
212 .priority = NETDATA_CHART_PRIO_SENSOR_RESISTENCE,
213 },
214 + {
215 + .title = "Electrical capacitance",
216 + .units = "F",
217 + .context = "system.hw.sensor.capacitance.input",
218 + .family = "Capacitance",
219 + .priority = NETDATA_CHART_PRIO_SENSOR_CAPACITANCE,
220 + },
221 + {
222 + .title = "Electrical inductance",
223 + .units = "H",
224 + .context = "system.hw.sensor.inductance.input",
225 + .family = "Inductance",
226 + .priority = NETDATA_CHART_PRIO_SENSOR_INDUCTANCE,
227 + },
228 {
229 .title = "Ambient atmospheric pressure",
230 .units = "Pa",
@@ -238,6 +260,20 @@ static struct win_sensor_config {
260 .family = "Pressure",
261 .priority = NETDATA_CHART_PRIO_SENSOR_GAUGE_PRESSURE,
262 },
263 + {
264 + .title = "Human presence",
265 + .units = "presence",
266 + .context = "system.hw.sensor.human_presence.input",
267 + .family = "Presence",
268 + .priority = NETDATA_CHART_PRIO_SENSOR_HUMAN,
269 + },
270 + {
271 + .title = "Human proximity",
272 + .units = "m",
273 + .context = "system.hw.sensor.human_proximity.input",
274 + .family = "Proximity",
275 + .priority = NETDATA_CHART_PRIO_SENSOR_PROXIMITY,
276 + },
277 {
278 .title = "Distance",
279 .units = "m",
@@ -383,7 +419,7 @@ static int netdata_collect_sensor_data(collected_number *value, ISensor *pSensor
419 if (SUCCEEDED(hr) && pReport) {
420 PropVariantInit(&pv);
421 hr = pReport->lpVtbl->GetSensorValue(pReport, key, &pv);
386 - if (SUCCEEDED(hr) && (pv.vt == VT_R4 || pv.vt == VT_R8 || pv.vt == VT_UI4)) {
422 + if (SUCCEEDED(hr) && (pv.vt == VT_R4 || pv.vt == VT_R8 || pv.vt == VT_UI4 || pv.vt == VT_BOOL)) {
423 switch (pv.vt) {
424 case VT_UI4:
425 *value = (collected_number)(pv.ulVal * 100);
@@ -394,6 +430,9 @@ static int netdata_collect_sensor_data(collected_number *value, ISensor *pSensor
430 case VT_R8:
431 *value = (collected_number)(pv.dblVal * div_factor);
432 break;
433 + case VT_BOOL:
434 + *value = (pv.boolVal == VARIANT_TRUE) ? 100 : 0;
435 + break;
436 }
437 defined = 1;
438 }
src/collectors/windows.plugin/metadata.yaml
+25 -1
@@ -1294,11 +1294,23 @@ modules:
1294 dimensions:
1295 - name: input
1296 - name: system.hw.sensor.resistence.input
1297 - description: Electrical resistence.
1297 + description: Electrical resistence
1298 unit: "Ohms"
1299 chart_type: line
1300 dimensions:
1301 - name: input
1302 + - name: system.hw.sensor.capacitance.input
1303 + description: Electrical capacitance
1304 + unit: "F"
1305 + chart_type: line
1306 + dimensions:
1307 + - name: input
1308 + - name: system.hw.sensor.inductance.input
1309 + description: Electrical indutance
1310 + unit: "H"
1311 + chart_type: line
1312 + dimensions:
1313 + - name: input
1314 - name: system.hw.sensor.pressure.input
1315 description: Ambient atmospheric pressure
1316 unit: "Pa"
@@ -1329,6 +1341,18 @@ modules:
1341 chart_type: line
1342 dimensions:
1343 - name: input
1344 + - name: system.hw.sensor.human_presence.input
1345 + description: Human presence
1346 + unit: "presence"
1347 + chart_type: line
1348 + dimensions:
1349 + - name: input
1350 + - name: system.hw.sensor.human_proximity.input
1351 + description: Human proximity
1352 + unit: "m"
1353 + chart_type: line
1354 + dimensions:
1355 + - name: input
1356 - name: system.hw.sensor.distance.input
1357 description: Distance
1358 unit: "m"