Skip to content

Commit

Permalink
Bugfix when polling time-period from api that is older than appliance…
Browse files Browse the repository at this point in the history
… (e.g. installed this year we cannot poll last year)
  • Loading branch information
NoBl committed Oct 8, 2023
1 parent 88a7639 commit ebefe25
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ class Senec extends utils.Adapter {
* Decodes Statistik information from SENEC App API
*/
async decodeStatistik(system, obj, period) {
if (obj == null || obj == undefined || obj.aggregation == null || obj.aggregation == undefined) return; // could happen (e.g.) if we pull information for "last year" when the appliance isn't that old yet
const pfx = "_api.Anlagen." + system + ".Statistik." + period + ".";
for (const[key, value] of Object.entries(obj.aggregation)) {
// only reading 'aggregation' - no interest in fine granular information
Expand Down

0 comments on commit ebefe25

Please sign in to comment.