v2.3.1 - More endpoints.

This commit is contained in:
MickMake 2022-10-13 12:01:27 +11:00
parent f149090e53
commit adb109944b
19 changed files with 1934 additions and 572 deletions

173
.idea/workspace.xml generated
View File

@ -5,41 +5,25 @@
</component>
<component name="ChangeListManager">
<list default="true" id="76adadc9-ae71-42a6-82a1-66dbc8ecb14c" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/iSolarCloud/NullArea/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmd/cmd_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/cmd_api.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmd/cmd_data.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/cmd_data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmd/cmd_mqtt.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/cmd_mqtt.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/AliSmsService/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AliSmsService/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/getHouseholdStoragePsReport/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/getHouseholdStoragePsReport/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/getPowerDevicePointInfo/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/getPowerDevicePointInfo/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/findPsType/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/findPsType/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/getAllDeviceByPsId/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/getAllDeviceByPsId/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/getDeviceList/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/getDeviceList/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/getIncomeSettingInfos/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/getIncomeSettingInfos/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/getKpiInfo/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/getKpiInfo/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/getPsDetail/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/getPsDetail/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/getPsDetailWithPsType/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/getPsDetailWithPsType/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/getPsList/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/getPsList/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/login/auth.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/login/auth.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceList/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceList/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceListForApp/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceListForApp/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/apiReflect/reflect.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/apiReflect/reflect.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/const.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/const.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/nullEndPoint/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/nullEndpoint/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/nullEndPoint/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/nullEndpoint/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/struct_areas.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/struct_areas.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/nullEndpoint/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/nullEndpoint/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/nullEndpoint/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/nullEndpoint/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/struct_data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/struct_data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/struct_endpoint.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/struct_endpoint.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/struct_point.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/struct_point.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/struct_points.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/struct_points.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/types.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/types.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/const.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/const.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/highlevel.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/highlevel.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mmHa/binary_sensor.go" beforeDir="false" afterPath="$PROJECT_DIR$/mmHa/binary_sensor.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mmHa/config.go" beforeDir="false" afterPath="$PROJECT_DIR$/mmHa/config.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mmHa/funcs.go" beforeDir="false" afterPath="$PROJECT_DIR$/mmHa/funcs.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mmHa/lights.go" beforeDir="false" afterPath="$PROJECT_DIR$/mmHa/lights.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mmHa/sensors.go" beforeDir="false" afterPath="$PROJECT_DIR$/mmHa/sensors.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mmHa/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/mmHa/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mmHa/switch.go" beforeDir="false" afterPath="$PROJECT_DIR$/mmHa/switch.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -110,7 +94,7 @@
<configuration name="GoSungrow" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="GoSungrow" />
<working_directory value="$PROJECT_DIR$" />
<parameters value="data get psdetails" />
<parameters value="data get all getKpiInfo" />
<kind value="PACKAGE" />
<package value="GoSungrow" />
<directory value="$PROJECT_DIR$" />
@ -156,7 +140,7 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceList/data.go</url>
<line>210</line>
<line>204</line>
<option name="timeStamp" value="202" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
@ -186,12 +170,12 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/cmd/cmd_mqtt.go</url>
<line>312</line>
<line>313</line>
<option name="timeStamp" value="437" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/cmd/cmd_mqtt.go</url>
<line>311</line>
<line>312</line>
<option name="timeStamp" value="446" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
@ -201,12 +185,12 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>348</line>
<line>352</line>
<option name="timeStamp" value="796" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>339</line>
<line>343</line>
<option name="timeStamp" value="804" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
@ -221,7 +205,7 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>601</line>
<line>596</line>
<option name="timeStamp" value="838" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
@ -241,7 +225,7 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>192</line>
<line>196</line>
<option name="timeStamp" value="881" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
@ -251,42 +235,42 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>146</line>
<line>150</line>
<option name="timeStamp" value="897" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>1054</line>
<line>1049</line>
<option name="timeStamp" value="906" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>84</line>
<line>88</line>
<option name="timeStamp" value="911" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>681</line>
<line>676</line>
<option name="timeStamp" value="914" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>670</line>
<line>665</line>
<option name="timeStamp" value="915" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>702</line>
<line>697</line>
<option name="timeStamp" value="917" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>454</line>
<line>458</line>
<option name="timeStamp" value="920" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>459</line>
<line>463</line>
<option name="timeStamp" value="921" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
@ -296,44 +280,39 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>397</line>
<line>401</line>
<option name="timeStamp" value="957" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>930</line>
<line>925</line>
<option name="timeStamp" value="967" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>927</line>
<line>922</line>
<option name="timeStamp" value="970" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>689</line>
<line>780</line>
<option name="timeStamp" value="972" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>577</line>
<line>668</line>
<option name="timeStamp" value="1190" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>895</line>
<line>890</line>
<option name="timeStamp" value="1216" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>876</line>
<line>871</line>
<option name="timeStamp" value="1237" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsDetail/struct.go</url>
<line>200</line>
<option name="timeStamp" value="1303" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/datetime.go</url>
<line>128</line>
@ -351,7 +330,7 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>316</line>
<line>320</line>
<option name="timeStamp" value="1355" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
@ -361,7 +340,7 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/cmd/cmd_mqtt.go</url>
<line>362</line>
<line>369</line>
<option name="timeStamp" value="1493" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
@ -371,7 +350,7 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/cmd/cmd_mqtt.go</url>
<line>478</line>
<line>465</line>
<option name="timeStamp" value="1587" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
@ -389,21 +368,6 @@
<line>936</line>
<option name="timeStamp" value="1603" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceList/data.go</url>
<line>421</line>
<option name="timeStamp" value="1622" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceList/data.go</url>
<line>345</line>
<option name="timeStamp" value="1637" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsList/data.go</url>
<line>287</line>
<option name="timeStamp" value="1645" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsList/data.go</url>
<line>373</line>
@ -411,29 +375,14 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>285</line>
<line>373</line>
<option name="timeStamp" value="1662" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsList/data.go</url>
<line>322</line>
<option name="timeStamp" value="1667" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsList/data.go</url>
<line>319</line>
<option name="timeStamp" value="1668" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsDetailWithPsType/data.go</url>
<line>310</line>
<line>315</line>
<option name="timeStamp" value="1676" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>488</line>
<option name="timeStamp" value="1677" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_points.go</url>
<line>97</line>
@ -441,7 +390,7 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsDetailWithPsType/data.go</url>
<line>318</line>
<line>323</line>
<option name="timeStamp" value="1721" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
@ -449,16 +398,51 @@
<line>95</line>
<option name="timeStamp" value="1723" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/cmd/cmd_mqtt.go</url>
<line>385</line>
<option name="timeStamp" value="1725" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/struct.go</url>
<line>117</line>
<option name="timeStamp" value="1726" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/cmd/cmd_mqtt.go</url>
<line>355</line>
<option name="timeStamp" value="1743" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsList/data.go</url>
<line>287</line>
<option name="timeStamp" value="1745" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>1398</line>
<option name="timeStamp" value="1746" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>1303</line>
<option name="timeStamp" value="1755" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getDeviceList/data.go</url>
<line>288</line>
<option name="timeStamp" value="1758" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getIncomeSettingInfos/data.go</url>
<line>106</line>
<option name="timeStamp" value="1759" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getIncomeSettingInfos/data.go</url>
<line>98</line>
<option name="timeStamp" value="1760" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getKpiInfo/data.go</url>
<line>84</line>
<option name="timeStamp" value="1770" />
</line-breakpoint>
</breakpoints>
<default-breakpoints>
<breakpoint type="DlvErrorBreakpoint" />
@ -466,7 +450,8 @@
</breakpoint-manager>
<watches-manager>
<configuration name="GoApplicationRunConfiguration">
<watch expression="tp[&quot;getPsDetailWithPsType.1129147_11_0_0.RobotNumSweepCapacity.Num&quot;]" language="go" />
<watch expression="dm.DataPoints[&quot;p83012&quot;]" language="go" />
<watch expression="tp[&quot;getPsDetail.1129147.P83012Value&quot;]" language="go" />
</configuration>
</watches-manager>
</component>

View File

