v1.3.1 datetime fixes
60
.idea/workspace.xml
generated
@ -6,8 +6,21 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="76adadc9-ae71-42a6-82a1-66dbc8ecb14c" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220224-8042-InternalAirTemperature.png" beforeDir="false" afterPath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220224-8042-InternalAirTemperature.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-BatteryChargingPower.png" beforeDir="false" afterPath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-BatteryChargingPower.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-BatteryDischargingPower.png" beforeDir="false" afterPath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-BatteryDischargingPower.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-BatteryHealth(SOH).png" beforeDir="false" afterPath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-BatteryHealth(SOH).png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-BatteryLevel(SOC).png" beforeDir="false" afterPath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-BatteryLevel(SOC).png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-BatteryTemperature.png" beforeDir="false" afterPath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-BatteryTemperature.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-InternalAirTemperature.png" beforeDir="false" afterPath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-InternalAirTemperature.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-LoadPower.png" beforeDir="false" afterPath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-LoadPower.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-PurchasedPower.png" beforeDir="false" afterPath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-PurchasedPower.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-TotalDCPower.png" beforeDir="false" afterPath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-TotalDCPower.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-TotalExportActivePower.png" beforeDir="false" afterPath="$PROJECT_DIR$/docs/AppService_queryMutiPointDataList-20220228-8042-TotalExportActivePower.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples.txt" beforeDir="false" afterPath="$PROJECT_DIR$/examples.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/datetime.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/datetime.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/output/struct_graph.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/output/struct_graph.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/funcs.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/funcs.go" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -73,7 +86,7 @@
|
||||
<configuration name="GoSungrow" type="GoApplicationRunConfiguration" factoryName="Go Application">
|
||||
<module name="GoSungrow" />
|
||||
<working_directory value="$PROJECT_DIR$" />
|
||||
<parameters value="data graph template 8042 20220228" />
|
||||
<parameters value="data graph template 8042 20220224 '{"search_string":"p13019"}'" />
|
||||
<kind value="PACKAGE" />
|
||||
<package value="$PROJECT_DIR$" />
|
||||
<directory value="$PROJECT_DIR$" />
|
||||
@ -177,12 +190,12 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/funcs.go</url>
|
||||
<line>330</line>
|
||||
<line>323</line>
|
||||
<option name="timeStamp" value="210" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/funcs.go</url>
|
||||
<line>318</line>
|
||||
<line>311</line>
|
||||
<option name="timeStamp" value="211" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
@ -197,24 +210,19 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/funcs.go</url>
|
||||
<line>399</line>
|
||||
<line>345</line>
|
||||
<option name="timeStamp" value="261" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/funcs.go</url>
|
||||
<line>417</line>
|
||||
<line>363</line>
|
||||
<option name="timeStamp" value="265" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/funcs.go</url>
|
||||
<line>410</line>
|
||||
<line>356</line>
|
||||
<option name="timeStamp" value="266" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/output/struct_graph.go</url>
|
||||
<line>270</line>
|
||||
<option name="timeStamp" value="291" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/output/struct_graph.go</url>
|
||||
<line>257</line>
|
||||
@ -222,33 +230,13 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/output/struct_graph.go</url>
|
||||
<line>634</line>
|
||||
<option name="timeStamp" value="312" />
|
||||
<line>652</line>
|
||||
<option name="timeStamp" value="336" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/output/struct_graph.go</url>
|
||||
<line>76</line>
|
||||
<option name="timeStamp" value="313" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_response.go</url>
|
||||
<line>23</line>
|
||||
<option name="timeStamp" value="324" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/datetime.go</url>
|
||||
<line>63</line>
|
||||
<option name="timeStamp" value="326" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/output/struct_graph.go</url>
|
||||
<line>204</line>
|
||||
<option name="timeStamp" value="331" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/output/struct_graph.go</url>
|
||||
<line>181</line>
|
||||
<option name="timeStamp" value="332" />
|
||||
<line>481</line>
|
||||
<option name="timeStamp" value="337" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
|
@ -255,7 +255,7 @@ Get mains power frequency variation graph from template id 8041 on date 2022/02/
|
||||
```
|
||||
./bin/GoSungrow data graph template 8041 20220228 '{"search_string":"p13007","min_left_axis":49,"max_left_axis":51}'
|
||||
```
|
||||

