Tasmota: tolerate missing power information in StatusSNS (#6050)
Some checks failed
Some checks failed
Co-authored-by: Markus Thierolf <m.thierolf@googlemail.com>
This commit is contained in:
parent
338ec88cfe
commit
b435855979
1 changed files with 3 additions and 0 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue