chore: simplify
This commit is contained in:
parent
ffbdb4eac3
commit
82482f01cf
6 changed files with 11 additions and 10 deletions
|
|
@ -108,7 +108,7 @@ func (m *hoymilesDTUModbusTCP) panelPower(panelIndex int) (float64, float64, boo
|
|||
|
||||
func (m *hoymilesDTUModbusTCP) readCurrentValues() (hoymilesDTUValues, error) {
|
||||
var values hoymilesDTUValues
|
||||
for i := 0; i < hoymilesMaxPanels; i++ {
|
||||
for i := range hoymilesMaxPanels {
|
||||
power, cumulative, found, err := m.panelPower(i)
|
||||
if err != nil {
|
||||
return hoymilesDTUValues{}, err
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ func NewConnection(uri, user, password string, channel int, cache time.Duration)
|
|||
return nil, fmt.Errorf("%s (%s) missing user/password", resp.Model, resp.Mac)
|
||||
}
|
||||
|
||||
model := strings.Split(resp.Type+resp.Model, "-")[0]
|
||||
model, _, _ := strings.Cut(resp.Type+resp.Model, "-")
|
||||
|
||||
client.Transport = request.NewTripper(log, transport.Insecure())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue