Skip to content

Commit

Permalink
Tasmota: tolerate missing power information in StatusSNS (evcc-io#6050)
Browse files Browse the repository at this point in the history
Co-authored-by: Markus Thierolf <m.thierolf@googlemail.com>
  • Loading branch information
thierolm and Markus Thierolf authored Feb 5, 2023
1 parent 338ec88 commit b435855
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions meter/tasmota/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit b435855

Please sign in to comment.