Skip to content

Commit

Permalink
fixed error handler summary param
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronSaikovski committed Feb 25, 2024
1 parent f5acab5 commit ce832a7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ From the command line the usage is pretty simple:

```bash
##Note the use of single quotes ''
./gogoodwe --account '<[email protected]>' --pwd '<password>' --powerstationid '<powerstation id>' --dailysummary
./gogoodwe --account '<[email protected]>' --pwd '<password>' --powerstationid '<powerstation id>' --summary

# Or
./gogoodwe -a '<[email protected]>' -p '<password>' -i '<powerstation id>' -d
./gogoodwe -a '<[email protected]>' -p '<password>' -i '<powerstation id>' -s

##where daily summary provides a shorter daily view of the inverter data
```
Expand Down
12 changes: 10 additions & 2 deletions cmd/gogoodwe/powerstation/monitordetails.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ import (
"github.com/AaronSaikovski/gogoodwe/cmd/gogoodwe/utils"
)

// func getMonitorDatav2[T interfaces.ISemsDataConstraint](LoginCredentials *types.LoginCredentials, LoginApiResponse *types.LoginResponse, InverterOutput *T) (T, error) {

// var someValue T

// return someValue, nil

// }

// Generic function to retrieve data from the API via an ISemsDataConstraint Interface of defined structs
func getMonitorData[T interfaces.ISemsDataConstraint](LoginCredentials *types.LoginCredentials, LoginApiResponse *types.LoginResponse, InverterOutput *T) error {

Expand Down Expand Up @@ -70,7 +78,7 @@ func getMonitorDetailByPowerstationId(LoginCredentials *types.LoginCredentials,

err := getMonitorData(LoginCredentials, LoginApiResponse, &powerstationData)
if err != nil {
utils.HandleError(err)
utils.HandleError(errors.New("error: fetching powerstation data"))
}

dataOutput, err := getDataJSON(powerstationData)
Expand All @@ -92,7 +100,7 @@ func getMonitorSummaryByPowerstationId(LoginCredentials *types.LoginCredentials,
var powerstationData types.DailySummaryData
err := getMonitorData(LoginCredentials, LoginApiResponse, &powerstationData)
if err != nil {
utils.HandleError(err)
utils.HandleError(errors.New("error: fetching powerstation summary data"))
}

dataOutput, err := getDataJSON(powerstationData)
Expand Down
4 changes: 2 additions & 2 deletions cmd/gogoodwe/utils/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package utils

var (
// Version string
VersionString string = "gogoodwe v2.0.0"
VersionString string = "gogoodwe v2.0.1"
)

// Args - struct using go-arg- https://github.com/alexflint/go-arg
type Args struct {
Account string `arg:"required,-a,--account" help:"SEMS Email Account."`
Password string `arg:"required,-p,--password" help:"SEMS Account password."`
PowerStationID string `arg:"required,-i,--powerstationid" help:"SEMS Powerstation ID."`
DailySummary bool `arg:"-d,--dailysummary" help:"Output as a daily summary."`
DailySummary bool `arg:"-s,--summary" help:"Output as a daily summary."`
}

// Description - App description
Expand Down

0 comments on commit ce832a7

Please sign in to comment.