chore: simplify

This commit is contained in:
andig 2026-06-04 12:21:11 +02:00
parent ffbdb4eac3
commit 82482f01cf
6 changed files with 11 additions and 10 deletions

View file

@ -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

View file

@ -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())