|
||||

|
||||
|
||||
|
||||
### Using the API instead.
|
||||
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 99 KiB |
Before Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 81 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 58 KiB |
@ -1,7 +1,6 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -51,11 +50,19 @@ func NewDateTime(date string) DateTime {
|
||||
}
|
||||
|
||||
func (dt *DateTime) GetDayStartTimestamp() string {
|
||||
return fmt.Sprintf("%s000000", dt.Time.Format(DtLayoutDay))
|
||||
var ret string
|
||||
f1 := dt.Time.Round(time.Hour * 24)
|
||||
ret = f1.Format(DtLayoutSecond)
|
||||
return ret
|
||||
// return fmt.Sprintf("%s000000", dt.Time.Format(DtLayoutDay))
|
||||
}
|
||||
|
||||
func (dt *DateTime) GetDayEndTimestamp() string {
|
||||
return fmt.Sprintf("%s235900", dt.Time.Format(DtLayoutDay))
|
||||
var ret string
|
||||
f1 := dt.Time.Round(time.Hour * 24).Add(time.Hour * 24)
|
||||
ret = f1.Format(DtLayoutSecond)
|
||||
return ret
|
||||
// return fmt.Sprintf("%s235900", dt.Time.Format(DtLayoutDay))
|
||||
}
|
||||
|
||||
func (dt DateTime) String() string {
|
||||
|
@ -656,6 +656,20 @@ func (c *Chart) Generate() error {
|
||||
}
|
||||
|
||||
|
||||
// TimeValueFormatterWithFormat is a ValueFormatter for timestamps with a given format.
|
||||
func formatTime(v interface{}, dateFormat string) string {
|
||||
if typed, isTyped := v.(time.Time); isTyped {
|
||||
return typed.Format(dateFormat)
|
||||
}
|
||||
if typed, isTyped := v.(int64); isTyped {
|
||||
return time.Unix(0, typed).Format(dateFormat)
|
||||
}
|
||||
if typed, isTyped := v.(float64); isTyped {
|
||||
return time.Unix(0, int64(typed)).Format(dateFormat)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
// var lock sync.Mutex
|
||||
// var graph *chart.Chart
|
||||
|
@ -291,13 +291,6 @@ func (sg *SunGrow) GetCurrentStats() error {
|
||||
if sg.Error != nil {
|
||||
break
|
||||
}
|
||||
|
||||
// if sg.OutputType.IsHuman() {
|
||||
// _queryDeviceList := queryDeviceList.AssertResultData(ep)
|
||||
// points := _queryDeviceList.GetDataByName("SH10RT")
|
||||
// // @TODO - Improve output of this!
|
||||
// fmt.Printf("%v", points)
|
||||
// }
|
||||
}
|
||||
|
||||
return sg.Error
|
||||
@ -343,53 +336,6 @@ func (sg *SunGrow) GetPointData(date string, pointNames api.TemplatePoints) erro
|
||||
if sg.Error != nil {
|
||||
break
|
||||
}
|
||||
|
||||
//
|
||||
// csv := api.NewCsv()
|
||||
// sg.Error = csv.SetHeader([]string{
|
||||
// "Date/Time",
|
||||
// "PointId Name",
|
||||
// "Point Name",
|
||||
// "Value",
|
||||
// "Units",
|
||||
// })
|
||||
//
|
||||
// data := queryMutiPointDataList.AssertResultData(ep)
|
||||
// for deviceName, deviceRef := range data.Devices {
|
||||
// for pointId, pointRef := range deviceRef.Points {
|
||||
// for _, tim := range pointRef.Times {
|
||||
// gp := pointNames.GetPoint(deviceName, pointId)
|
||||
// _ = csv.AddRow([]string {
|
||||
// tim.Key.PrintFull(),
|
||||
// deviceName,
|
||||
// fmt.Sprintf("%s (%s)", gp.Description, pointId),
|
||||
// tim.Value,
|
||||
// gp.Unit,
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// switch {
|
||||
// case sg.OutputType.IsNone():
|
||||
//
|
||||
// case sg.OutputType.IsHuman():
|
||||
// table.Print()
|
||||
//
|
||||
// case sg.OutputType.IsFile():
|
||||
// // a := queryMutiPointDataList.Assert(ep)
|
||||
// // suffix := fmt.Sprintf("%s-%s", when, "data")
|
||||
// // fn := a.GetCsvFilename()
|
||||
// sg.Error = table.WriteCsvFile()
|
||||
//
|
||||
// case sg.OutputType.IsRaw():
|
||||
// fmt.Println(ep.GetJsonData(true))
|
||||
//
|
||||
// case sg.OutputType.IsJson():
|
||||
// fmt.Println(ep.GetJsonData(false))
|
||||
//
|
||||
// default:
|
||||
// }
|
||||
}
|
||||
|
||||
return sg.Error
|
||||
@ -460,9 +406,6 @@ func (sg *SunGrow) Output(endpoint api.EndPoint, table output.Table, graphFilter
|
||||
table.Print()
|
||||
|
||||
case sg.OutputType.IsFile():
|
||||
// a := queryMutiPointDataList.Assert(endpoint)
|
||||
// suffix := fmt.Sprintf("%s-%s", when, "data")
|
||||
// fn := a.GetCsvFilename()
|
||||
sg.Error = table.WriteCsvFile()
|
||||
|
||||
case sg.OutputType.IsRaw():
|
||||
@ -480,7 +423,6 @@ func (sg *SunGrow) Output(endpoint api.EndPoint, table output.Table, graphFilter
|
||||
if sg.Error != nil {
|
||||
break
|
||||
}
|
||||
//
|
||||
|
||||
default:
|
||||
}
|
||||
@ -492,11 +434,8 @@ func (sg *SunGrow) Output(endpoint api.EndPoint, table output.Table, graphFilter
|
||||
func (sg *SunGrow) GetPsId() int64 {
|
||||
var ret int64
|
||||
|
||||
// sOut := sg.OutputType
|
||||
for range Only.Once {
|
||||
// sg.OutputType.SetNone()
|
||||
|
||||
// ep := sg.GetByJson("AppService.getPsList", "")
|
||||
ep := sg.GetByStruct("AppService.getPsList", nil, DefaultCacheTimeout)
|
||||
if ep.IsError() {
|
||||
sg.Error = ep.GetError()
|
||||
@ -506,7 +445,6 @@ func (sg *SunGrow) GetPsId() int64 {
|
||||
_getPsList := getPsList.AssertResultData(ep)
|
||||
ret = _getPsList.GetPsId()
|
||||
}
|
||||
// sg.OutputType = sOut
|
||||
|
||||
return ret
|
||||
}
|
||||
@ -524,33 +462,3 @@ func fillArray(count int, args []string) []string {
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
// func (sg *SunGrow) Graph(csv api.Table, timeCol int, ) {
|
||||
// foo := New("Testing 1. 2. 3.")
|
||||
//
|
||||
// err := foo.SetFilename("HelloWorld.png")
|
||||
// fmt.Println(err)
|
||||
//
|
||||
// now := time.Now()
|
||||
// var times []time.Time
|
||||
// for i := 0; i < 16; i++ {
|
||||
// now = now.Add(time.Minute * 5)
|
||||
// times = append(times, now)
|
||||
// }
|
||||
// err = foo.SetX("Date", times...)
|
||||
// fmt.Println(err)
|
||||
//
|
||||
// var values []float64
|
||||
// for i := 0; i < 16; i++ {
|
||||
// then := (float64(i) * Randy(-200, 500)) + Randy(-5000, 10000)
|
||||
// values = append(values, then)
|
||||
// }
|
||||
//
|
||||
// err = foo.SetY("Power", values...)
|
||||
// fmt.Println(err)
|
||||
//
|
||||
// foo.SetRangeY(-6000, 12000)
|
||||
//
|
||||
// err = foo.Generate()
|
||||
// fmt.Println(err)
|
||||
// }
|
||||
|