chore: simplify
This commit is contained in:
parent
48666a59c6
commit
92884c27b3
1 changed files with 2 additions and 4 deletions
|
|
@ -110,8 +110,7 @@ func NewRCT(uri, usage string, cache time.Duration, capacity func() float64) (ap
|
|||
func (m *RCT) CurrentPower() (float64, error) {
|
||||
switch m.usage {
|
||||
case "grid":
|
||||
res, err := m.queryFloat(rct.TotalGridPowerW)
|
||||
return res, err
|
||||
return m.queryFloat(rct.TotalGridPowerW)
|
||||
|
||||
case "pv":
|
||||
a, err := m.queryFloat(rct.SolarGenAPowerW)
|
||||
|
|
@ -126,8 +125,7 @@ func (m *RCT) CurrentPower() (float64, error) {
|
|||
return a + b + c, err
|
||||
|
||||
case "battery":
|
||||
res, err := m.queryFloat(rct.BatteryPowerW)
|
||||
return res, err
|
||||
return m.queryFloat(rct.BatteryPowerW)
|
||||
|
||||
default:
|
||||
return 0, fmt.Errorf("invalid usage: %s", m.usage)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue