From ba78cb129b89a26e42558786a448e3332fb96b99 Mon Sep 17 00:00:00 2001 From: "Mathieu Bodjikian (LAPTOP862078.local)" Date: Sat, 4 May 2019 15:26:08 +0200 Subject: [PATCH] Ignore invalid values from Enedis, such as negative measures --- enedis/client.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/enedis/client.go b/enedis/client.go index 9d72aec..098de7d 100644 --- a/enedis/client.go +++ b/enedis/client.go @@ -162,6 +162,11 @@ func (c *Client) GetData(resolution string, from time.Time, to time.Time) (power // Make pretty response for _, measure := range enedisDataReturn.Graphe.Data { + // Ignore invalid measures + if measure.Value <= 0 { + continue + } + // Create new measure pm := new(PowerMeasure)