chore: fix ruleguard errors
This commit is contained in:
parent
00c8852be4
commit
fe217debbf
15 changed files with 15 additions and 15 deletions
|
|
@ -263,7 +263,7 @@ func (evse *EVSEWifi) totalEnergy() (float64, error) {
|
|||
// Currents implements the api.MeterCurrents interface
|
||||
func (evse *EVSEWifi) currents() (float64, float64, float64, error) {
|
||||
params, err := evse.getParameters()
|
||||
return float64(params.CurrentP1), float64(params.CurrentP2), float64(params.CurrentP3), err
|
||||
return params.CurrentP1, params.CurrentP2, params.CurrentP3, err
|
||||
}
|
||||
|
||||
// Identify implements the api.Identifier interface
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ func (wb *PhoenixEMEth) ChargingTime() (time.Duration, error) {
|
|||
|
||||
// 2 words, least significant word first
|
||||
secs := uint64(b[3])<<16 | uint64(b[2])<<24 | uint64(b[1]) | uint64(b[0])<<8
|
||||
return time.Duration(time.Duration(secs) * time.Second), nil
|
||||
return time.Duration(secs) * time.Second, nil
|
||||
}
|
||||
|
||||
// CurrentPower implements the api.Meter interface
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ func (wb *PhoenixEVEth) ChargingTime() (time.Duration, error) {
|
|||
|
||||
// 2 words, least significant word first
|
||||
secs := uint64(b[3])<<16 | uint64(b[2])<<24 | uint64(b[1]) | uint64(b[0])<<8
|
||||
return time.Duration(time.Duration(secs) * time.Second), nil
|
||||
return time.Duration(secs) * time.Second, nil
|
||||
}
|
||||
|
||||
// CurrentPower implements the api.Meter interface
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ func (c *Tasmota) ChargedEnergy() (float64, error) {
|
|||
var resp tasmota.StatusSNSResponse
|
||||
err := c.GetJSON(c.cmdUri("Status 8"), &resp)
|
||||
|
||||
return float64(resp.StatusSNS.Energy.Today), err
|
||||
return resp.StatusSNS.Energy.Today, err
|
||||
}
|
||||
|
||||
// cmdUri creates the Tasmota command web request
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ func (wb *Wallbe) ChargingTime() (time.Duration, error) {
|
|||
|
||||
// 2 words, least significant word first
|
||||
secs := uint64(b[1]) | uint64(b[0])<<8 | uint64(b[3])<<16 | uint64(b[2])<<24
|
||||
return time.Duration(time.Duration(secs) * time.Second), nil
|
||||
return time.Duration(secs) * time.Second, nil
|
||||
}
|
||||
|
||||
func (wb *Wallbe) decodeReading(b []byte) float64 {
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ func (lp *LoadPoint) GetPhases() int {
|
|||
lp.Lock()
|
||||
defer lp.Unlock()
|
||||
|
||||
return int(lp.Phases)
|
||||
return lp.Phases
|
||||
}
|
||||
|
||||
// SetPhases sets loadpoint enabled phases
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ var _ IntProvider = (*Mqtt)(nil)
|
|||
func (m *Mqtt) IntGetter() func() (int64, error) {
|
||||
h := &msgHandler{
|
||||
topic: m.topic,
|
||||
scale: float64(m.scale),
|
||||
scale: m.scale,
|
||||
mux: util.NewWaiter(m.timeout, func() { m.log.DEBUG.Printf("%s wait for initial value", m.topic) }),
|
||||
re: m.re,
|
||||
jq: m.jq,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ func TestEncode(t *testing.T) {
|
|||
{int64(1), "1"},
|
||||
{float64(1.23456), "1.2346"},
|
||||
{"1.2345", "\"1.2345\""},
|
||||
{time.Duration(time.Hour), "3600"},
|
||||
{time.Hour, "3600"},
|
||||
{"minpv", "\"minpv\""},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ func (v *Provider) SoC() (float64, error) {
|
|||
res, err := v.statusG()
|
||||
|
||||
if res, ok := res.(StatusData); err == nil && ok {
|
||||
return float64(res.EvStatus.BatteryStatus), nil
|
||||
return res.EvStatus.BatteryStatus, nil
|
||||
}
|
||||
|
||||
return 0, err
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ var _ api.Battery = (*Ford)(nil)
|
|||
func (v *Ford) SoC() (float64, error) {
|
||||
res, err := v.statusG()
|
||||
if res, ok := res.(fordVehicleStatus); err == nil && ok {
|
||||
return float64(res.VehicleStatus.BatteryFillLevel.Value), nil
|
||||
return res.VehicleStatus.BatteryFillLevel.Value, nil
|
||||
}
|
||||
|
||||
return 0, err
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ func (v *Niu) Range() (int64, error) {
|
|||
res, err := v.apiG()
|
||||
|
||||
if res, ok := res.(niu.Response); err == nil && ok {
|
||||
return int64(res.Data.EstimatedMileage), nil
|
||||
return res.Data.EstimatedMileage, nil
|
||||
}
|
||||
|
||||
return 0, err
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ var _ api.VehicleRange = (*Provider)(nil)
|
|||
func (v *Provider) Range() (int64, error) {
|
||||
res, err := v.statusEmobilityG()
|
||||
if res, ok := res.(EmobilityResponse); err == nil && ok {
|
||||
return int64(res.BatteryChargeStatus.RemainingERange.ValueInKilometers), nil
|
||||
return res.BatteryChargeStatus.RemainingERange.ValueInKilometers, nil
|
||||
}
|
||||
|
||||
res, err = v.statusG()
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ var _ api.VehicleRange = (*Provider)(nil)
|
|||
func (v *Provider) Range() (rng int64, err error) {
|
||||
res, err := v.chargerG()
|
||||
if res, ok := res.(ChargerResponse); err == nil && ok {
|
||||
rng = int64(res.Battery.CruisingRangeElectricInMeters) / 1e3
|
||||
rng = res.Battery.CruisingRangeElectricInMeters / 1e3
|
||||
}
|
||||
|
||||
return rng, err
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ func (v *Tesla) ChargedEnergy() (float64, error) {
|
|||
res, err := v.chargeStateG()
|
||||
|
||||
if res, ok := res.(*tesla.ChargeState); err == nil && ok {
|
||||
return float64(res.ChargeEnergyAdded), nil
|
||||
return res.ChargeEnergyAdded, nil
|
||||
}
|
||||
|
||||
return 0, err
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ var _ api.VehicleOdometer = (*Volvo)(nil)
|
|||
func (v *Volvo) Odometer() (float64, error) {
|
||||
res, err := v.statusG()
|
||||
if res, ok := res.(volvo.Status); err == nil && ok {
|
||||
return float64(res.Odometer), nil
|
||||
return res.Odometer, nil
|
||||
}
|
||||
|
||||
return 0, err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue