Fritz: make unit 1-based (BC) (#29741)
This commit is contained in:
parent
7303a5b476
commit
2b16c415bb
5 changed files with 9 additions and 3 deletions
|
|
@ -88,10 +88,10 @@ func (c *Connection) resolveUnitUID(unit int) (string, error) {
|
||||||
if d.AIN != c.AIN {
|
if d.AIN != c.AIN {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if len(d.UnitUids) < unit+1 {
|
if len(d.UnitUids) < unit {
|
||||||
return "", fmt.Errorf("invalid unit %d, got %v", unit, d.UnitUids)
|
return "", fmt.Errorf("invalid unit %d, got %v", unit, d.UnitUids)
|
||||||
}
|
}
|
||||||
return d.UnitUids[unit], nil
|
return d.UnitUids[unit-1], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return "", fmt.Errorf("ain not found: %s", c.AIN)
|
return "", fmt.Errorf("ain not found: %s", c.AIN)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,10 @@ func init() {
|
||||||
|
|
||||||
// NewFritzDECTFromConfig creates a fritzdect meter from generic config
|
// NewFritzDECTFromConfig creates a fritzdect meter from generic config
|
||||||
func NewFritzDECTFromConfig(other map[string]any) (api.Meter, error) {
|
func NewFritzDECTFromConfig(other map[string]any) (api.Meter, error) {
|
||||||
var cc fritz.Settings
|
cc := fritz.Settings{
|
||||||
|
Unit: 1,
|
||||||
|
}
|
||||||
|
|
||||||
if err := util.DecodeOther(other, &cc); err != nil {
|
if err := util.DecodeOther(other, &cc); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ params:
|
||||||
- name: unit
|
- name: unit
|
||||||
advanced: true
|
advanced: true
|
||||||
type: int
|
type: int
|
||||||
|
default: 1
|
||||||
description:
|
description:
|
||||||
de: Einheit
|
de: Einheit
|
||||||
en: Unit
|
en: Unit
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ params:
|
||||||
- name: unit
|
- name: unit
|
||||||
advanced: true
|
advanced: true
|
||||||
type: int
|
type: int
|
||||||
|
default: 1
|
||||||
description:
|
description:
|
||||||
de: Einheit
|
de: Einheit
|
||||||
en: Unit
|
en: Unit
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ params:
|
||||||
- name: unit
|
- name: unit
|
||||||
advanced: true
|
advanced: true
|
||||||
type: int
|
type: int
|
||||||
|
default: 1
|
||||||
description:
|
description:
|
||||||
de: Einheit
|
de: Einheit
|
||||||
en: Unit
|
en: Unit
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue