From b43585597970cd450361635f43fc24a28c6dd1a5 Mon Sep 17 00:00:00 2001 From: Markus Thierolf <77847348+thierolm@users.noreply.github.com> Date: Sun, 5 Feb 2023 12:18:33 +0100 Subject: [PATCH] Tasmota: tolerate missing power information in StatusSNS (#6050) Co-authored-by: Markus Thierolf --- meter/tasmota/types.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meter/tasmota/types.go b/meter/tasmota/types.go index 14b2952c0..14abd30f5 100644 --- a/meter/tasmota/types.go +++ b/meter/tasmota/types.go @@ -96,6 +96,9 @@ type StatusSNSResponse struct { type Channels []float64 func (ch *Channels) Channel(channel int) (float64, error) { + if *ch == nil { + return 0, nil + } if channel < 1 || channel > len(*ch) { return 0, fmt.Errorf("invalid channel: %d", channel) }