Skip to content

Commit

Permalink
Fix energy always added
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed May 2, 2020
1 parent f86b3a3 commit 60c4610
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions meter/sma.go
Expand Up @@ -60,7 +60,7 @@ func NewSMA(uri, power, energy string) api.Meter {
go sm.receive()

// decorate api.MeterEnergy
if power != "" {
if energy != "" {
return &SMAEnergy{SMA: sm}
}

Expand Down Expand Up @@ -141,7 +141,7 @@ type SMAEnergy struct {
}

// TotalEnergy implements the api.MeterEnergy interface
func (sm *SMA) TotalEnergy() (float64, error) {
func (sm *SMAEnergy) TotalEnergy() (float64, error) {
sm.once.Do(sm.waitForInitialValue)
sm.mux.Lock()
defer sm.mux.Unlock()
Expand Down

0 comments on commit 60c4610

Please sign in to comment.