@ -95,6 +95,7 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
c.AttachCmdDataPoints(cmdDataGet)
c.AttachCmdDataRealTime(cmdDataGet)
c.AttachCmdDataPsDetails(cmdDataGet)
c.AttachCmdDataAll(cmdDataGet)
// ********************************************************************************
var cmdDataRaw = &cobra.Command{
@ -128,6 +129,7 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
c.AttachCmdDataPoints(cmdDataRaw)
c.AttachCmdDataRealTime(cmdDataRaw)
c.AttachCmdDataPsDetails(cmdDataRaw)
c.AttachCmdDataAll(cmdDataRaw)
// ********************************************************************************
var cmdDataJson = &cobra.Command{
@ -161,6 +163,7 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
c.AttachCmdDataPoints(cmdDataJson)
c.AttachCmdDataRealTime(cmdDataJson)
c.AttachCmdDataPsDetails(cmdDataJson)
c.AttachCmdDataAll(cmdDataJson)
// ********************************************************************************
var cmdDataCsv = &cobra.Command{
@ -194,6 +197,7 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
c.AttachCmdDataPoints(cmdDataCsv)
c.AttachCmdDataRealTime(cmdDataCsv)
c.AttachCmdDataPsDetails(cmdDataCsv)
c.AttachCmdDataAll(cmdDataCsv)
// ********************************************************************************
var cmdDataGraph = &cobra.Command{
@ -226,6 +230,7 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
c.AttachCmdDataTemplate(cmdDataGraph)
c.AttachCmdDataPoints(cmdDataGraph)
c.AttachCmdDataRealTime(cmdDataGraph)
// c.AttachCmdDataAll(cmdDataGraph)
// ********************************************************************************
var cmdDataPut = &cobra.Command{
@ -436,3 +441,40 @@ func (c *CmdData) AttachCmdDataPsDetails(cmd *cobra.Command) *cobra.Command {
return cmd
}
func (c *CmdData) AttachCmdDataAll(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
var c2 = &cobra.Command{
Use: "all",
Aliases: []string{},
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("Get all iSolarCloud ps details."),
Long: fmt.Sprintf("Get all iSolarCloud ps details."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
_ = cmds.SetOutputType(cmd)
// pids, err := cmds.Api.SunGrow.StringToPids(args...)
// if err != nil {
// return err
// }
return cmds.Api.SunGrow.GetEndpoints(args)
},
Args: cobra.MinimumNArgs(0),
}
cmd.AddCommand(c2)
c2.Example = cmdHelp.PrintExamples(c2, "")
return cmd
}

View File

@ -2,6 +2,7 @@ package cmd
import (
"GoSungrow/Only"
"GoSungrow/iSolarCloud"
"GoSungrow/iSolarCloud/api"
"GoSungrow/mmHa"
"errors"
@ -341,13 +342,19 @@ func (ca *Cmds) MqttCron() error {
newDay = true
}
var data iSolarCloud.SunGrowData
data.New(ca.Api.SunGrow)
// All := []string{ "queryDeviceList", "getPsList", "getPsDetailWithPsType", "getPsDetail" }
All := []string{ "getPsDetail" }
for psId, ok := range ca.Mqtt.Mqtt.SungrowPsIds {
if !ok {
continue
}
for _, endpoint := range All {
ca.Error = ca.Update(endpoint, psId, newDay)
response := data.Get(endpoint, iSolarCloud.SunGrowDataRequest{ PsId: psId })
ca.Error = ca.Update(endpoint, response.Data, newDay)
if ca.Error != nil {
break
}
@ -363,31 +370,11 @@ func (ca *Cmds) MqttCron() error {
return ca.Error
}
// var All = []string{ "queryDeviceList", "getPsList", "getPsDetailWithPsType" }
var All = []string{ "getPsDetail" }
func (ca *Cmds) Update(endpoint string, psId api.Integer, newDay bool) error {
func (ca *Cmds) Update(endpoint string, data api.DataMap, newDay bool) error {
for range Only.Once {
// Also getPowerStatistics, getHouseholdStoragePsReport, getPsList, getUpTimePoint,
var data api.DataMap
switch endpoint {
case "queryDeviceList":
ep := ca.Api.SunGrow.QueryDeviceList(psId)
data = ep.GetData()
case "getPsList":
ep := ca.Api.SunGrow.GetPsList()
data = ep.GetData()
case "getPsDetailWithPsType":
ep := ca.Api.SunGrow.GetPsDetailWithPsType(psId)
data = ep.GetData()
case "getPsDetail":
ep := ca.Api.SunGrow.GetPsDetail(psId)
data = ep.GetData()
}
cmdLog.LogPrintDate("Syncing %d entries with HASSIO from %s.\n", len(data.DataPoints), endpoint)
for _, o := range data.Order {
entries := data.DataPoints[o]
r := entries.GetEntry(api.LastEntry) // Gets the last entry

View File

@ -3,7 +3,11 @@ package findPsType
import (
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/output"
"fmt"
"github.com/MickMake/GoUnify/Only"
"sort"
"time"
)
const Url = "/v1/powerStationService/findPsType"
@ -56,3 +60,78 @@ func (e *ResultData) IsValid() error {
//
// return err
//}
func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()
for range Only.Once {
pkg := apiReflect.GetName("", *e)
for _, d := range e.Response.ResultData {
name := fmt.Sprintf("%s.%s", pkg, e.Request.PsId.String())
entries.StructToPoints(d, name, e.Request.PsId.String(), time.Time{})
}
}
return entries
}
func (e *EndPoint) GetDataTable() output.Table {
var table output.Table
for range Only.Once {
table = output.NewTable()
table.SetTitle("")
table.SetJson([]byte(e.GetJsonData(false)))
table.SetRaw([]byte(e.GetJsonData(true)))
_ = table.SetHeader(
"Date",
"Point Id",
// "Parents",
"Group Name",
"Description",
"Value",
"Unit",
)
data := e.GetData()
var sorted []string
for p := range data.DataPoints {
sorted = append(sorted, string(p))
}
sort.Strings(sorted)
for _, p := range sorted {
entries := data.DataPoints[api.PointId(p)]
for _, de := range entries {
if de.Hide {
continue
}
_ = table.AddRow(
de.Date.Format(api.DtLayout),
// api.NameDevicePointInt(de.Point.Parents, p.PointID.Value()),
// de.Point.Id,
p,
// de.Point.Parents.String(),
de.Point.GroupName,
de.Point.Name,
de.Value,
de.Point.Unit,
)
}
}
// table.InitGraph(output.GraphRequest {
// Title: "",
// TimeColumn: output.SetInteger(1),
// SearchColumn: output.SetInteger(2),
// NameColumn: output.SetInteger(4),
// ValueColumn: output.SetInteger(5),
// UnitsColumn: output.SetInteger(6),
// SearchString: output.SetString(""),
// MinLeftAxis: output.SetFloat(0),
// MaxLeftAxis: output.SetFloat(0),
// })
}
return table
}

View File

@ -1,16 +1,20 @@
package getAllDeviceByPsId
import (
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/output"
"errors"
"fmt"
"github.com/MickMake/GoUnify/Only"
"sort"
)
const Url = "/v1/devService/getAllDeviceByPsId"
const Disabled = true
const Disabled = false
type RequestData struct {
// DeviceType string `json:"device_type" required:"true"`
PsId api.Integer `json:"ps_id" required:"true"`
}
func (rd RequestData) IsValid() error {
@ -56,3 +60,78 @@ func (e *ResultData) IsValid() error {
//
// return err
//}
func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()
for range Only.Once {
// pkg := apiReflect.GetName("", *e)
// for _, d := range e.Response.ResultData {
// name := fmt.Sprintf("findPsType.%s", e.Request.PsId.String())
// entries.StructToPoints(d, name, e.Request.PsId.String(), time.Time{})
// }
}
return entries
}
func (e *EndPoint) GetDataTable() output.Table {
var table output.Table
for range Only.Once {
table = output.NewTable()
table.SetTitle("")
table.SetJson([]byte(e.GetJsonData(false)))
table.SetRaw([]byte(e.GetJsonData(true)))
_ = table.SetHeader(
"Date",
"Point Id",
// "Parents",
"Group Name",
"Description",
"Value",
"Unit",
)
data := e.GetData()
var sorted []string
for p := range data.DataPoints {
sorted = append(sorted, string(p))
}
sort.Strings(sorted)
for _, p := range sorted {
entries := data.DataPoints[api.PointId(p)]
for _, de := range entries {
if de.Hide {
continue
}
_ = table.AddRow(
de.Date.Format(api.DtLayout),
// api.NameDevicePointInt(de.Point.Parents, p.PointID.Value()),
// de.Point.Id,
p,
// de.Point.Parents.String(),
de.Point.GroupName,
de.Point.Name,
de.Value,
de.Point.Unit,
)
}
}
// table.InitGraph(output.GraphRequest {
// Title: "",
// TimeColumn: output.SetInteger(1),
// SearchColumn: output.SetInteger(2),
// NameColumn: output.SetInteger(4),
// ValueColumn: output.SetInteger(5),
// UnitsColumn: output.SetInteger(6),
// SearchString: output.SetString(""),
// MinLeftAxis: output.SetFloat(0),
// MaxLeftAxis: output.SetFloat(0),
// })
}
return table
}

View File

@ -6,6 +6,8 @@ import (
"GoSungrow/iSolarCloud/api/output"
"fmt"
"github.com/MickMake/GoUnify/Only"
"sort"
"time"
)
const Url = "/v1/devService/getDeviceList"
@ -27,7 +29,7 @@ func (rd RequestData) Help() string {
type ResultData struct {
PageList []struct {
AttrID api.Integer `json:"attr_id"`
ChannelId api.Integer `json:"chnnl_id"`
ChannelId api.Integer `json:"chnnl_id" PointId:"channel_id"`
CommandStatus api.Integer `json:"command_status"`
ConnectState api.Integer `json:"connect_state"`
DataFlag api.Integer `json:"data_flag"`
@ -36,7 +38,7 @@ type ResultData struct {
DevStatus string `json:"dev_status"`
DeviceArea string `json:"device_area"`
DeviceCode api.Integer `json:"device_code"`
DeviceFactoryDate interface{} `json:"device_factory_date"`
DeviceFactoryDate api.DateTime `json:"device_factory_date"`
DeviceID api.Integer `json:"device_id"`
DeviceModel api.String `json:"device_model"`
DeviceModelCode api.String `json:"device_model_code"`
@ -67,7 +69,7 @@ type ResultData struct {
PsID api.Integer `json:"ps_id"`
PsKey api.PsKey `json:"ps_key"`
RelState api.Integer `json:"rel_state"`
Sn api.String `json:"sn"`
Sn api.String `json:"sn" PointName:"Serial Number"`
TypeName api.String `json:"type_name"`
UUID api.Integer `json:"uuid"`
} `json:"pageList"`
@ -104,7 +106,48 @@ func (e *ResultData) IsValid() error {
// return err
//}
func (e *EndPoint) GetDataTable() output.Table {
type Device struct {
Vendor api.String
PsId api.Integer
PsKey api.PsKey
DeviceName api.String
DeviceProSn api.String
DeviceModel api.String
DeviceType api.Integer
DeviceCode api.Integer
ChannelId api.Integer
DeviceModelID api.Integer
TypeName api.String
DeviceState string
DevStatus string
Uuid api.Integer
}
type Devices []Device
func (e *EndPoint) GetDevices() Devices {
var ret Devices
for _, d := range e.Response.ResultData.PageList {
ret = append(ret, Device{
Vendor: d.FactoryName,
PsKey: d.PsKey,
PsId: d.PsID,
DeviceType: d.DeviceType,
DeviceCode: d.DeviceCode,
ChannelId: d.ChannelId,
TypeName: d.TypeName,
DeviceProSn: d.DeviceProSn,
DeviceModel: d.DeviceModel,
DeviceModelID: d.DeviceModelID,
DeviceName: d.DeviceName,
DeviceState: d.DeviceState,
DevStatus: d.DevStatus,
Uuid: d.ModuleUUID,
})
}
return ret
}
func (e *EndPoint) GetDevicesTable() output.Table {
var table output.Table
for range Only.Once {
// table = output.NewTable()
@ -146,14 +189,52 @@ func (e *EndPoint) GetDataTable() output.Table {
// }
data := e.GetDevices()
table = GetDataTable(data)
table = GetDevicesTable(data)
}
return table
}
func GetDataTable(data Devices) output.Table {
func GetDevicesTable(data Devices) output.Table {
var table output.Table
for range Only.Once {
// table = output.NewTable()
// table.SetTitle("")
// table.SetJson([]byte(e.GetJsonData(false)))
// table.SetRaw([]byte(e.GetJsonData(true)))
//
// _ = table.SetHeader(
// "Ps Key",
// "Ps Id",
// "Type",
// "Code",
// "Id",
// "Type Name",
// "Serial Number",
// "Model",
// "Model Id",
// "Name",
// "State",
// "Status",
// // "Factory Date",
// )
// for _, d := range e.Response.ResultData.PageList {
// _ = table.AddRow(
// d.PsKey.Value(),
// d.PsID.Value(),
// d.DeviceType.Value(),
// d.DeviceCode.Value(),
// d.ChannelId.Value(),
// d.TypeName.Value(),
// d.DeviceProSn.Value(),
// d.DeviceModel.Value(),
// d.DeviceModelID.Value(),
// d.DeviceName.Value(),
// d.DeviceState,
// d.DevStatus,
// // d.DeviceFactoryDate,
// )
// }
table = output.NewTable()
table.SetTitle("")
// table.SetJson([]byte(e.GetJsonData(false)))
@ -197,43 +278,78 @@ func GetDataTable(data Devices) output.Table {
return table
}
type Device struct {
Vendor api.String
PsId api.Integer
PsKey api.PsKey
DeviceName api.String
DeviceProSn api.String
DeviceModel api.String
DeviceType api.Integer
DeviceCode api.Integer
ChannelId api.Integer
DeviceModelID api.Integer
TypeName api.String
DeviceState string
DevStatus string
Uuid api.Integer
}
type Devices []Device
func (e *EndPoint) GetDevices() Devices {
var ret Devices
for _, d := range e.Response.ResultData.PageList {
ret = append(ret, Device{
Vendor: d.FactoryName,
PsKey: d.PsKey,
PsId: d.PsID,
DeviceType: d.DeviceType,
DeviceCode: d.DeviceCode,
ChannelId: d.ChannelId,
TypeName: d.TypeName,
DeviceProSn: d.DeviceProSn,
DeviceModel: d.DeviceModel,
DeviceModelID: d.DeviceModelID,
DeviceName: d.DeviceName,
DeviceState: d.DeviceState,
DevStatus: d.DevStatus,
Uuid: d.ModuleUUID,
})
func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()
for range Only.Once {
pkg := apiReflect.GetName("", *e)
for _, d := range e.Response.ResultData.PageList {
name := fmt.Sprintf("%s.%s", pkg, d.PsKey.Value())
entries.StructToPoints(d, name, e.Request.PsId.String(), time.Time{})
}
}
return ret
return entries
}
func (e *EndPoint) GetDataTable() output.Table {
var table output.Table
for range Only.Once {
table = output.NewTable()
table.SetTitle("")
table.SetJson([]byte(e.GetJsonData(false)))
table.SetRaw([]byte(e.GetJsonData(true)))
_ = table.SetHeader(
"Date",
"Point Id",
// "Parents",
"Group Name",
"Description",
"Value",
"Unit",
)
data := e.GetData()
var sorted []string
for p := range data.DataPoints {
sorted = append(sorted, string(p))
}
sort.Strings(sorted)
for _, p := range sorted {
entries := data.DataPoints[api.PointId(p)]
for _, de := range entries {
if de.Hide {
continue
}
_ = table.AddRow(
de.Date.Format(api.DtLayout),
// api.NameDevicePointInt(de.Point.Parents, p.PointID.Value()),
// de.Point.Id,
p,
// de.Point.Parents.String(),
de.Point.GroupName,
de.Point.Name,
de.Value,
de.Point.Unit,
)
}
}
// table.InitGraph(output.GraphRequest {
// Title: "",
// TimeColumn: output.SetInteger(1),
// SearchColumn: output.SetInteger(2),
// NameColumn: output.SetInteger(4),
// ValueColumn: output.SetInteger(5),
// UnitsColumn: output.SetInteger(6),
// SearchString: output.SetString(""),
// MinLeftAxis: output.SetFloat(0),
// MaxLeftAxis: output.SetFloat(0),
// })
}
return table
}

View File

@ -3,7 +3,11 @@ package getIncomeSettingInfos
import (
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/output"
"fmt"
"github.com/MickMake/GoUnify/Only"
"sort"
"time"
)
const Url = "/v1/powerStationService/getIncomeSettingInfos"
@ -22,39 +26,38 @@ func (rd RequestData) Help() string {
return ret
}
type ResultData struct {
CodeType api.Integer `json:"code_type"`
type ResultData struct {
CodeType api.Integer `json:"code_type"`
EnvironmentPowerChargeList []interface{} `json:"enviormentPowerChargeList"`
ParamIncomeUnit api.Integer `json:"param_income_unit"`
PowerElectricalChargeMap struct {
CityAllowanceMoney interface{} `json:"city_allowance_money"`
CodeType api.Integer `json:"code_type"`
CountyAllowanceMoney interface{} `json:"county_allowance_money"`
DefaultCharge api.Float `json:"default_charge"`
ElectricChargeID api.Integer `json:"electric_charge_id"`
EndTime string `json:"end_time"`
IncomeStyle interface{} `json:"income_style"`
IntervalTimeCharge interface{} `json:"interval_time_charge"`
NationAllowanceMoney interface{} `json:"nation_allowance_money"`
ParamIncomeUnit api.Integer `json:"param_income_unit"`
ProvinceAllowanceMoney interface{} `json:"province_allowance_money"`
PsID api.Integer `json:"ps_id"`
StartTime string `json:"start_time"`
UseSharpPeekValleyFlat interface{} `json:"use_sharp_peek_valley_flat"`
ValidFlag string `json:"valid_flag"`
ParamIncomeUnit api.Integer `json:"param_income_unit"`
PowerElectricalChargeMap struct {
CityAllowanceMoney interface{} `json:"city_allowance_money"`
CodeType api.Integer `json:"code_type"`
CountyAllowanceMoney interface{} `json:"county_allowance_money"`
DefaultCharge api.Float `json:"default_charge"`
ElectricChargeID api.Integer `json:"electric_charge_id"`
EndTime api.DateTime `json:"end_time"`
IncomeStyle interface{} `json:"income_style"`
IntervalTimeCharge interface{} `json:"interval_time_charge"`
NationAllowanceMoney interface{} `json:"nation_allowance_money"`
ParamIncomeUnit api.Integer `json:"param_income_unit"`
ProvinceAllowanceMoney interface{} `json:"province_allowance_money"`
PsID api.Integer `json:"ps_id"`
StartTime api.DateTime `json:"start_time"`
UseSharpPeekValleyFlat interface{} `json:"use_sharp_peek_valley_flat"`
ValidFlag api.Bool `json:"valid_flag"`
} `json:"powerElectricalChargeMap"`
PowerIntervalTimesChargeMap interface{} `json:"powerIntevalTimesChargeMap"`
PowerSelfUseTimesChargeMap struct {
DefaultCharge api.Float `json:"default_charge"`
EndTime string `json:"end_time"`
IntervalTimeCharge string `json:"interval_time_charge"`
OnlineElectricityPercent string `json:"online_electricity_percent"`
PsID api.Integer `json:"ps_id"`
StartTime string `json:"start_time"`
UseElectricityDiscount string `json:"use_electricity_discount"`
PowerSelfUseTimesChargeMap struct {
DefaultCharge api.Float `json:"default_charge"`
EndTime api.DateTime `json:"end_time"`
IntervalTimeCharge api.String `json:"interval_time_charge"`
OnlineElectricityPercent api.Float `json:"online_electricity_percent"`
PsID api.Integer `json:"ps_id"`
StartTime api.DateTime `json:"start_time"`
UseElectricityDiscount api.Float `json:"use_electricity_discount"`
} `json:"powerSelfUseTimesChargeMap"`
PsID string `json:"ps_id"`
PsID api.Integer `json:"ps_id"`
}
func (e *ResultData) IsValid() error {
@ -86,3 +89,81 @@ func (e *ResultData) IsValid() error {
//
// return err
//}
func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()
for range Only.Once {
pkg := apiReflect.GetName("", *e)
name := fmt.Sprintf("%s.%s", pkg, e.Response.ResultData.PsID.String())
entries.StructToPoints(e.Response.ResultData, name, e.Request.PsId.String(), time.Time{})
// for _, d := range e.Response.ResultData.EnvironmentPowerChargeList {
// name = fmt.Sprintf("getIncomeSettingInfos.%s", e.Response.ResultData.PsID.String())
// entries.StructToPoints(d, name, e.Request.PsId.String(), time.Time{})
// }
}
return entries
}
func (e *EndPoint) GetDataTable() output.Table {
var table output.Table
for range Only.Once {
table = output.NewTable()
table.SetTitle("")
table.SetJson([]byte(e.GetJsonData(false)))
table.SetRaw([]byte(e.GetJsonData(true)))
_ = table.SetHeader(
"Date",
"Point Id",
// "Parents",
"Group Name",
"Description",
"Value",
"Unit",
)
data := e.GetData()
var sorted []string
for p := range data.DataPoints {
sorted = append(sorted, string(p))
}
sort.Strings(sorted)
for _, p := range sorted {
entries := data.DataPoints[api.PointId(p)]
for _, de := range entries {
if de.Hide {
continue
}
_ = table.AddRow(
de.Date.Format(api.DtLayout),
// api.NameDevicePointInt(de.Point.Parents, p.PointID.Value()),
// de.Point.Id,
p,
// de.Point.Parents.String(),
de.Point.GroupName,
de.Point.Name,
de.Value,
de.Point.Unit,
)
}
}
// table.InitGraph(output.GraphRequest {
// Title: "",
// TimeColumn: output.SetInteger(1),
// SearchColumn: output.SetInteger(2),
// NameColumn: output.SetInteger(4),
// ValueColumn: output.SetInteger(5),
// UnitsColumn: output.SetInteger(6),
// SearchString: output.SetString(""),
// MinLeftAxis: output.SetFloat(0),
// MaxLeftAxis: output.SetFloat(0),
// })
}
return table
}

View File

@ -3,8 +3,10 @@ package getKpiInfo
import (
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/output"
"fmt"
"github.com/MickMake/GoUnify/Only"
"sort"
"time"
)
@ -39,7 +41,7 @@ type ResultData struct {
PlanEnergyUnit string `json:"plan_energy_unit"`
PsCount api.Integer `json:"ps_count"`
TodayEnergy api.UnitValue `json:"today_energy"`
TotalCapcity api.UnitValue `json:"total_capcity"`
TotalCapcity api.UnitValue `json:"total_capcity" PointId:"total_capacity"`
TotalDesignCapacity api.UnitValue `json:"total_design_capacity"`
TotalEnergy api.UnitValue `json:"total_energy"`
YearEnergy api.UnitValue `json:"year_energy"`
@ -79,8 +81,70 @@ func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()
for range Only.Once {
entries.StructToPoints(e.Response.ResultData, "getKpiInfo", "PsId", time.Time{})
pkg := apiReflect.GetName("", *e)
entries.StructToPoints(e.Response.ResultData, pkg, "system", time.Time{})
}
return entries
}
func (e *EndPoint) GetDataTable() output.Table {
var table output.Table
for range Only.Once {
table = output.NewTable()
table.SetTitle("")
table.SetJson([]byte(e.GetJsonData(false)))
table.SetRaw([]byte(e.GetJsonData(true)))
_ = table.SetHeader(
"Date",
"Point Id",
// "Parents",
"Group Name",
"Description",
"Value",
"Unit",
)
data := e.GetData()
var sorted []string
for p := range data.DataPoints {
sorted = append(sorted, string(p))
}
sort.Strings(sorted)
for _, p := range sorted {
entries := data.DataPoints[api.PointId(p)]
for _, de := range entries {
if de.Hide {
continue
}
_ = table.AddRow(
de.Date.Format(api.DtLayout),
// api.NameDevicePointInt(de.Point.Parents, p.PointID.Value()),
// de.Point.Id,
p,
// de.Point.Parents.String(),
de.Point.GroupName,
de.Point.Name,
de.Value,
de.Point.Unit,
)
}
}
// table.InitGraph(output.GraphRequest {
// Title: "",
// TimeColumn: output.SetInteger(1),
// SearchColumn: output.SetInteger(2),
// NameColumn: output.SetInteger(4),
// ValueColumn: output.SetInteger(5),
// UnitsColumn: output.SetInteger(6),
// SearchString: output.SetString(""),
// MinLeftAxis: output.SetFloat(0),
// MaxLeftAxis: output.SetFloat(0),
// })
}
return table
}

View File

@ -27,8 +27,8 @@ func (rd RequestData) Help() string {
}
type ResultData struct {
ActualEnergy []string `json:"actual_energy" PointUnitFrom:"actual_energy_unit"`
ActualEnergyUnit api.String `json:"actual_energy_unit" PointId:"actual_energy_unit"`
ActualEnergy []api.Float `json:"actual_energy" PointUnitFrom:"actual_energy_unit"`
ActualEnergyUnit api.String `json:"actual_energy_unit" PointId:"actual_energy_unit"`
AlarmCount api.Integer `json:"alarm_count"`
AreaID interface{} `json:"area_id"`
AreaType api.Integer `json:"area_type"`
@ -39,14 +39,14 @@ type ResultData struct {
CoalReduceTotal api.UnitValue `json:"coal_reduce_total" PointId:"coal_reduce_total" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"`
ConnectGrid string `json:"connect_grid"`
ConnectType api.Integer `json:"connect_type"`
ContactPerson api.String `json:"contact_person"`
ContactPerson api.String `json:"contact_person"`
CurrPower api.UnitValue `json:"curr_power"` // Pv Power
DataLastUpdateTime api.DateTime `json:"data_last_update_time"`
DataLastUpdateTime api.DateTime `json:"data_last_update_time"`
DayEqHours string `json:"day_eq_hours"`
Description interface{} `json:"description"`
DesignCapacity api.UnitValue `json:"design_capacity"`
DesignCapacityBattery api.UnitValue `json:"design_capacity_battery"`
DiagramURL api.String `json:"diagram_url"`
DiagramURL api.String `json:"diagram_url"`
EnergyScheme interface{} `json:"energy_scheme"`
ExpectInstallDate api.DateTime `json:"expect_install_date"`
FaultCount api.Integer `json:"fault_count"`
@ -55,14 +55,14 @@ type ResultData struct {
GcjLongitude api.Float `json:"gcj_longitude"`
GprsLatitude api.Float `json:"gprs_latitude"`
GprsLongitude api.Float `json:"gprs_longitude"`
HasAmmeter api.Bool `json:"has_ammeter"`
HasAmmeter api.Bool `json:"has_ammeter"`
Images []struct {
FileID api.Integer `json:"file_id"`
ID api.Integer `json:"id"`
PicLanguage api.Integer `json:"pic_language"`
PicType api.Integer `json:"pic_type"`
PictureName api.String `json:"picture_name"`
PictureURL api.String `json:"picture_url"`
PictureName api.String `json:"picture_name"`
PictureURL api.String `json:"picture_url"`
PsUnitUUID interface{} `json:"ps_unit_uuid"`
} `json:"images"`
InstallDate api.DateTime `json:"install_date"`
@ -76,34 +76,34 @@ type ResultData struct {
MapLongitude api.Float `json:"map_longitude"`
MeterReduce api.UnitValue `json:"meter_reduce"`
MeterReduceTotal api.UnitValue `json:"meter_reduce_total" PointId:"meter_reduce_total" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"`
MobileTel api.String `json:"mibile_tel" PointId:"mobile_tel"`
MobileTel api.String `json:"mibile_tel" PointId:"mobile_tel"`
MonthPr string `json:"monthPr" PointId:"monthPr" PointValueType:"" PointTimeSpan:"PointTimeSpanMonth"`
MonthEnergy api.UnitValue `json:"month_energy" PointId:"month_energy" PointValueType:"" PointTimeSpan:"PointTimeSpanMonth"`
MonthEnergyVirgin api.UnitValue `json:"month_energy_virgin" PointIgnore:"true"`
MonthEqHours api.Float `json:"month_eq_hours" PointId:"month_eq_hours" PointValueType:"" PointTimeSpan:"PointTimeSpanMonth"`
MonthEqHours api.Float `json:"month_eq_hours" PointId:"month_eq_hours" PointValueType:"" PointTimeSpan:"PointTimeSpanMonth"`
MonthIncome api.UnitValue `json:"month_income" PointId:"month_income" PointValueType:"" PointTimeSpan:"PointTimeSpanMonth"`
NoxReduce api.UnitValue `json:"nox_reduce"`
NoxReduceTotal api.UnitValue `json:"nox_reduce_total" PointId:"nox_reduce_total" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"`
OperateYear string `json:"operate_year"`
OperationBusName api.String `json:"operation_bus_name"`
OperationBusName api.String `json:"operation_bus_name"`
OwnerPsFaultStatus string `json:"owner_ps_fault_status"`
P83012Value api.Float `json:"p83012_value" PointId:"p83012" PointUnitFrom:"p83012_unit"`
P83012Unit api.String `json:"p83012_unit" PointId:"p83012_unit"`
P83013Value api.Float `json:"p83013_value" PointId:"p83013" PointUnitFrom:"p83013_unit"`
P83013Unit api.String `json:"p83013_unit" PointId:"p83013_unit"`
P83036Value api.Float `json:"p83036_value" PointId:"p83036" PointUnitFrom:"p83036_unit"`
P83036Unit api.String `json:"p83036_unit" PointId:"p83036_unit"`
P83016 api.Float `json:"p83016" PointId:"p83016" PointUnitFrom:"p83016_unit"`
P83016Unit api.String `json:"p83016_unit" PointId:"p83016_unit"`
P83017 api.Float `json:"p83017" PointId:"p83017" PointUnitFrom:"p83017_unit"`
P83017Unit api.String `json:"p83017_unit" PointId:"p83017_unit"`
P83023 api.Float `json:"p83023" PointId:"p83023"`
P83012Value api.Float `json:"p83012_value" PointId:"p83012" PointUnitFrom:"p83012_unit"`
P83012Unit api.String `json:"p83012_unit" PointId:"p83012_unit"`
P83013Value api.Float `json:"p83013_value" PointId:"p83013" PointUnitFrom:"p83013_unit"`
P83013Unit api.String `json:"p83013_unit" PointId:"p83013_unit"`
P83036Value api.Float `json:"p83036_value" PointId:"p83036" PointUnitFrom:"p83036_unit"`
P83036Unit api.String `json:"p83036_unit" PointId:"p83036_unit"`
P83016 api.Float `json:"p83016" PointId:"p83016" PointUnitFrom:"p83016_unit"`
P83016Unit api.String `json:"p83016_unit" PointId:"p83016_unit"`
P83017 api.Float `json:"p83017" PointId:"p83017" PointUnitFrom:"p83017_unit"`
P83017Unit api.String `json:"p83017_unit" PointId:"p83017_unit"`
P83023 api.Float `json:"p83023" PointId:"p83023"`
P83023y string `json:"p83023y" PointId:"p83023y"`
P83023year string `json:"p83023year" PointId:"p83023y"`
P83023ym string `json:"p83023ym" PointId:"p83023ym"`
P83043 api.Float `json:"p83043" PointId:"p83043"`
P83044 api.Float `json:"p83044" PointId:"p83044"`
P83045 api.Float `json:"p83045" PointId:"p83045"`
P83043 api.Float `json:"p83043" PointId:"p83043"`
P83044 api.Float `json:"p83044" PointId:"p83044"`
P83045 api.Float `json:"p83045" PointId:"p83045"`
P83072Map api.UnitValue `json:"p83072_map" PointId:"p83072"`
P83072MapVirgin api.UnitValue `json:"p83072_map_virgin" PointIgnore:"true"`
P83073Map api.UnitValue `json:"p83073_map" PointId:"p83073"`
@ -112,9 +112,9 @@ type ResultData struct {
P83074MapVirgin api.UnitValue `json:"p83074_map_virgin" PointIgnore:"true"`
P83075Map api.UnitValue `json:"p83075_map" PointId:"p83075"`
P83075MapVirgin api.UnitValue `json:"p83075_map_virgin" PointIgnore:"true"`
P83076Map api.UnitValue `json:"p83076_map" PointId:"p83076"` // Pv Power
P83076Map api.UnitValue `json:"p83076_map" PointId:"p83076"` // Pv Power
P83076MapVirgin api.UnitValue `json:"p83076_map_virgin" PointIgnore:"true"` // Pv Power
P83077Map api.UnitValue `json:"p83077_map" PointId:"p83077"` // Pv Energy
P83077Map api.UnitValue `json:"p83077_map" PointId:"p83077"` // Pv Energy
P83077MapVirgin api.UnitValue `json:"p83077_map_virgin" PointIgnore:"true"` // Pv Energy
P83078Map api.UnitValue `json:"p83078_map" PointId:"p83078"`
P83078MapVirgin api.UnitValue `json:"p83078_map_virgin" PointIgnore:"true"`
@ -122,14 +122,14 @@ type ResultData struct {
P83079MapVirgin api.UnitValue `json:"p83079_map_virgin" PointIgnore:"true"`
P83080Map api.UnitValue `json:"p83080_map" PointId:"p83080"`
P83080MapVirgin api.UnitValue `json:"p83080_map_virgin" PointIgnore:"true"`
P83088Map api.UnitValue `json:"p83088_map" PointId:"p83088"` // Es Energy
P83088Map api.UnitValue `json:"p83088_map" PointId:"p83088"` // Es Energy
P83088MapVirgin api.UnitValue `json:"p83088_map_virgin" PointIgnore:"true"` // Es Energy
P83089Map api.UnitValue `json:"p83089_map" PointId:"p83089"` // Es Discharge Energy
P83089Map api.UnitValue `json:"p83089_map" PointId:"p83089"` // Es Discharge Energy
P83089MapVirgin api.UnitValue `json:"p83089_map_virgin" PointIgnore:"true"` // Es Discharge Energy
P83094Map api.UnitValue `json:"p83094_map" PointId:"p83094"`
P83094MapVirgin api.UnitValue `json:"p83094_map_virgin" PointIgnore:"true"`
P83095Map api.UnitValue `json:"p83095_map" PointId:"p83095" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` // Es Total Discharge Energy
P83095MapVirgin api.UnitValue `json:"p83095_map_virgin" PointIgnore:"true"` // Es Total Discharge Energy
P83095Map api.UnitValue `json:"p83095_map" PointId:"p83095" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` // Es Total Discharge Energy
P83095MapVirgin api.UnitValue `json:"p83095_map_virgin" PointIgnore:"true"` // Es Total Discharge Energy
P83097Map api.UnitValue `json:"p83097_map" PointId:"p83097"`
P83097MapVirgin api.UnitValue `json:"p83097_map_virgin" PointIgnore:"true"`
P83100Map api.UnitValue `json:"p83100_map" PointId:"p83100"`
@ -138,7 +138,7 @@ type ResultData struct {
P83101MapVirgin api.UnitValue `json:"p83101_map_virgin" PointIgnore:"true"`
P83102Map api.UnitValue `json:"p83102_map" PointId:"p83102"`
P83102MapVirgin api.UnitValue `json:"p83102_map_virgin" PointIgnore:"true"`
P83102Percent api.Float `json:"p83102_percent" PointId:"p83102"`
P83102Percent api.Float `json:"p83102_percent" PointId:"p83102"`
P83105Map api.UnitValue `json:"p83105_map" PointId:"p83105"`
P83105MapVirgin api.UnitValue `json:"p83105_map_virgin" PointIgnore:"true"`
P83106Map api.UnitValue `json:"p83106_map" PointId:"p83106"`
@ -151,64 +151,64 @@ type ResultData struct {
P83119MapVirgin api.UnitValue `json:"p83119_map_virgin" PointIgnore:"true"`
P83120Map api.UnitValue `json:"p83120_map" PointId:"p83120"`
P83120MapVirgin api.UnitValue `json:"p83120_map_virgin" PointIgnore:"true"`
P83121 api.Float `json:"p83121" PointId:"p83121"`
P83122 api.Float `json:"p83122" PointId:"p83122"`
P83121 api.Float `json:"p83121" PointId:"p83121"`
P83122 api.Float `json:"p83122" PointId:"p83122"`
P83123Map api.UnitValue `json:"p83123_map" PointId:"p83123"`
P83123MapVirgin api.UnitValue `json:"p83123_map_virgin" PointIgnore:"true"`
P83124Map api.UnitValue `json:"p83124_map" PointId:"p83124"`
P83124MapVirgin api.UnitValue `json:"p83124_map_virgin" PointIgnore:"true"`
P83125 api.Float `json:"p83125" PointId:"p83125"`
P83126 api.Float `json:"p83126" PointId:"p83126"`
P83125 api.Float `json:"p83125" PointId:"p83125"`
P83126 api.Float `json:"p83126" PointId:"p83126"`
P83128MapVirgin api.UnitValue `json:"p83128_map_virgin" PointIgnore:"true"`
P83202Map api.UnitValue `json:"p83202_map" PointId:"p83202"`
P83202MapVirgin api.UnitValue `json:"p83202_map_virgin" PointIgnore:"true"`
PercentPlanYear api.Float `json:"percent_plan_year"`
PlanEnergy []string `json:"plan_energy" PointUnitFrom:"plan_energy_unit"`
PlanEnergyUnit api.String `json:"plan_energy_unit" PointId:"plan_energy_unit"`
PlanEnergy []api.Float `json:"plan_energy" PointUnitFrom:"plan_energy_unit"`
PlanEnergyUnit api.String `json:"plan_energy_unit" PointId:"plan_energy_unit"`
PlanEnergyYear api.UnitValue `json:"plan_energy_year"`
PowderReduce api.UnitValue `json:"powder_reduce"`
PowderReduceTotal api.UnitValue `json:"powder_reduce_total" PointId:"powder_reduce_total" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"`
PowerChargeSetted api.Bool `json:"power_charge_setted" PointId:"power_charge_setted" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"`
PowerChargeSetted api.Bool `json:"power_charge_setted" PointId:"power_charge_setted" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"`
Producer string `json:"producer"`
PsCountryID api.Integer `json:"ps_country_id"`
PsFaultStatus string `json:"ps_fault_status"`
PsHealthStatus string `json:"ps_health_status"`
PsHolder api.String `json:"ps_holder"`
PsLocation api.String `json:"ps_location"`
PsName api.String `json:"ps_name"`
PsShortName api.String `json:"ps_short_name"`
PsHolder api.String `json:"ps_holder"`
PsLocation api.String `json:"ps_location"`
PsName api.String `json:"ps_name"`
PsShortName api.String `json:"ps_short_name"`
PsState string `json:"ps_state"`
PsType api.Integer `json:"ps_type"`
PsTypeName api.String `json:"ps_type_name"`
PsTypeName api.String `json:"ps_type_name"`
PsWindLevel string `json:"ps_wind_level"`
PsWindPos string `json:"ps_wind_pos"`
RecordCreateTime api.DateTime `json:"recore_create_time"`
RecordCreateTime api.DateTime `json:"recore_create_time"`
ReportType string `json:"report_type"`
RobotNumSweepCapacity struct {
Num api.Integer `json:"num"`
SweepCapacity api.Float `json:"sweep_capacity"`
Num api.Integer `json:"num"`
SweepCapacity api.Float `json:"sweep_capacity"`
} `json:"robot_num_sweep_capacity"`
SafeStartDate api.DateTime `json:"safe_start_date"`
SelfConsumptionOffsetReminder api.Integer `json:"self_consumption_offset_reminder"`
ShippingAddress api.String `json:"shipping_address"`
ShippingZipCode api.String `json:"shipping_zip_code"`
ShippingAddress api.String `json:"shipping_address"`
ShippingZipCode api.String `json:"shipping_zip_code"`
So2Reduce api.UnitValue `json:"so2_reduce"`
So2ReduceTotal api.UnitValue `json:"so2_reduce_total" PointId:"so2_reduce_total" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"`
StorageInverterData []struct {
CommunicationDevSn api.String `json:"communication_dev_sn"`
CommunicationDevSn api.String `json:"communication_dev_sn"`
DevFaultStatus api.Integer `json:"dev_fault_status"`
DevStatus api.Integer `json:"dev_status"`
DeviceCode api.Integer `json:"device_code"`
DeviceModelCode api.String `json:"device_model_code"`
DeviceName api.String `json:"device_name"`
DeviceModelCode api.String `json:"device_model_code"`
DeviceName api.String `json:"device_name"`
DeviceState string `json:"device_state"`
DeviceType api.Integer `json:"device_type"`
DrmStatus api.Integer `json:"drm_status"`
DrmStatusName api.String `json:"drm_status_name"`
EnergyFlow []string `json:"energy_flow"`
HasAmmeter api.Integer `json:"has_ammeter"`
DrmStatus api.Integer `json:"drm_status"`
DrmStatusName api.String `json:"drm_status_name"`
EnergyFlow []api.Integer `json:"energy_flow"`
HasAmmeter api.Bool `json:"has_ammeter"`
InstallerDevFaultStatus api.Integer `json:"installer_dev_fault_status"`
InverterSn api.String `json:"inverter_sn"`
InverterSn api.String `json:"inverter_sn"`
OwnerDevFaultStatus api.Integer `json:"owner_dev_fault_status"`
P13003Map api.UnitValue `json:"p13003_map" PointId:"p13003" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"`
P13003MapVirgin api.UnitValue `json:"p13003_map_virgin" PointIgnore:"true"`
@ -222,20 +222,20 @@ type ResultData struct {
P13121MapVirgin api.UnitValue `json:"p13121_map_virgin" PointIgnore:"true"`
P13126Map api.UnitValue `json:"p13126_map" PointId:"p13126" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"`
P13126MapVirgin api.UnitValue `json:"p13126_map_virgin" PointIgnore:"true"`
P13141 api.Float `json:"p13141" PointId:"p13141" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"`
P13142 api.Float `json:"p13142" PointId:"p13142" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"`
P13141 api.Float `json:"p13141" PointId:"p13141" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"`
P13142 api.Float `json:"p13142" PointId:"p13142" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"`
P13149Map api.UnitValue `json:"p13149_map" PointId:"p13149" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"`
P13149MapVirgin api.UnitValue `json:"p13149_map_virgin" PointIgnore:"true"`
P13150Map api.UnitValue `json:"p13150_map" PointId:"p13150" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"`
P13150MapVirgin api.UnitValue `json:"p13150_map_virgin" PointIgnore:"true"`
P13155 api.Float `json:"p13155" PointId:"p13155" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"`
PsKey api.PsKey `json:"ps_key"`
UpdateTime api.DateTime `json:"update_time"`
P13155 api.Float `json:"p13155" PointId:"p13155" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"`
PsKey api.PsKey `json:"ps_key"`
UpdateTime api.DateTime `json:"update_time"`
UUID api.Integer `json:"uuid"`
} `json:"storage_inverter_data"`
SysScheme api.Integer `json:"sys_scheme"`
TimeZoneID api.Integer `json:"time_zone_id"`
Timezone api.String `json:"timezone"`
Timezone api.String `json:"timezone"`
TodayEnergy api.UnitValue `json:"today_energy" PointId:"today_energy" PointValueType:"" PointTimeSpan:"PointTimeSpanDaily"`
TodayEnergyVirgin api.UnitValue `json:"today_energy_virgin" PointIgnore:"true"`
TodayIncome api.UnitValue `json:"today_income" PointId:"today_income" PointValueType:"" PointTimeSpan:"PointTimeSpanDaily"`
@ -246,16 +246,16 @@ type ResultData struct {
TreeReduce api.UnitValue `json:"tree_reduce"`
TreeReduceTotal api.UnitValue `json:"tree_reduce_total" PointId:"tree_reduce_total" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"`
TuvLevel string `json:"tuv_level"`
ValidFlag api.Bool `json:"valid_flag"`
ValidFlag api.Bool `json:"valid_flag"`
WaitAssignOrderCount api.Integer `json:"wait_assign_order_count"`
WaterReduce api.UnitValue `json:"water_reduce"`
WaterReduceTotal api.UnitValue `json:"water_reduce_total" PointId:"water_reduce_total" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"`
WgsLatitude api.Float `json:"wgs_latitude"`
WgsLongitude api.Float `json:"wgs_longitude"`
Year api.Integer `json:"year"`
Year api.Integer `json:"year"`
ZfzyMap api.UnitValue `json:"zfzy_map"`
ZfzyMapVirgin api.UnitValue `json:"zfzy_map_virgin" PointIgnore:"true"`
ZipCode api.String `json:"zip_code"`
ZipCode api.String `json:"zip_code"`
ZjzzMap api.UnitValue `json:"zjzz_map"`
ZjzzMapVirgin api.UnitValue `json:"zjzz_map_virgin" PointIgnore:"true"`
}
@ -291,6 +291,48 @@ func (e *ResultData) IsValid() error {
// }
func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()
for range Only.Once {
pkg := apiReflect.GetName("", *e)
name := fmt.Sprintf("%s.%s", pkg, e.Request.PsId.String())
entries.StructToPoints(e.Response.ResultData, name, e.Request.PsId.String(), time.Time{})
for _, sid := range e.Response.ResultData.StorageInverterData {
name = fmt.Sprintf("%s.%s", pkg, sid.PsKey.Value())
entries.StructToPoints(sid, name, sid.PsKey.Value(), time.Time{})
}
}
// for range Only.Once {
// // name := fmt.Sprintf("getPsDetail.%s", e.Request.PsId.String())
// //
// // uv := api.SetUnitValueFloat(e.Response.ResultData.P83012Value.Value(), e.Response.ResultData.P83012Unit.Value())
// // entries.AddUnitValue(name + ".p83012", e.Request.PsId.String(), "p83012", "", "", api.NewDateTime(""), uv)
// //
// // uv = api.SetUnitValueFloat(e.Response.ResultData.P83013Value.Value(), e.Response.ResultData.P83013Unit.Value())
// // entries.AddUnitValue(name + ".p83013", e.Request.PsId.String(), "p83013", "", "", api.NewDateTime(""), uv)
// //
// // uv = api.SetUnitValueFloat(e.Response.ResultData.P83036Value.Value(), e.Response.ResultData.P83036Unit.Value())
// // entries.AddUnitValue(name + ".p83036", e.Request.PsId.String(), "p83036", "", "", api.NewDateTime(""), uv)
// //
// // uv = api.SetUnitValueFloat(e.Response.ResultData.P83016.Value(), e.Response.ResultData.P83016Unit.Value())
// // entries.AddUnitValue(name + ".p83016", e.Request.PsId.String(), "p83016", "", "", api.NewDateTime(""), uv)
// //
// // uv = api.SetUnitValueFloat(e.Response.ResultData.P83017.Value(), e.Response.ResultData.P83017Unit.Value())
// // entries.AddUnitValue(name + ".p83017", e.Request.PsId.String(), "p83017", "", "", api.NewDateTime(""), uv)
// //
// // entries.StructToPoints(e.Response.ResultData, name, e.Request.PsId.String(), time.Time{})
// //
// // for _, sid := range e.Response.ResultData.StorageInverterData {
// // entries.StructToPoints(sid, name + ".StorageInverterData." + sid.PsKey.Value(), sid.PsKey.Value(), time.Time{})
// // }
// }
return entries
}
func (e *EndPoint) GetDataTable() output.Table {
var table output.Table
@ -340,44 +382,3 @@ func (e *EndPoint) GetDataTable() output.Table {
return table
}
func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()
for range Only.Once {
name := fmt.Sprintf("getPsDetail.%s", e.Request.PsId.String())
entries.StructToPoints(e.Response.ResultData, name, e.Request.PsId.String(), time.Time{})
for _, sid := range e.Response.ResultData.StorageInverterData {
name = fmt.Sprintf("getPsDetail.%s", sid.PsKey.Value())
entries.StructToPoints(sid, name, sid.PsKey.Value(), time.Time{})
}
}
// for range Only.Once {
// // name := fmt.Sprintf("getPsDetail.%s", e.Request.PsId.String())
// //
// // uv := api.SetUnitValueFloat(e.Response.ResultData.P83012Value.Value(), e.Response.ResultData.P83012Unit.Value())
// // entries.AddUnitValue(name + ".p83012", e.Request.PsId.String(), "p83012", "", "", api.NewDateTime(""), uv)
// //
// // uv = api.SetUnitValueFloat(e.Response.ResultData.P83013Value.Value(), e.Response.ResultData.P83013Unit.Value())
// // entries.AddUnitValue(name + ".p83013", e.Request.PsId.String(), "p83013", "", "", api.NewDateTime(""), uv)
// //
// // uv = api.SetUnitValueFloat(e.Response.ResultData.P83036Value.Value(), e.Response.ResultData.P83036Unit.Value())
// // entries.AddUnitValue(name + ".p83036", e.Request.PsId.String(), "p83036", "", "", api.NewDateTime(""), uv)
// //
// // uv = api.SetUnitValueFloat(e.Response.ResultData.P83016.Value(), e.Response.ResultData.P83016Unit.Value())
// // entries.AddUnitValue(name + ".p83016", e.Request.PsId.String(), "p83016", "", "", api.NewDateTime(""), uv)
// //
// // uv = api.SetUnitValueFloat(e.Response.ResultData.P83017.Value(), e.Response.ResultData.P83017Unit.Value())
// // entries.AddUnitValue(name + ".p83017", e.Request.PsId.String(), "p83017", "", "", api.NewDateTime(""), uv)
// //
// // entries.StructToPoints(e.Response.ResultData, name, e.Request.PsId.String(), time.Time{})
// //
// // for _, sid := range e.Response.ResultData.StorageInverterData {
// // entries.StructToPoints(sid, name + ".StorageInverterData." + sid.PsKey.Value(), sid.PsKey.Value(), time.Time{})
// // }
// }
return entries
}

View File

@ -103,7 +103,7 @@ type ResultData struct {
DeviceType api.Integer `json:"device_type" PointId:"DeviceType" PointTimeSpan:"PointTimeSpanBoot"`
DrmStatus api.Integer `json:"drm_status" PointId:"DrmStatus" PointTimeSpan:"PointTimeSpanBoot"`
DrmStatusName api.String `json:"drm_status_name" PointId:"DrmStatusName" PointTimeSpan:"PointTimeSpanBoot"`
EnergyFlow []string `json:"energy_flow"`
EnergyFlow []api.Integer `json:"energy_flow"`
HasAmmeter api.Bool `json:"has_ammeter" PointId:"HasAmmeter" PointTimeSpan:"PointTimeSpanBoot"`
InstallerDevFaultStatus api.Integer `json:"installer_dev_fault_status" PointId:"InstallerDevFaultStatus" PointTimeSpan:"PointTimeSpanBoot"`
InverterSn api.String `json:"inverter_sn" PointId:"InverterSn" PointTimeSpan:"PointTimeSpanBoot"`
@ -170,6 +170,10 @@ func (e *ResultData) IsValid() error {
// return err
//}
func (e *EndPoint) GetData() api.DataMap {
return e.Response.ResultData.GetData()
}
func (e *EndPoint) GetDataTable() output.Table {
var table output.Table
@ -303,15 +307,16 @@ func (e *EndPoint) GetDataTable() output.Table {
return table
}
func (e *EndPoint) GetData() api.DataMap {
func (e *ResultData) GetData() api.DataMap {
entries := api.NewDataMap()
for range Only.Once {
name := fmt.Sprintf("getPsDetailWithPsType.%s", e.Response.ResultData.PsPsKey.Value())
entries.StructToPoints(e.Response.ResultData, name, e.Response.ResultData.PsPsKey.Value(), time.Time{})
pkg := apiReflect.GetName("", *e)
name := fmt.Sprintf("%s.%s", pkg, e.PsPsKey.Value())
entries.StructToPoints(*e, name, e.PsPsKey.Value(), time.Time{})
for _, sid := range e.Response.ResultData.StorageInverterData {
name = fmt.Sprintf("getPsDetailWithPsType.%s", sid.PsKey.Value())
for _, sid := range e.StorageInverterData {
name = fmt.Sprintf("%s.%s", pkg, sid.PsKey.Value())
entries.StructToPoints(sid, name, sid.PsKey.Value(), time.Time{})
}
}

View File

@ -281,7 +281,7 @@ func (e *ResultData) GetData() api.DataMap {
for _, p := range e.PageList {
psId := p.PsID.String() // psId := strconv.FormatInt(p.PsID.Value(), 10)
name := "getPsList." + psId
name := apiReflect.GetName("", *e) + "." + psId
entries.StructToPoints(p, name, psId, time.Time{})
}
}

View File

@ -28,10 +28,10 @@ func (rd RequestData) Help() string {
type ResultData struct {
DevCountByStatusMap struct {
FaultCount api.Count `json:"fault_count" PointId:"fault_count" PointValueType:"" PointTimeSpan:""`
OfflineCount api.Count `json:"offline_count" PointId:"offline_count" PointValueType:"" PointTimeSpan:""`
RunCount api.Count `json:"run_count" PointId:"run_count" PointValueType:"" PointTimeSpan:""`
WarningCount api.Count `json:"warning_count" PointId:"warning_count" PointValueType:"" PointTimeSpan:""`
FaultCount api.Count `json:"fault_count" PointId:"fault_count"`
OfflineCount api.Count `json:"offline_count" PointId:"offline_count"`
RunCount api.Count `json:"run_count" PointId:"run_count"`
WarningCount api.Count `json:"warning_count" PointId:"warning_count"`
} `json:"dev_count_by_status_map"`
DevCountByTypeMap map[string]api.Integer `json:"dev_count_by_type_map"`
// DevCountByTypeMap struct {
@ -90,52 +90,52 @@ type ResultData struct {
// Nine9 string `json:"99"`
// } `json:"dev_type_definition"`
PageList []struct {
AlarmCount api.Count `json:"alarm_count" PointId:"alarm_count" PointValueType:"" PointTimeSpan:""`
ChannelId api.Integer `json:"chnnl_id" PointId:"channel_id" PointValueType:"" PointTimeSpan:""`
CommandStatus api.Integer `json:"command_status" PointId:"command_status" PointValueType:"" PointTimeSpan:""`
ComponentAmount api.Integer `json:"component_amount" PointId:"component_amount" PointValueType:"" PointTimeSpan:""`
DataFlag api.Integer `json:"data_flag" PointId:"data_flag" PointValueType:"" PointTimeSpan:""`
DataFlagDetail api.Integer `json:"data_flag_detail" PointId:"data_flag_detail" PointValueType:"" PointTimeSpan:""`
DeviceArea api.Integer `json:"device_area" PointId:"device_area" PointValueType:"" PointTimeSpan:""`
DeviceAreaName api.String `json:"device_area_name" PointId:"device_area_name" PointValueType:"" PointTimeSpan:""`
DeviceCode api.Integer `json:"device_code" PointId:"device_code" PointValueType:"" PointTimeSpan:""`
DeviceID api.Integer `json:"device_id" PointId:"device_id" PointValueType:"" PointTimeSpan:""`
DeviceModelCode api.String `json:"device_model_code" PointId:"device_model_code" PointValueType:"" PointTimeSpan:""`
DeviceModelID api.Integer `json:"device_model_id" PointId:"device_model_id" PointValueType:"" PointTimeSpan:""`
DeviceName api.String `json:"device_name" PointId:"device_name" PointValueType:"" PointTimeSpan:""`
DeviceStatus api.Bool `json:"device_status" PointId:"device_status" PointValueType:"" PointTimeSpan:""`
DeviceType api.Integer `json:"device_type" PointId:"device_type" PointValueType:"" PointTimeSpan:""`
FaultCount api.Count `json:"fault_count" PointId:"fault_count" PointValueType:"" PointTimeSpan:""`
FaultStatus string `json:"fault_status" PointId:"fault_status" PointValueType:"" PointTimeSpan:""`
FunctionEnum api.String `json:"function_enum" PointId:"function_enum" PointValueType:"" PointTimeSpan:""`
InstallerAlarmCount api.Count `json:"installer_alarm_count" PointId:"installer_alarm_count" PointValueType:"" PointTimeSpan:""`
InstallerDevFaultStatus api.Integer `json:"installer_dev_fault_status" PointId:"installer_dev_fault_status" PointValueType:"" PointTimeSpan:""`
InstallerFaultCount api.Count `json:"installer_fault_count" PointId:"installer_fault_count" PointValueType:"" PointTimeSpan:""`
InverterModelType api.Integer `json:"inverter_model_type" PointId:"inverter_model_type" PointValueType:"" PointTimeSpan:""`
IsDeveloper api.Bool `json:"is_developer" PointId:"is_developer" PointValueType:"" PointTimeSpan:""`
IsG2point5Module api.Bool `json:"is_g2point5_module" PointId:"is_g2point5_module" PointValueType:"" PointTimeSpan:""`
IsInit api.Bool `json:"is_init" PointId:"is_init" PointValueType:"" PointTimeSpan:""`
IsSecond api.Bool `json:"is_second" PointId:"is_second" PointValueType:"" PointTimeSpan:""`
IsSupportParamset api.Bool `json:"is_support_paramset" PointId:"is_support_paramset" PointValueType:"" PointTimeSpan:""`
NodeTimestamps interface{} `json:"node_timestamps" PointId:"node_timestamps" PointValueType:"" PointTimeSpan:""`
OwnerAlarmCount api.Count `json:"owner_alarm_count" PointId:"owner_alarm_count" PointValueType:"" PointTimeSpan:""`
OwnerDevFaultStatus api.Integer `json:"owner_dev_fault_status" PointId:"owner_dev_fault_status" PointValueType:"" PointTimeSpan:""`
OwnerFaultCount api.Count `json:"owner_fault_count" PointId:"owner_fault_count" PointValueType:"" PointTimeSpan:""`
AlarmCount api.Count `json:"alarm_count" PointId:"alarm_count"`
ChannelId api.Integer `json:"chnnl_id" PointId:"channel_id"`
CommandStatus api.Integer `json:"command_status" PointId:"command_status"`
ComponentAmount api.Integer `json:"component_amount" PointId:"component_amount"`
DataFlag api.Integer `json:"data_flag" PointId:"data_flag"`
DataFlagDetail api.Integer `json:"data_flag_detail" PointId:"data_flag_detail"`
DeviceArea api.Integer `json:"device_area" PointId:"device_area"`
DeviceAreaName api.String `json:"device_area_name" PointId:"device_area_name"`
DeviceCode api.Integer `json:"device_code" PointId:"device_code"`
DeviceID api.Integer `json:"device_id" PointId:"device_id"`
DeviceModelCode api.String `json:"device_model_code" PointId:"device_model_code"`
DeviceModelID api.Integer `json:"device_model_id" PointId:"device_model_id"`
DeviceName api.String `json:"device_name" PointId:"device_name"`
DeviceStatus api.Bool `json:"device_status" PointId:"device_status"`
DeviceType api.Integer `json:"device_type" PointId:"device_type"`
FaultCount api.Count `json:"fault_count" PointId:"fault_count"`
FaultStatus string `json:"fault_status" PointId:"fault_status"`
FunctionEnum api.String `json:"function_enum" PointId:"function_enum"`
InstallerAlarmCount api.Count `json:"installer_alarm_count" PointId:"installer_alarm_count"`
InstallerDevFaultStatus api.Integer `json:"installer_dev_fault_status" PointId:"installer_dev_fault_status"`
InstallerFaultCount api.Count `json:"installer_fault_count" PointId:"installer_fault_count"`
InverterModelType api.Integer `json:"inverter_model_type" PointId:"inverter_model_type"`
IsDeveloper api.Bool `json:"is_developer" PointId:"is_developer"`
IsG2point5Module api.Bool `json:"is_g2point5_module" PointId:"is_g2point5_module"`
IsInit api.Bool `json:"is_init" PointId:"is_init"`
IsSecond api.Bool `json:"is_second" PointId:"is_second"`
IsSupportParamset api.Bool `json:"is_support_paramset" PointId:"is_support_paramset"`
NodeTimestamps interface{} `json:"node_timestamps" PointId:"node_timestamps"`
OwnerAlarmCount api.Count `json:"owner_alarm_count" PointId:"owner_alarm_count"`
OwnerDevFaultStatus api.Integer `json:"owner_dev_fault_status" PointId:"owner_dev_fault_status"`
OwnerFaultCount api.Count `json:"owner_fault_count" PointId:"owner_fault_count"`
PointData PointData `json:"point_data"`
Points interface{} `json:"points" PointId:"points" PointValueType:"" PointTimeSpan:""`
Points interface{} `json:"points" PointId:"points"`
PsTimezoneInfo struct {
IsDst api.Bool `json:"is_dst"`
TimeZone api.String `json:"time_zone"`
} `json:"psTimezoneInfo"`
PsID api.Integer `json:"ps_id" PointId:"ps_id" PointValueType:"" PointTimeSpan:""`
PsKey api.PsKey `json:"ps_key" PointId:"ps_key" PointValueType:"" PointTimeSpan:""`
RelState api.Integer `json:"rel_state" PointId:"rel_state" PointValueType:"" PointTimeSpan:""`
Sn api.String `json:"sn" PointId:"sn" PointValueType:"" PointTimeSpan:""`
StringAmount api.Integer `json:"string_amount" PointId:"string_amount" PointValueType:"" PointTimeSpan:""`
TypeName api.String `json:"type_name" PointId:"type_name" PointValueType:"" PointTimeSpan:""`
UnitName api.String `json:"unit_name" PointId:"unit_name" PointValueType:"" PointTimeSpan:""`
UUID api.Integer `json:"uuid" PointId:"uuid" PointValueType:"" PointTimeSpan:""`
UUIDIndexCode api.String `json:"uuid_index_code" PointId:"uuid_index_code" PointValueType:"" PointTimeSpan:""`
PsID api.Integer `json:"ps_id" PointId:"ps_id"`
PsKey api.PsKey `json:"ps_key" PointId:"ps_key"`
RelState api.Integer `json:"rel_state" PointId:"rel_state"`
Sn api.String `json:"sn" PointId:"sn"`
StringAmount api.Integer `json:"string_amount" PointId:"string_amount"`
TypeName api.String `json:"type_name" PointId:"type_name"`
UnitName api.String `json:"unit_name" PointId:"unit_name"`
UUID api.Integer `json:"uuid" PointId:"uuid"`
UUIDIndexCode api.String `json:"uuid_index_code" PointId:"uuid_index_code"`
} `json:"pageList"`
RowCount api.Integer `json:"rowCount"`
}
@ -165,12 +165,6 @@ type PointStruct struct {
ValueDescription api.String `json:"value_description"`
}
// type VirtualPointStruct struct {
// api.DataEntry
// ValueFloat api.Float
// }
func (e *ResultData) IsValid() error {
var err error
// switch {
@ -219,83 +213,6 @@ func (e *ResultData) GetDataByName(name string) PointData {
return ret
}
func (e *EndPoint) GetDataTable() output.Table {
var table output.Table
for range Only.Once {
table = output.NewTable()
table.SetTitle("")
table.SetJson([]byte(e.GetJsonData(false)))
table.SetRaw([]byte(e.GetJsonData(true)))
_ = table.SetHeader(
"Date",
"Point Id",
// "Parents",
"Group Name",
"Description",
"Value",
"Unit",
)
data := e.GetData()
var sorted []string
for p := range data.DataPoints {
sorted = append(sorted, string(p))
}
sort.Strings(sorted)
for _, p := range sorted {
entries := data.DataPoints[api.PointId(p)]
for _, de := range entries {
if de.Hide {
continue
}
_ = table.AddRow(
de.Date.Format(api.DtLayout),
// api.NameDevicePointInt(de.Point.Parents, p.PointID.Value()),
// de.Point.Id,
p,
// de.Point.Parents.String(),
de.Point.GroupName,
de.Point.Name,
de.Value,
de.Point.Unit,
)
}
}
// for _, d := range e.Response.ResultData.PageList {
// for _, p := range d.PointData {
// // p.Value, p.Unit = api.DivideByThousandIfRequired(p.Value, p.Unit)
// uv := api.SetUnitValueFloat(p.Value.Value(), p.Unit)
// _ = table.AddRow(
// api.NewDateTime(p.TimeStamp).PrintFull(),
// api.NameDevicePointInt(d.PsKey, p.PointID.Value()),
// p.PointGroupName,
// p.PointName,
// uv.Value(),
// uv.Unit(),
// )
// }
// }
table.InitGraph(output.GraphRequest {
Title: "",
TimeColumn: output.SetInteger(1),
SearchColumn: output.SetInteger(2),
NameColumn: output.SetInteger(4),
ValueColumn: output.SetInteger(5),
UnitsColumn: output.SetInteger(6),
SearchString: output.SetString(""),
MinLeftAxis: output.SetFloat(0),
MaxLeftAxis: output.SetFloat(0),
})
}
return table
}
func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()
@ -338,11 +255,12 @@ func (e *EndPoint) GetData() api.DataMap {
//
// var TotalEnergyConsumption VirtualPointStruct
name1 := "queryDeviceList." + e.Request.PsId.String()
pkg := apiReflect.GetName("", *e)
name1 := pkg + "." + e.Request.PsId.String()
entries.StructToPoints(e.Response.ResultData.DevCountByStatusMap, name1 + ".status", e.Request.PsId.String(), time.Time{})
for _, d := range e.Response.ResultData.PageList {
name2 := fmt.Sprintf("queryDeviceList.%s", d.PsKey.Value())
name2 := fmt.Sprintf("%s.%s", pkg, d.PsKey.Value())
entries.StructToPoints(d, name2, d.PsKey.Value(), time.Time{})
// entries.StructToPoints(d.PsTimezoneInfo, name2 + "PsTimezoneInfo", d.PsKey.Value(), time.Time{})
@ -562,3 +480,80 @@ func (e *EndPoint) GetData() api.DataMap {
return entries
}
func (e *EndPoint) GetDataTable() output.Table {
var table output.Table
for range Only.Once {
table = output.NewTable()
table.SetTitle("")
table.SetJson([]byte(e.GetJsonData(false)))
table.SetRaw([]byte(e.GetJsonData(true)))
_ = table.SetHeader(
"Date",
"Point Id",
// "Parents",
"Group Name",
"Description",
"Value",
"Unit",
)
data := e.GetData()
var sorted []string
for p := range data.DataPoints {
sorted = append(sorted, string(p))
}
sort.Strings(sorted)
for _, p := range sorted {
entries := data.DataPoints[api.PointId(p)]
for _, de := range entries {
if de.Hide {
continue
}
_ = table.AddRow(
de.Date.Format(api.DtLayout),
// api.NameDevicePointInt(de.Point.Parents, p.PointID.Value()),
// de.Point.Id,
p,
// de.Point.Parents.String(),
de.Point.GroupName,
de.Point.Name,
de.Value,
de.Point.Unit,
)
}
}
// for _, d := range e.Response.ResultData.PageList {
// for _, p := range d.PointData {
// // p.Value, p.Unit = api.DivideByThousandIfRequired(p.Value, p.Unit)
// uv := api.SetUnitValueFloat(p.Value.Value(), p.Unit)
// _ = table.AddRow(
// api.NewDateTime(p.TimeStamp).PrintFull(),
// api.NameDevicePointInt(d.PsKey, p.PointID.Value()),
// p.PointGroupName,
// p.PointName,
// uv.Value(),
// uv.Unit(),
// )
// }
// }
table.InitGraph(output.GraphRequest {
Title: "",
TimeColumn: output.SetInteger(1),
SearchColumn: output.SetInteger(2),
NameColumn: output.SetInteger(4),
ValueColumn: output.SetInteger(5),
UnitsColumn: output.SetInteger(6),
SearchString: output.SetString(""),
MinLeftAxis: output.SetFloat(0),
MaxLeftAxis: output.SetFloat(0),
})
}
return table
}

View File

@ -3,7 +3,12 @@ package queryDeviceListForApp
import (
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/output"
"fmt"
"github.com/MickMake/GoUnify/Only"
"sort"
"strings"
"time"
)
const Url = "/v1/devService/queryDeviceListForApp"
@ -25,7 +30,7 @@ func (rd RequestData) Help() string {
type ResultData struct {
PageList []struct {
AttrID api.Integer `json:"attr_id"`
ChannelId api.Integer `json:"chnnl_id"`
ChannelId api.Integer `json:"chnnl_id" PointId:"channel_id"`
CommandStatus api.Integer `json:"command_status"`
ConnectState api.Integer `json:"connect_state"`
DataFlag api.Integer `json:"data_flag"`
@ -65,7 +70,7 @@ type ResultData struct {
PsID api.Integer `json:"ps_id"`
PsKey api.PsKey `json:"ps_key"`
RelState api.Integer `json:"rel_state"`
Sn api.String `json:"sn"`
Sn api.String `json:"sn" PointName:"Serial Number"`
TypeName api.String `json:"type_name"`
UUID api.Integer `json:"uuid"`
} `json:"pageList"`
@ -101,3 +106,78 @@ func (e *ResultData) IsValid() error {
//
// return err
//}
func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()
for range Only.Once {
pkg := apiReflect.GetName("", *e)
for _, d := range e.Response.ResultData.PageList {
name := strings.Join([]string{pkg, d.PsKey.Value()}, ".")
entries.StructToPoints(d, name, d.PsKey.Value(), time.Time{})
}
}
return entries
}
func (e *EndPoint) GetDataTable() output.Table {
var table output.Table
for range Only.Once {
table = output.NewTable()
table.SetTitle("")
table.SetJson([]byte(e.GetJsonData(false)))
table.SetRaw([]byte(e.GetJsonData(true)))
_ = table.SetHeader(
"Date",
"Point Id",
// "Parents",
"Group Name",
"Description",
"Value",
"Unit",
)
data := e.GetData()
var sorted []string
for p := range data.DataPoints {
sorted = append(sorted, string(p))
}
sort.Strings(sorted)
for _, p := range sorted {
entries := data.DataPoints[api.PointId(p)]
for _, de := range entries {
if de.Hide {
continue
}
_ = table.AddRow(
de.Date.Format(api.DtLayout),
// api.NameDevicePointInt(de.Point.Parents, p.PointID.Value()),
// de.Point.Id,
p,
// de.Point.Parents.String(),
de.Point.GroupName,
de.Point.Name,
de.Value,
de.Point.Unit,
)
}
}
// table.InitGraph(output.GraphRequest {
// Title: "",
// TimeColumn: output.SetInteger(1),
// SearchColumn: output.SetInteger(2),
// NameColumn: output.SetInteger(4),
// ValueColumn: output.SetInteger(5),
// UnitsColumn: output.SetInteger(6),
// SearchString: output.SetString(""),
// MinLeftAxis: output.SetFloat(0),
// MaxLeftAxis: output.SetFloat(0),
// })
}
return table
}

View File

@ -667,24 +667,31 @@ func GetPointTags(ref interface{}, name ...string) DataStructureMap {
ignore = true
}
// if fieldTo.Tag.Get("json") == "robot_num_sweep_capacity" {
// if fieldTo.Tag.Get("json") == "p83012" {
// fmt.Sprintf("")
// }
pointJson := fieldTo.Tag.Get("json")
pointId := fieldTo.Tag.Get(PointId)
if pointId == "" {
pointId = pointJson
}
if IsUnknownStructure(fieldTo, fieldVo) {
n2 := name
n2 = append(n2, fieldTo.Name)
n2 = append(n2, pointId)
t2 := GetPointTags(fieldVo.Interface(), n2...)
for k, v := range t2 {
ret[k] = v
}
break
continue
}
endPointName := strings.Join(name, ".")
pointName := strings.TrimPrefix(endPointName + "." + fieldTo.Name, ".")
pointName := strings.TrimPrefix(endPointName + "." + pointId, ".")
ret[pointName] = DataStructure {
PointId: fieldTo.Tag.Get(PointId),
Json: pointJson,
PointId: pointId,
// PointType: fieldTo.Tag.Get(PointType),
PointUnit: fieldTo.Tag.Get(PointUnit),
PointUnitFrom: fieldTo.Tag.Get(PointUnitFrom),
@ -696,13 +703,12 @@ func GetPointTags(ref interface{}, name ...string) DataStructureMap {
PointGroupName: fieldTo.Tag.Get(PointGroupName),
PointIgnore: ignore,
Json: fieldTo.Tag.Get("json"),
Value: fieldVo.Interface(),
ValueType: fieldTo.Type.String(),
Endpoint: endPointName,
}
// if fieldTo.Tag.Get("json") == "robot_num_sweep_capacity" {
// if fieldTo.Tag.Get("json") == "p83012" {
// fmt.Sprintf("")
// }
}

View File

@ -1,7 +1,9 @@
package api
import "time"
const (
NullAreaName = "NullArea"
NullEndPointName = "NullEndpoint"
DefaultTimeout = time.Second * 60
)

View File

@ -1,11 +1,12 @@
package nullEndpoint
import (
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/output"
"errors"
"fmt"
"github.com/MickMake/GoUnify/Only"
"time"
)
@ -63,47 +64,13 @@ func (e *ResultData) IsValid() error {
// return err
// }
func (e *EndPoint) GetDataTable() output.Table {
var table output.Table
func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()
for range Only.Once {
table = output.NewTable()
table.SetTitle("")
table.SetJson([]byte(e.GetJsonData(false)))
table.SetRaw([]byte(e.GetJsonData(true)))
// e.Error = table.SetHeader(
// "Template Id",
// "Template Name",
// "Update On",
// )
// if e.Error != nil {
// break
// }
// for _, p := range e.Response.ResultData.PageList {
// _ = table.AddRow(
// p.TemplateID,
// p.TemplateName,
// api.NewDateTime(p.UpdateTime).PrintFull(),
// )
// if table.Error != nil {
// continue
// }
// }
// table.InitGraph(output.GraphRequest {
// Title: "",
// TimeColumn: output.SetInteger(1),
// SearchColumn: output.SetInteger(2),
// NameColumn: output.SetInteger(3),
// ValueColumn: output.SetInteger(4),
// UnitsColumn: output.SetInteger(5),
// SearchString: output.SetString(""),
// MinLeftAxis: output.SetFloat(0),
// MaxLeftAxis: output.SetFloat(0),
// })
entries.StructToPoints(e.Response.ResultData, apiReflect.GetName("", *e), "PsId", time.Time{})
}
return table
return entries
}

View File

@ -12,6 +12,7 @@ import (
"encoding/json"
"errors"
"fmt"
"sort"
"time"
)
@ -361,3 +362,64 @@ func (e EndPoint) SetCacheTimeout(duration time.Duration) api.EndPoint {
func (e EndPoint) GetCacheTimeout() time.Duration {
return e.ApiRoot.GetCacheTimeout()
}
func (e EndPoint) GetDataTable() output.Table {
var table output.Table
for range Only.Once {
table = output.NewTable()
table.SetTitle("")
table.SetJson([]byte(e.GetJsonData(false)))
table.SetRaw([]byte(e.GetJsonData(true)))
_ = table.SetHeader(
"Date",
"Point Id",
// "Parents",
"Group Name",
"Description",
"Value",
"Unit",
)
data := e.GetData()
var sorted []string
for p := range data.DataPoints {
sorted = append(sorted, string(p))
}
sort.Strings(sorted)
for _, p := range sorted {
entries := data.DataPoints[api.PointId(p)]
for _, de := range entries {
if de.Hide {
continue
}
_ = table.AddRow(
de.Date.Format(api.DtLayout),
// api.NameDevicePointInt(de.Point.Parents, p.PointID.Value()),
// de.Point.Id,
p,
// de.Point.Parents.String(),
de.Point.GroupName,
de.Point.Name,
de.Value,
de.Point.Unit,
)
}
}
// table.InitGraph(output.GraphRequest {
// Title: "",
// TimeColumn: output.SetInteger(1),
// SearchColumn: output.SetInteger(2),
// NameColumn: output.SetInteger(4),
// ValueColumn: output.SetInteger(5),
// UnitsColumn: output.SetInteger(6),
// SearchString: output.SetString(""),
// MinLeftAxis: output.SetFloat(0),
// MaxLeftAxis: output.SetFloat(0),
// })
}
return table
}

View File

@ -97,12 +97,9 @@ func (dm *DataMap) StructToPoints(ref interface{}, endpoint string, parentId str
// fmt.Printf("TP: %v\n", tp)
for _, f := range tp {
// if strings.Contains(strings.ToLower(k), "robot") {
// if strings.Contains(strings.ToLower(f.Json), "p83012") {
// fmt.Sprintf("")
// }
if f.PointId == "" {
f.PointId = f.Json
}
if f.PointIgnore {
// fmt.Printf("IGNORE: %s\n", f.PointId)
@ -152,53 +149,135 @@ func (dm *DataMap) StructToPoints(ref interface{}, endpoint string, parentId str
uv = f.Value.(UnitValue)
// uv = uv.UnitValueFix()
case "[]UnitValue":
fallthrough
case "[]api.UnitValue":
// v := strings.Join(f.Value.([]string), ",")
j, err := json.Marshal(f.Value.([]UnitValue))
if err != nil {
j = []byte(fmt.Sprintf("%v", f.Value.([]UnitValue)))
}
uv = SetUnitValueString(string(j), f.PointUnit)
case "Float":
fallthrough
case "api.Float":
v := f.Value.(Float)
uv = SetUnitValueFloat(v.Value(), f.PointUnit)
case "[]Float":
fallthrough
case "[]api.Float":
// v := strings.Join(f.Value.([]string), ",")
j, err := json.Marshal(f.Value.([]Float))
if err != nil {
j = []byte(fmt.Sprintf("%v", f.Value.([]Float)))
}
uv = SetUnitValueString(string(j), f.PointUnit)
case "Integer":
fallthrough
case "api.Integer":
v := f.Value.(Integer).Value()
uv = SetUnitValueInteger(v, f.PointUnit)
case "[]Integer":
fallthrough
case "[]api.Integer":
j, err := json.Marshal(f.Value.([]Integer))
if err != nil {
j = []byte(fmt.Sprintf("%v", f.Value.([]Integer)))
}
uv = SetUnitValueString(string(j), f.PointUnit)
case "Count":
fallthrough
case "api.Count":
v := f.Value.(Count).Value()
uv = SetUnitValueInteger(v, "counter")
case "[]Count":
fallthrough
case "[]api.Count":
j, err := json.Marshal(f.Value.([]Count))
if err != nil {
j = []byte(fmt.Sprintf("%v", f.Value.([]Count)))
}
uv = SetUnitValueString(string(j), f.PointUnit)
case "Bool":
fallthrough
case "api.Bool":
v := f.Value.(Bool).String()
uv = SetUnitValueString(v, "binary")
case "[]Bool":
fallthrough
case "[]api.Bool":
j, err := json.Marshal(f.Value.([]Bool))
if err != nil {
j = []byte(fmt.Sprintf("%v", f.Value.([]Bool)))
}
uv = SetUnitValueString(string(j), f.PointUnit)
case "String":
fallthrough
case "api.String":
v := f.Value.(String).String()
uv = SetUnitValueString(v, f.PointUnit)
case "[]String":
fallthrough
case "[]api.String":
j, err := json.Marshal(f.Value.([]String))
if err != nil {
j = []byte(fmt.Sprintf("%v", f.Value.([]String)))
}
uv = SetUnitValueString(string(j), f.PointUnit)
case "PsKey":
fallthrough
case "api.PsKey":
v := f.Value.(PsKey).Value()
uv = SetUnitValueString(v, f.PointUnit)
case "[]PsKey":
fallthrough
case "[]api.PsKey":
j, err := json.Marshal(f.Value.([]PsKey))
if err != nil {
j = []byte(fmt.Sprintf("%v", f.Value.([]PsKey)))
}
uv = SetUnitValueString(string(j), f.PointUnit)
case "DateTime":
fallthrough
case "api.DateTime":
v := f.Value.(DateTime).String()
uv = SetUnitValueString(v, "date")
case "[]DateTime":
fallthrough
case "[]api.DateTime":
j, err := json.Marshal(f.Value.([]DateTime))
if err != nil {
j = []byte(fmt.Sprintf("%v", f.Value.([]DateTime)))
}
uv = SetUnitValueString(string(j), f.PointUnit)
case "[]string":
// v := strings.Join(f.Value.([]string), ",")
j, err := json.Marshal(f.Value.([]string))
if err != nil {
j = []byte(fmt.Sprintf("%v", f.Value.([]string)))
}
uv = SetUnitValueString(string(j), f.PointUnit)
default:
ignore = true
}
if ignore {
// fmt.Printf("IGNORE: %s\n", f.PointId)
// fmt.Printf("IGNORE: %s.%s (%s)\n", f.Endpoint, f.PointId, f.ValueType)
continue
}
@ -217,6 +296,15 @@ func (dm *DataMap) StructToPoints(ref interface{}, endpoint string, parentId str
f.PointTimeSpan = PointTimeSpanTotal
}
var now DateTime
if timestamp.IsZero() {
now = NewDateTime(time.Now().Round(5 * time.Minute).Format(DtLayoutZeroSeconds))
} else {
now = NewDateTime(timestamp.String())
}
// @TODO - Think about adding in arrays of values OR just marshal arrays into JSON.
// fullName := JoinDevicePoint(device, PointId(f.PointId))
p := Point {
Parents: parents,
@ -230,12 +318,9 @@ func (dm *DataMap) StructToPoints(ref interface{}, endpoint string, parentId str
States: nil,
}
var now DateTime
if timestamp.IsZero() {
now = NewDateTime(time.Now().Round(5 * time.Minute).Format(DtLayoutZeroSeconds))
} else {
now = NewDateTime(timestamp.String())
}
// if strings.Contains(strings.ToLower(f.Json), "p83012") {
// fmt.Sprintf("")
// }
dm.AddEntry(f.Endpoint, f.PointDevice, p, now, uv.String())
@ -247,12 +332,15 @@ func (dm *DataMap) StructToPoints(ref interface{}, endpoint string, parentId str
}
for _, f := range tp {
// if strings.Contains(strings.ToLower(f.PointId), "p83012") {
// fmt.Sprintf("")
// }
if f.PointUnitFrom != "" {
sdp := dm.GetEntryFromPointId(f.PointUnitFrom)
if sdp == nil {
continue
}
ddp := dm.GetEntryFromPointId(f.Json)
ddp := dm.GetEntryFromPointId(f.PointId)
if ddp == nil {
continue
}
@ -492,6 +580,9 @@ func (dm *DataMap) AddEntry(endpoint string, parentId string, point Point, date
point.Unit = ref.Unit()
point.Valid = true
if _, ok := dm.DataPoints[point.Id]; ok {
point.Id += ".BARF"
}
// dm.Add(JoinDevicePoint(endpoint, point.Id), DataEntry {
dm.Add(JoinDevicePoint(endpoint, point.Id), DataEntry {
EndPoint: endpoint,

View File

@ -2,9 +2,12 @@ package iSolarCloud
import (
"GoSungrow/Only"
"GoSungrow/iSolarCloud/AppService/findPsType"
"GoSungrow/iSolarCloud/AppService/getAllDeviceByPsId"
"GoSungrow/iSolarCloud/AppService/getDeviceList"
"GoSungrow/iSolarCloud/AppService/getDeviceModelInfoList"
"GoSungrow/iSolarCloud/AppService/getHouseholdStoragePsReport"
"GoSungrow/iSolarCloud/AppService/getIncomeSettingInfos"
"GoSungrow/iSolarCloud/AppService/getKpiInfo"
"GoSungrow/iSolarCloud/AppService/getPowerDevicePointInfo"
"GoSungrow/iSolarCloud/AppService/getPowerDevicePointNames"
@ -14,6 +17,7 @@ import (
"GoSungrow/iSolarCloud/AppService/getPsList"
"GoSungrow/iSolarCloud/AppService/getTemplateList"
"GoSungrow/iSolarCloud/AppService/queryDeviceList"
"GoSungrow/iSolarCloud/AppService/queryDeviceListForApp"
"GoSungrow/iSolarCloud/AppService/queryDeviceRealTimeDataByPsKeys"
"GoSungrow/iSolarCloud/AppService/queryMutiPointDataList"
"GoSungrow/iSolarCloud/WebAppService/getMqttConfigInfoByAppkey"
@ -484,43 +488,34 @@ func (sg *SunGrow) GetRealTimeData(psKey string) error {
func (sg *SunGrow) CmdDataPsDetail(psIds ...api.Integer) error {
for range Only.Once {
if len(psIds) == 0 {
psIds, sg.Error = sg.GetPsIds()
if sg.Error != nil {
break
}
}
var data SunGrowData
data.New(sg)
for _, psId := range psIds {
data := sg.GetPsDetail(psId)
table := data.GetDataTable()
if table.Error != nil {
sg.Error = table.Error
response := data.Get("getPsDetail", SunGrowDataRequest{PsId: psId})
if response.Error != nil {
break
}
table.SetTitle("PS Details %s", psId)
table.SetFilePrefix(data.SetFilenamePrefix("%d", psId))
table.SetGraphFilter("")
table.SetSaveFile(sg.SaveAsFile)
table.OutputType = sg.OutputType
sg.Error = table.Output()
sg.Error = response.Table.Output()
if sg.Error != nil {
break
}
data2 := sg.GetPsDetailWithPsType(psId)
table = data2.GetDataTable()
if table.Error != nil {
sg.Error = table.Error
response = data.Get("getPsDetailWithPsType", SunGrowDataRequest{PsId: psId})
if response.Error != nil {
break
}
table.SetTitle("PS Details With Ps Type %s", psId)
table.SetFilePrefix(data.SetFilenamePrefix("%d", psId))
table.SetGraphFilter("")
table.SetSaveFile(sg.SaveAsFile)
table.OutputType = sg.OutputType
sg.Error = table.Output()
sg.Error = response.Table.Output()
if sg.Error != nil {
break
}
// api.Points.Print()
}
}
@ -683,7 +678,7 @@ func (sg *SunGrow) GetDeviceList(psIds ...api.Integer) error {
ret = append(ret, data.GetDevices()...)
}
table := getDeviceList.GetDataTable(ret)
table := getDeviceList.GetDevicesTable(ret)
table.SetTitle("All Devices")
table.SetFilePrefix("")
table.SetGraphFilter("")
@ -1124,7 +1119,7 @@ func (sg *SunGrow) GetDevices(print bool) (getDeviceList.Devices, error) {
break
}
table := getDeviceList.GetDataTable(ret)
table := getDeviceList.GetDevicesTable(ret)
table.SetTitle("All Devices")
table.SetFilePrefix("")
table.SetGraphFilter("")
@ -1229,90 +1224,815 @@ func (sg *SunGrow) GetPsKeys() ([]string, error) {
// ****************************************************** //
func (sg *SunGrow) QueryDeviceList(psId api.Integer) queryDeviceList.EndPoint {
var data queryDeviceList.EndPoint
func (sg *SunGrow) GetEndpoints(endpoints []string, psIds ...api.Integer) error {
for range Only.Once {
if psId.Value() == 0 {
break
var data SunGrowData
data.New(sg)
if len(endpoints) == 0 {
endpoints = data.GetAllEndPoints()
}
ep := sg.GetByStruct(
"AppService.queryDeviceList",
queryDeviceList.RequestData{PsId: psId},
time.Second * 60,
)
if len(psIds) == 0 {
psIds, sg.Error = sg.GetPsIds()
if sg.Error != nil {
break
}
}
data = queryDeviceList.Assert(ep)
if data.Error != nil {
sg.Error = data.Error
break
for _, endpoint := range endpoints {
if !data.HasArgs(endpoint) {
response := data.Get(endpoint, SunGrowDataRequest{ })
if response.Error != nil {
break
}
// response.Table.SetGraphFilter("")
sg.Error = response.Table.Output()
if sg.Error != nil {
break
}
continue
}
for _, psId := range psIds {
response := data.Get(endpoint, SunGrowDataRequest{PsId: psId})
if response.Error != nil {
break
}
// response.Table.SetGraphFilter("")
sg.Error = response.Table.Output()
if sg.Error != nil {
break
}
}
}
}
return data
return sg.Error
}
func (sg *SunGrow) GetPsList() getPsList.EndPoint {
var data getPsList.EndPoint
type SunGrowData struct {
EndPoint string
EndPoints EndPoints
SunGrow *SunGrow
Error error
}
type EndPoints map[string]EndPoint
type EndPoint struct {
Func SunGrowDataFunction
HasArgs bool
}
type SunGrowDataFunction func(request SunGrowDataRequest) SunGrowDataResponse
type SunGrowDataRequest struct {
PsId api.Integer `json:"ps_id"`
ReportType string `json:"report_type"`
DateID string `json:"date_id"`
DateType string `json:"date_type"`
}
type SunGrowDataResponse struct {
Data api.DataMap
Table output.Table
Filename string
Title string
Error error
}
func (sg *SunGrowData) New(ref *SunGrow) {
for range Only.Once {
ep := sg.GetByStruct(
sg.SunGrow = ref
sg.EndPoints = make(EndPoints)
sg.EndPoints["getPsList"] = EndPoint { Func: sg.getPsList, HasArgs: false }
sg.EndPoints["queryDeviceList"] = EndPoint { Func: sg.queryDeviceList, HasArgs: true }
sg.EndPoints["queryDeviceListForApp"] = EndPoint { Func: sg.queryDeviceListForApp, HasArgs: true }
sg.EndPoints["getPsDetailWithPsType"] = EndPoint { Func: sg.getPsDetailWithPsType, HasArgs: true }
sg.EndPoints["getPsDetail"] = EndPoint { Func: sg.getPsDetail, HasArgs: true }
sg.EndPoints["findPsType"] = EndPoint { Func: sg.findPsType, HasArgs: true }
// sg.EndPoints["getAllDeviceByPsId"] = EndPoint { Func: sg.getAllDeviceByPsId, HasArgs: false }
sg.EndPoints["getDeviceList"] = EndPoint { Func: sg.getDeviceList, HasArgs: true }
sg.EndPoints["getIncomeSettingInfos"] = EndPoint { Func: sg.getIncomeSettingInfos, HasArgs: true }
sg.EndPoints["getKpiInfo"] = EndPoint { Func: sg.getKpiInfo, HasArgs: false }
}
}
func (sg *SunGrowData) GetAllEndPoints() []string {
var ret []string
for ep := range sg.EndPoints {
ret = append(ret, ep)
}
return ret
}
func (sg *SunGrowData) Get(endpoint string, request SunGrowDataRequest) SunGrowDataResponse {
var response SunGrowDataResponse
for range Only.Once {
dataEndPoint, ok := sg.Exists(endpoint)
if !ok {
break
}
response = dataEndPoint.Func(request)
if response.Error != nil {
break
}
if response.Filename == "" {
response.Filename = endpoint
}
if response.Title == "" {
response.Title = fmt.Sprintf("Data Request %s", endpoint)
}
response.Table.SetTitle(response.Title)
response.Table.SetFilePrefix(response.Filename)
response.Table.SetGraphFilter("")
response.Table.SetSaveFile(sg.SunGrow.SaveAsFile)
response.Table.OutputType = sg.SunGrow.OutputType
}
return response
}
func (sg *SunGrowData) Exists(endpoint string) (EndPoint, bool) {
var dataFunc EndPoint
var yes bool
for range Only.Once {
if dataFunc, yes = sg.EndPoints[endpoint]; yes {
yes = true
break
}
sg.Error = errors.New(fmt.Sprintf("unknown endpoint function '%s'", endpoint))
}
return dataFunc, yes
}
func (sg *SunGrowData) HasArgs(endpoint string) bool {
var yes bool
for range Only.Once {
dataEndPoint, ok := sg.Exists(endpoint)
if !ok {
break
}
yes = dataEndPoint.HasArgs
}
return yes
}
func (sg *SunGrowData) getPsList(request SunGrowDataRequest) SunGrowDataResponse {
var response SunGrowDataResponse
for range Only.Once {
ep := sg.SunGrow.GetByStruct(
"AppService.getPsList",
getPsList.RequestData{},
time.Second * 60,
getPsList.RequestData{ },
api.DefaultTimeout,
)
data = getPsList.Assert(ep)
data := getPsList.Assert(ep)
if data.Error != nil {
sg.Error = data.Error
sg.SunGrow.Error = data.Error
break
}
}
return data
response.Filename = data.SetFilenamePrefix("getPsList-%d", request.PsId)
response.Data = data.GetData()
response.Table = data.GetDataTable()
}
return response
}
func (sg *SunGrow) GetPsDetailWithPsType(psId api.Integer) getPsDetailWithPsType.EndPoint {
var data getPsDetailWithPsType.EndPoint
func (sg *SunGrowData) queryDeviceList(request SunGrowDataRequest) SunGrowDataResponse {
var response SunGrowDataResponse
for range Only.Once {
if psId.Value() == 0 {
ep := sg.SunGrow.GetByStruct(
"AppService.queryDeviceList",
queryDeviceList.RequestData{ PsId: request.PsId },
api.DefaultTimeout,
)
data := queryDeviceList.Assert(ep)
if data.Error != nil {
sg.SunGrow.Error = data.Error
break
}
ep := sg.GetByStruct(
response.Filename = data.SetFilenamePrefix("queryDeviceList-%d", request.PsId)
response.Data = data.GetData()
response.Table = data.GetDataTable()
}
return response
}
func (sg *SunGrowData) queryDeviceListForApp(request SunGrowDataRequest) SunGrowDataResponse {
var response SunGrowDataResponse
for range Only.Once {
ep := sg.SunGrow.GetByStruct(
"AppService.queryDeviceListForApp",
queryDeviceListForApp.RequestData{ PsId: request.PsId },
api.DefaultTimeout,
)
data := queryDeviceListForApp.Assert(ep)
if data.Error != nil {
sg.SunGrow.Error = data.Error
break
}
response.Filename = data.SetFilenamePrefix("queryDeviceListForApp-%d", request.PsId)
response.Data = data.GetData()
response.Table = data.GetDataTable()
}
return response
}
func (sg *SunGrowData) getPsDetailWithPsType(request SunGrowDataRequest) SunGrowDataResponse {
var response SunGrowDataResponse
for range Only.Once {
ep := sg.SunGrow.GetByStruct(
"AppService.getPsDetailWithPsType",
getPsDetailWithPsType.RequestData{PsId: psId},
time.Second * 60,
getPsDetailWithPsType.RequestData{ PsId: request.PsId },
api.DefaultTimeout,
)
data = getPsDetailWithPsType.Assert(ep)
data := getPsDetailWithPsType.Assert(ep)
if data.Error != nil {
sg.Error = data.Error
sg.SunGrow.Error = data.Error
break
}
}
return data
response.Filename = data.SetFilenamePrefix("getPsDetailWithPsType-%d", request.PsId)
response.Data = data.GetData()
response.Table = data.GetDataTable()
}
return response
}
func (sg *SunGrow) GetPsDetail(psId api.Integer) getPsDetail.EndPoint {
var data getPsDetail.EndPoint
func (sg *SunGrowData) getPsDetail(request SunGrowDataRequest) SunGrowDataResponse {
var response SunGrowDataResponse
for range Only.Once {
if psId.Value() == 0 {
break
}
ep := sg.GetByStruct(
ep := sg.SunGrow.GetByStruct(
"AppService.getPsDetail",
getPsDetail.RequestData{PsId: psId},
time.Second * 60,
getPsDetail.RequestData{ PsId: request.PsId },
api.DefaultTimeout,
)
data = getPsDetail.Assert(ep)
data := getPsDetail.Assert(ep)
if data.Error != nil {
sg.Error = data.Error
sg.SunGrow.Error = data.Error
break
}
}
return data
response.Filename = data.SetFilenamePrefix("getPsDetail-%d", request.PsId)
response.Data = data.GetData()
response.Table = data.GetDataTable()
}
return response
}
func (sg *SunGrowData) findPsType(request SunGrowDataRequest) SunGrowDataResponse {
var response SunGrowDataResponse
for range Only.Once {
ep := sg.SunGrow.GetByStruct(
"AppService.findPsType",
findPsType.RequestData{ PsId: request.PsId },
api.DefaultTimeout,
)
data := findPsType.Assert(ep)
if data.Error != nil {
sg.SunGrow.Error = data.Error
break
}
response.Filename = data.SetFilenamePrefix("findPsType-%d", request.PsId)
response.Data = data.GetData()
response.Table = data.GetDataTable()
}
return response
}
func (sg *SunGrowData) getAllDeviceByPsId(request SunGrowDataRequest) SunGrowDataResponse {
var response SunGrowDataResponse
for range Only.Once {
ep := sg.SunGrow.GetByStruct(
"AppService.getAllDeviceByPsId",
getAllDeviceByPsId.RequestData{ PsId: request.PsId },
api.DefaultTimeout,
)
data := getAllDeviceByPsId.Assert(ep)
if data.Error != nil {
sg.SunGrow.Error = data.Error
break
}
response.Filename = data.SetFilenamePrefix("getAllDeviceByPsId-%d", request.PsId)
response.Data = data.GetData()
response.Table = data.GetDataTable()
}
return response
}
func (sg *SunGrowData) getDeviceList(request SunGrowDataRequest) SunGrowDataResponse {
var response SunGrowDataResponse
for range Only.Once {
ep := sg.SunGrow.GetByStruct(
"AppService.getDeviceList",
getDeviceList.RequestData{ PsId: request.PsId },
api.DefaultTimeout,
)
data := getDeviceList.Assert(ep)
if data.Error != nil {
sg.SunGrow.Error = data.Error
break
}
response.Filename = data.SetFilenamePrefix("getDeviceList-%d", request.PsId)
response.Data = data.GetData()
response.Table = data.GetDataTable()
}
return response
}
func (sg *SunGrowData) getIncomeSettingInfos(request SunGrowDataRequest) SunGrowDataResponse {
var response SunGrowDataResponse
for range Only.Once {
ep := sg.SunGrow.GetByStruct(
"AppService.getIncomeSettingInfos",
getIncomeSettingInfos.RequestData{ PsId: request.PsId },
api.DefaultTimeout,
)
data := getIncomeSettingInfos.Assert(ep)
if data.Error != nil {
sg.SunGrow.Error = data.Error
break
}
response.Filename = data.SetFilenamePrefix("getIncomeSettingInfos-%d", request.PsId)
response.Data = data.GetData()
response.Table = data.GetDataTable()
}
return response
}
func (sg *SunGrowData) getKpiInfo(request SunGrowDataRequest) SunGrowDataResponse {
var response SunGrowDataResponse
for range Only.Once {
ep := sg.SunGrow.GetByStruct(
"AppService.getKpiInfo",
getKpiInfo.RequestData{ },
api.DefaultTimeout,
)
data := getKpiInfo.Assert(ep)
if data.Error != nil {
sg.SunGrow.Error = data.Error
break
}
response.Filename = data.SetFilenamePrefix("getKpiInfo-%d", request.PsId)
response.Data = data.GetData()
response.Table = data.GetDataTable()
}
return response
}
// func (sg *SunGrowData) getPowerChargeSettingInfo(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.getPowerChargeSettingInfo",
// getPowerChargeSettingInfo.RequestData{ PsId: request.PsId },
// api.DefaultTimeout,
// )
//
// data := getPowerChargeSettingInfo.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("getPowerChargeSettingInfo-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) getPowerStationBasicInfo(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.getPowerStationBasicInfo",
// getPowerStationBasicInfo.RequestData{ PsId: request.PsId },
// api.DefaultTimeout,
// )
//
// data := getPowerStationBasicInfo.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("getPowerStationBasicInfo-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) getPowerStationData(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.getPowerStationData",
// getPowerStationData.RequestData{ PsId: request.PsId },
// api.DefaultTimeout,
// )
//
// data := getPowerStationData.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("getPowerStationData-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) getPowerStationForHousehold(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.getPowerStationForHousehold",
// getPowerStationForHousehold.RequestData{ PsId: request.PsId },
// api.DefaultTimeout,
// )
//
// data := getPowerStationForHousehold.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("getPowerStationForHousehold-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) getPowerStationInfo(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.getPowerStationInfo",
// getPowerStationInfo.RequestData{ PsId: request.PsId },
// api.DefaultTimeout,
// )
//
// data := getPowerStationInfo.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("getPowerStationInfo-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) getPowerStatistics(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.getPowerStatistics",
// getPowerStatistics.RequestData{ PsId: request.PsId },
// api.DefaultTimeout,
// )
//
// data := getPowerStatistics.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("getPowerStatistics-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) getPsHealthState(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.getPsHealthState",
// getPsHealthState.RequestData{ PsId: request.PsId },
// api.DefaultTimeout,
// )
//
// data := getPsHealthState.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("getPsHealthState-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) getPsWeatherList(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.getPsWeatherList",
// getPsWeatherList.RequestData{ PsId: request.PsId },
// api.DefaultTimeout,
// )
//
// data := getPsWeatherList.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("getPsWeatherList-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) getRemoteUpgradeTaskList(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.getRemoteUpgradeTaskList",
// getRemoteUpgradeTaskList.RequestData{ PsId: request.PsId },
// api.DefaultTimeout,
// )
//
// data := getRemoteUpgradeTaskList.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("getRemoteUpgradeTaskList-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) getReportData(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.getReportData",
// getReportData.RequestData{ PsId: request.PsId, ReportType: request.ReportType },
// api.DefaultTimeout,
// )
//
// data := getReportData.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("getReportData-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) psForcastInfo(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.psForcastInfo",
// psForcastInfo.RequestData{ PsId: request.PsId },
// api.DefaultTimeout,
// )
//
// data := psForcastInfo.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("psForcastInfo-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) queryAllPsIdAndName(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.queryAllPsIdAndName",
// queryAllPsIdAndName.RequestData{ },
// api.DefaultTimeout,
// )
//
// data := queryAllPsIdAndName.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("queryAllPsIdAndName-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) queryPsIdList(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.queryPsIdList",
// queryPsIdList.RequestData{ },
// api.DefaultTimeout,
// )
//
// data := queryPsIdList.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("queryPsIdList-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) queryPsNameByPsId(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.queryPsNameByPsId",
// queryPsNameByPsId.RequestData{ },
// api.DefaultTimeout,
// )
//
// data := queryPsNameByPsId.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("queryPsNameByPsId-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) queryPowerStationInfo(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.queryPowerStationInfo",
// queryPowerStationInfo.RequestData{ PsId: request.PsId },
// api.DefaultTimeout,
// )
//
// data := queryPowerStationInfo.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("queryPowerStationInfo-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) queryPsProfit(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.queryPsProfit",
// queryPsProfit.RequestData{ PsId: request.PsId, DateID: request.DateID, DateType: request.DateType },
// api.DefaultTimeout,
// )
//
// data := queryPsProfit.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("queryPsProfit-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) reportList(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.reportList",
// reportList.RequestData{ PsId: request.PsId },
// api.DefaultTimeout,
// )
//
// data := reportList.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("reportList-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) getPsIdState(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.getPsIdState",
// getPsIdState.RequestData{ PsId: request.PsId },
// api.DefaultTimeout,
// )
//
// data := getPsIdState.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("getPsIdState-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) showPSView(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.showPSView",
// showPSView.RequestData{ PsId: request.PsId },
// api.DefaultTimeout,
// )
//
// data := showPSView.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("showPSView-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }
//
// func (sg *SunGrowData) getMaxDeviceIdByPsId(request SunGrowDataRequest) SunGrowDataResponse {
// var response SunGrowDataResponse
// for range Only.Once {
// ep := sg.SunGrow.GetByStruct(
// "AppService.getMaxDeviceIdByPsId",
// getMaxDeviceIdByPsId.RequestData{ PsId: request.PsId },
// api.DefaultTimeout,
// )
//
// data := getMaxDeviceIdByPsId.Assert(ep)
// if data.Error != nil {
// sg.SunGrow.Error = data.Error
// break
// }
//
// response.Filename = data.SetFilenamePrefix("getMaxDeviceIdByPsId-%d", request.PsId)
// response.Data = data.GetData()
// response.Table = data.GetDataTable()
// }
// return response
// }