Der Adapter speichert für jedes aktive Objekt die Werte temporär in statistics.x.temp für die fortlaufende Bewertung.
Zu vorgegebenen Zeiten (Tag, Woche, Monat, Quartal, Jahr) erfolgt die Übernahme der temporären Werte in die Struktur statistics.x.save.
Je nach Datentyp des Datenpunktes (boolean oder number) werden unterschiedliche Optionen angeboten.
Für bestimmte Werte werden auch 5min Zwischenwerte ermittelt, wie es z.B. bei den 433MHz Steckdosen von ELV der Fall ist, die einen Verbrauchswert alle 5min übermitteln.
Der Adapter reagiert nur auf bestätigte Werte (state.ack = true), nicht auf Befehle (steuere)!
Boolean Zustände

Zählen
Speichert Werte in statistics.x.temp.count.* bzw. statistics.x.save.count.*.
Bei einer steigenden Flanke wird der Zählerwert um 1 erhöht. Es muss ein Flankenwechesel von 0 zu 1 vorliegen, damit gezählt wird:

Zählen -> Verbrauch
Speichert Werte in statistics.x.temp.sumCount.* bzw. statistics.x.save.sumCount.*.
Bei einer steigenden Flanke wird der Zählerwert um x erhöht. Die Wertigkeit kann frei definiert werden (beispielsweise 3):

Betriebszeit
Speichert Werte in statistics.x.temp.timeCount.* bzw. statistics.0.save.timeCount.*.
Zählt die Zeit zwischen den Flankenwechseln. Es werden jeweils Werte für an und aus getrennt gezählt. So kann beispielsweise ermittelt werden, wie lange ein Fenster pro Tag, Woche, Monat, Jahr geöffnet war oder wie lange eine schaltbare Steckdose eingeschaltet war.

Number Zustände

Durchschnitt
Speichert Werte in statistics.x.temp.avg.* bzw. statistics.x.save.avg.*.
Ermittelt den Durchschnitt aller Werte im jeweiligen Zeitraum.
Min/Max-Werte
Speichert Werte in statistics.x.temp.minmax.* bzw. statistics.x.save.minmax.*.
Ermittelt den Minimal- und Maximalwert im jeweiligen Zeitraum.
Delta-Verbrauch
Speichert Werte in statistics.x.temp.sumDelta.* bzw. statistics.x.save.sumDelta.*.
Gruppen

Optionen
| Attribute | Type | State-Type |
|---|---|---|
| enabled | boolean | - |
| count | boolean | boolean |
| fiveMin | boolean | boolean |
| sumCount | boolean | boolean |
| impUnitPerImpulse | number | boolean |
| impUnit | string | boolean |
| timeCount | boolean | boolean |
| avg | boolean | number |
| minmax | boolean | number |
| sumDelta | boolean | number |
| sumIgnoreMinus | boolean | number |
| groupFactor | number | boolean |
| logName | string | - |
| sumGroup | string | - |
"custom": {
"statistics.0": {
"enabled": true,
"count": false,
"fiveMin": false,
"sumCount": false,
"impUnitPerImpulse": 1,
"impUnit": "",
"timeCount": false,
"avg": true,
"minmax": true,
"sumDelta": true,
"sumIgnoreMinus": true,
"groupFactor": 2,
"logName": "mynumber",
"sumGroup": "energy"
}
}
sendTo
sendTo('statistics.0', 'enableStatistics', {
id: '0_userdata.0.manual'
}, (data) => {
if (data.success) {
console.log(`Added statistics`);
} else {
console.error(data.err);
}
});
sendTo('statistics.0', 'enableStatistics', {
id: '0_userdata.0.mynumber',
options: {
avg: true,
minmax: true,
sumDelta: true,
sumIgnoreMinus: true
}
}, (data) => {
if (data.success) {
console.log(`Added statistics`);
} else {
console.error(data.err);
}
});
Changelog
5.0.0 (2026-06-02)
- (copilot) Adapter requires node.js >= 22 now
- (copilot) Adapter requires admin >= 7.7.22 now
- (@klein0r) Added option to use a weighted average (based on time delta between changes)
- (@klein0r) Optimized avg calculation (without using a sum)
- (@klein0r) admin 7.6.17 and js-controller 6.0.11 (or later) are required
- (@klein0r) Updated dependencies
4.0.0 (2025-04-16)
NodeJS >= 20.x and js-controller >= 6 is required
3.1.0 (2024-11-18)
- (@simatec) Added responsive jsonConfig
- (@klein0r) Copy unit of source state to all statistic states
3.0.0 (2024-11-15)
NodeJS >= 18.x and js-controller >= 5 is required
2.4.0 (2023-11-03)
NodeJS 16.x is required
- (klein0r) Show error if groups are not configured correctly
- (klein0r) Fixed cron expressions for quarter and year
- (klein0r) Added indicators for startup and working
License
The MIT License (MIT)
Copyright (c) 2026 iobroker-community-adapters iobroker-community-adapters@gmx.de
Copyright (c) 2018-2026 foxthefox foxthefox@wysiwis.net,
bluefox dogafox@gmail.com and
Matthias Kleine info@haus-automatisierung.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.