-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge pull request #15 from AaronSaikovski/v3.0.0_new_ver
V3.0.0 new ver
Showing
42 changed files
with
1,522 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"cSpell.words": ["monitorsummary"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<div align="center"> | ||
|
||
## GoGoodwe V2.0.6 | ||
## GoGoodwe v3.0.0 | ||
|
||
A command line tool to query the GOODWE SEMS Solar Inverter APIs - written in 100% Go. | ||
|
||
|
@@ -9,31 +9,48 @@ A command line tool to query the GOODWE SEMS Solar Inverter APIs - written in 10 | |
|
||
</div> | ||
|
||
## Installation | ||
### Software Requirements: | ||
|
||
The toolchain is mainly driven by the Makefile. | ||
- [Go v1.22.X](https://www.go.dev/dl/) or later needs to be installed to build the code. | ||
- [Azure CLI tools](https://learn.microsoft.com/en-us/cli/azure/) 2.50 or later | ||
- [Taskfile](https://taskfile.dev/) to run the build chain commands listed below. | ||
|
||
## Installation: | ||
|
||
The toolchain is driven by using [Taskfile](https://taskfile.dev/) and all commands are managed via the file `Taskfile.yml` | ||
|
||
The list of commands is as follows: | ||
|
||
```bash | ||
help - Display help about make targets for this Makefile | ||
release - Builds the project in preparation for (local)release | ||
goreleaser - Builds the project in preparation for release | ||
docs - updates the swagger docs | ||
build - Builds the project in preparation for debug | ||
run - builds and runs the program on the target platform | ||
clean - Remove the old builds and any debug information | ||
test - executes unit tests | ||
deps - fetches any external dependencies and updates | ||
vet - Vet examines Go source code and reports suspicious constructs | ||
staticcheck - Runs static code analyzer staticcheck - currently broken | ||
seccheck - Code vulnerability check | ||
lint - format code and tidy modules | ||
* build: Builds the project in preparation for debug. | ||
* clean: Removes the old builds and any debug information from the source tree. | ||
* deps: Fetches any external dependencies and updates. | ||
* destroy: Destroy Azure resources for testing. | ||
* docs: Updates the swagger docs - For APIs. | ||
* generate: update binary build version using gogenerate. | ||
* goreleaser: Builds a cross platform release using goreleaser. | ||
* lint: Lint, format and tidy code. | ||
* release: Builds the project in preparation for (local)release. | ||
* run: Builds and runs the program on the target platform. | ||
* seccheck: Code vulnerability scanner check. | ||
* staticcheck: Runs static code analyzer staticcheck. | ||
* test: Executes unit tests. | ||
* version: Get the Go version. | ||
* vet: Vet examines Go source code and reports suspicious constructs. | ||
* watch: Use air server for hot reloading. | ||
``` | ||
|
||
Execute using the taskfile utility: | ||
|
||
```bash | ||
task <command_from_above_list> | ||
``` | ||
|
||
To get started type, | ||
|
||
- make dep - to fetch all dependencies | ||
- make build - to build debug version for your target environment architecture | ||
- make release - Builds a release version for your target environment architecture | ||
- `task deps` - to fetch all dependencies and update all dependencies. | ||
- `task build` - to build debug version for your target environment architecture. | ||
- `task release` - Builds a release version for your target environment architecture - outputs to /bin folder. | ||
|
||
## Usage | ||
|
||
|
@@ -45,14 +62,29 @@ Then the Station ID is `11112222-aaaa-bbbb-cccc-ddddeeeeeffff`. | |
|
||
From the command line the usage is pretty simple: | ||
|
||
The Report Type corresponds to the type of API call and Report that is generated: | ||
|
||
- (0)-Detail - Fully detailed report. | ||
- (1)-Summary - Summary Data report (reduced information). | ||
- (2)-Point - Inverter All points data. | ||
- (3)-Plant - Plant Detail By Powerstation Id. | ||
- (4)-PlantChart - Plant Chart data for use in Charts and Graphs. | ||
- (5)-PowerFlow - Powerflow Summary data | ||
|
||
```bash | ||
##Note the use of single quotes '' | ||
./gogoodwe --account '<[email protected]>' --pwd '<password>' --powerstationid '<powerstation id>' --summary | ||
./gogoodwe --account '<[email protected]>' \ | ||
--pwd '<password>' \ | ||
--powerstationid '<powerstation id>' \ | ||
--reporttype '<report type (Optional)>' | ||
|
||
# Or | ||
./gogoodwe -a '<[email protected]>' -p '<password>' -i '<powerstation id>' -s | ||
./gogoodwe -a '<[email protected]>' \ | ||
-p '<password>' \ | ||
-i '<powerstation id>' \ | ||
-r '<report type> (Optional)>' | ||
|
||
##where daily summary provides a shorter daily view of the inverter data | ||
##w | ||
``` | ||
|
||
To get the help on using the command line tool, type: | ||
|
@@ -78,4 +110,4 @@ GOODWE access is based on the undocumented API used by mobile apps. This could b | |
|
||
## Known Issues | ||
|
||
**None at time of release.** | ||
- The Powerchart report is returning no/blank values - investigating. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
MIT License | ||
# Copyright (c) 2024 Aaron Saikovski | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
package app | ||
|
||
// Constants for Report lookups | ||
const ( | ||
Detail = iota // 0 | ||
Summary // 1 | ||
Point // 2 | ||
Plant // 3 | ||
PlantChart // 4 | ||
PowerFlow // 5 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
MIT License | ||
# Copyright (c) 2024 Aaron Saikovski | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
package app | ||
|
||
// Main package - This is the main program entry point | ||
import ( | ||
"github.com/AaronSaikovski/gogoodwe/pkg/interfaces" | ||
inverteallpoint "github.com/AaronSaikovski/gogoodwe/pkg/inverterallpoint" | ||
"github.com/AaronSaikovski/gogoodwe/pkg/monitordetail" | ||
"github.com/AaronSaikovski/gogoodwe/pkg/monitorsummary" | ||
"github.com/AaronSaikovski/gogoodwe/pkg/plantdetail" | ||
plantchartdata "github.com/AaronSaikovski/gogoodwe/pkg/plantpowerchart" | ||
"github.com/AaronSaikovski/gogoodwe/pkg/powerflow" | ||
) | ||
|
||
// lookupMonitorData returns a PowerData object based on the given reportData string. | ||
// | ||
// Parameters: | ||
// - reportData: a string representing the type of data to retrieve. | ||
// | ||
// Returns: | ||
// - interfaces.PowerData: the PowerData object corresponding to the reportData. | ||
func lookupMonitorData(reportData int) interfaces.PowerData { | ||
|
||
switch reportData { | ||
|
||
case Point: | ||
return inverteallpoint.NewInverterAllPoint() | ||
case Detail: | ||
return monitordetail.NewMonitorData() | ||
case Summary: | ||
return monitorsummary.NewDailySummaryData() | ||
case Plant: | ||
return plantdetail.NewGetPlantDetailByPowerstationId() | ||
case PlantChart: | ||
return plantchartdata.NewPlantPowerChart() | ||
case PowerFlow: | ||
return powerflow.NewPowerflow() | ||
default: | ||
return monitordetail.NewMonitorData() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v2.0.6 | ||
v3.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.