v2.3.2 - Support update freqs.

This commit is contained in:
MickMake 2022-10-19 01:37:11 +11:00
parent 064b963b85
commit 02151a60b0
33 changed files with 3877 additions and 2425 deletions

253
.idea/workspace.xml generated
View File

@ -5,13 +5,39 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="76adadc9-ae71-42a6-82a1-66dbc8ecb14c" name="Changes" comment=""> <list default="true" id="76adadc9-ae71-42a6-82a1-66dbc8ecb14c" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/iSolarCloud/api/legacy.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/iSolarCloud/api/struct_de.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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_mqtt.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/cmd_mqtt.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/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/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/queryDeviceList/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceList/data.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/AppService/queryMutiPointDataList/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/queryMutiPointDataList/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/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_data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/struct_data.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_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/struct_points.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/struct_points.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/struct_template_points.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/struct_template_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/api/types.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/types.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/valueTypes/bool.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/valueTypes/bool.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/valueTypes/datetime.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/valueTypes/datetime.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/valueTypes/float.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/valueTypes/float.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/valueTypes/integers.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/valueTypes/integers.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/valueTypes/point.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/valueTypes/point.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/valueTypes/string.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/valueTypes/string.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/valueTypes/types.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/valueTypes/types.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/valueTypes/uv.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/valueTypes/uv.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/data.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/z" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/z" afterDir="false" /> <change beforePath="$PROJECT_DIR$/iSolarCloud/z" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/z" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mmHa/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/mmHa/struct.go" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -85,7 +111,7 @@
<configuration name="GoSungrow" type="GoApplicationRunConfiguration" factoryName="Go Application"> <configuration name="GoSungrow" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="GoSungrow" /> <module name="GoSungrow" />
<working_directory value="$PROJECT_DIR$" /> <working_directory value="$PROJECT_DIR$" />
<parameters value="data get queryDeviceList" /> <parameters value="data get queryDeviceList 1171348" />
<envs> <envs>
<env name="GOCACHE" value="/Volumes/Media/GoCache" /> <env name="GOCACHE" value="/Volumes/Media/GoCache" />
</envs> </envs>
@ -229,7 +255,7 @@
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url> <url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>1047</line> <line>1049</line>
<option name="timeStamp" value="906" /> <option name="timeStamp" value="906" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
@ -274,27 +300,22 @@
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url> <url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>923</line> <line>925</line>
<option name="timeStamp" value="967" /> <option name="timeStamp" value="967" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url> <url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>920</line> <line>922</line>
<option name="timeStamp" value="970" /> <option name="timeStamp" value="970" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>790</line>
<option name="timeStamp" value="972" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url> <url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>888</line> <line>890</line>
<option name="timeStamp" value="1216" /> <option name="timeStamp" value="1216" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url> <url>file://$PROJECT_DIR$/iSolarCloud/highlevel.go</url>
<line>869</line> <line>871</line>
<option name="timeStamp" value="1237" /> <option name="timeStamp" value="1237" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
@ -327,16 +348,6 @@
<line>465</line> <line>465</line>
<option name="timeStamp" value="1587" /> <option name="timeStamp" value="1587" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsDetailWithPsType/data.go</url>
<line>181</line>
<option name="timeStamp" value="1676" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsDetailWithPsType/data.go</url>
<line>189</line>
<option name="timeStamp" value="1721" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/struct.go</url> <url>file://$PROJECT_DIR$/iSolarCloud/struct.go</url>
<line>117</line> <line>117</line>
@ -349,7 +360,7 @@
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getDeviceList/data.go</url> <url>file://$PROJECT_DIR$/iSolarCloud/AppService/getDeviceList/data.go</url>
<line>287</line> <line>268</line>
<option name="timeStamp" value="1758" /> <option name="timeStamp" value="1758" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
@ -422,16 +433,6 @@
<line>65</line> <line>65</line>
<option name="timeStamp" value="1967" /> <option name="timeStamp" value="1967" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/valueTypes/point.go</url>
<line>52</line>
<option name="timeStamp" value="1968" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/valueTypes/point.go</url>
<line>22</line>
<option name="timeStamp" value="1969" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getIncomeSettingInfos/data.go</url> <url>file://$PROJECT_DIR$/iSolarCloud/AppService/getIncomeSettingInfos/data.go</url>
<line>77</line> <line>77</line>
@ -442,120 +443,120 @@
<line>86</line> <line>86</line>
<option name="timeStamp" value="1996" /> <option name="timeStamp" value="1996" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/types.go</url>
<line>65</line>
<option name="timeStamp" value="1997" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/apiReflect/reflect.go</url>
<line>151</line>
<option name="timeStamp" value="2014" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsList/data.go</url>
<line>265</line>
<option name="timeStamp" value="2021" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/apiReflect/reflect.go</url>
<line>68</line>
<option name="timeStamp" value="2023" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/valueTypes/types.go</url>
<line>352</line>
<option name="timeStamp" value="2025" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsWeatherList/data.go</url> <url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsWeatherList/data.go</url>
<line>66</line> <line>66</line>
<option name="timeStamp" value="2029" /> <option name="timeStamp" value="2029" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>127</line>
<option name="timeStamp" value="2087" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/valueTypes/types.go</url> <url>file://$PROJECT_DIR$/iSolarCloud/api/valueTypes/types.go</url>
<line>408</line> <line>681</line>
<option name="timeStamp" value="2034" /> <option name="timeStamp" value="2090" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceList/data.go</url> <url>file://$PROJECT_DIR$/iSolarCloud/api/valueTypes/types.go</url>
<line>318</line> <line>534</line>
<option name="timeStamp" value="2037" /> <option name="timeStamp" value="2091" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url> <url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsDetailWithPsType/data.go</url>
<line>247</line> <line>218</line>
<option name="timeStamp" value="2052" /> <option name="timeStamp" value="2191" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url> <url>file://$PROJECT_DIR$/iSolarCloud/api/valueTypes/datetime.go</url>
<line>252</line> <line>214</line>
<option name="timeStamp" value="2053" /> <option name="timeStamp" value="2203" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>158</line>
<option name="timeStamp" value="2056" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>725</line>
<option name="timeStamp" value="2064" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>740</line>
<option name="timeStamp" value="2065" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>712</line>
<option name="timeStamp" value="2066" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>456</line>
<option name="timeStamp" value="2067" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>422</line>
<option name="timeStamp" value="2068" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url> <url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>420</line> <line>420</line>
<option name="timeStamp" value="2072" /> <option name="timeStamp" value="2228" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url> <url>file://$PROJECT_DIR$/iSolarCloud/api/valueTypes/uv.go</url>
<line>461</line> <line>454</line>
<option name="timeStamp" value="2073" /> <option name="timeStamp" value="2261" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>419</line>
<option name="timeStamp" value="2074" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>451</line>
<option name="timeStamp" value="2075" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>446</line>
<option name="timeStamp" value="2076" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>500</line>
<option name="timeStamp" value="2078" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint"> <line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceList/data.go</url> <url>file://$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceList/data.go</url>
<line>251</line> <line>251</line>
<option name="timeStamp" value="2079" /> <option name="timeStamp" value="2367" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>120</line>
<option name="timeStamp" value="2373" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsDetailWithPsType/data.go</url>
<line>174</line>
<option name="timeStamp" value="2417" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsDetailWithPsType/data.go</url>
<line>180</line>
<option name="timeStamp" value="2418" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/getPsList/data.go</url>
<line>172</line>
<option name="timeStamp" value="2420" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>134</line>
<option name="timeStamp" value="2425" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceList/data.go</url>
<line>242</line>
<option name="timeStamp" value="2463" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceList/data.go</url>
<line>397</line>
<option name="timeStamp" value="2471" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceList/data.go</url>
<line>395</line>
<option name="timeStamp" value="2472" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceList/data.go</url>
<line>396</line>
<option name="timeStamp" value="2475" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceList/data.go</url>
<line>399</line>
<option name="timeStamp" value="2478" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>289</line>
<option name="timeStamp" value="2481" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>307</line>
<option name="timeStamp" value="2482" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>306</line>
<option name="timeStamp" value="2483" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
<line>290</line>
<option name="timeStamp" value="2484" />
</line-breakpoint> </line-breakpoint>
</breakpoints> </breakpoints>
<default-breakpoints> <default-breakpoints>
@ -564,8 +565,10 @@
</breakpoint-manager> </breakpoint-manager>
<watches-manager> <watches-manager>
<configuration name="GoApplicationRunConfiguration"> <configuration name="GoApplicationRunConfiguration">
<watch expression="dm.DataPoints[&quot;p83012&quot;]" language="go" /> <watch expression="entries.Map[&quot;virtual.1171348_14_1_2.power_pv_active&quot;]" language="go" />
<watch expression="tp[&quot;getPsDetail.1129147.P83012Value&quot;]" language="go" /> <watch expression="power_pv_active" language="go" />
<watch expression="des" language="go" />
<watch expression="dm.Map[&quot;virtual.1171348_14_1_2.power_pv_active&quot;]" language="go" />
</configuration> </configuration>
</watches-manager> </watches-manager>
</component> </component>

View File

@ -373,10 +373,10 @@ func (ca *Cmds) MqttCron() error {
func (ca *Cmds) Update(endpoint string, data api.DataMap, newDay bool) error { func (ca *Cmds) Update(endpoint string, data api.DataMap, newDay bool) error {
for range Only.Once { for range Only.Once {
// Also getPowerStatistics, getHouseholdStoragePsReport, getPsList, getUpTimePoint, // Also getPowerStatistics, getHouseholdStoragePsReport, getPsList, getUpTimePoint,
cmdLog.LogPrintDate("Syncing %d entries with HASSIO from %s.\n", len(data.DataPoints), endpoint) cmdLog.LogPrintDate("Syncing %d entries with HASSIO from %s.\n", len(data.Map), endpoint)
for _, o := range data.Order { for _, o := range data.Order {
entries := data.DataPoints[o] entries := data.Map[o]
r := entries.GetEntry(api.LastEntry) // Gets the last entry r := entries.GetEntry(api.LastEntry) // Gets the last entry
if !r.Point.Valid { if !r.Point.Valid {
fmt.Printf("\nInvalid: %v\n", r) fmt.Printf("\nInvalid: %v\n", r)
@ -398,11 +398,11 @@ func (ca *Cmds) Update(endpoint string, data api.DataMap, newDay bool) error {
FullId: fullId, // string(r.FullId), // WAS r.Point.FullId FullId: fullId, // string(r.FullId), // WAS r.Point.FullId
// FullName: r.Point.Name, // FullName: r.Point.Name,
Units: r.Point.Unit, Units: r.Point.Unit,
ValueName: r.Point.Name, ValueName: r.Point.Description,
// ValueName: r.Id, // ValueName: r.Id,
DeviceClass: "", DeviceClass: "",
StateClass: r.Point.TimeSpan, StateClass: r.Point.UpdateFreq,
Value: r.Value, Value: r.Value.String(),
// Icon: "", // Icon: "",
// ValueTemplate: "", // ValueTemplate: "",

View File

@ -3,8 +3,8 @@ package getDeviceList
import ( import (
"GoSungrow/iSolarCloud/api" "GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect" "GoSungrow/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/valueTypes"
"GoSungrow/iSolarCloud/api/output" "GoSungrow/iSolarCloud/api/output"
"GoSungrow/iSolarCloud/api/valueTypes"
"fmt" "fmt"
"github.com/MickMake/GoUnify/Only" "github.com/MickMake/GoUnify/Only"
) )
@ -33,9 +33,9 @@ type ResultData struct {
ConnectState valueTypes.Integer `json:"connect_state"` ConnectState valueTypes.Integer `json:"connect_state"`
DataFlag valueTypes.Integer `json:"data_flag"` DataFlag valueTypes.Integer `json:"data_flag"`
DataFlagDetail valueTypes.Integer `json:"data_flag_detail"` DataFlagDetail valueTypes.Integer `json:"data_flag_detail"`
DevFaultStatus string `json:"dev_fault_status"` DevFaultStatus valueTypes.Integer `json:"dev_fault_status"`
DevStatus string `json:"dev_status"` DevStatus valueTypes.Integer `json:"dev_status"`
DeviceArea string `json:"device_area"` DeviceArea valueTypes.Integer `json:"device_area"`
DeviceCode valueTypes.Integer `json:"device_code"` DeviceCode valueTypes.Integer `json:"device_code"`
DeviceFactoryDate valueTypes.DateTime `json:"device_factory_date"` DeviceFactoryDate valueTypes.DateTime `json:"device_factory_date"`
DeviceID valueTypes.Integer `json:"device_id"` DeviceID valueTypes.Integer `json:"device_id"`
@ -44,12 +44,12 @@ type ResultData struct {
DeviceModelID valueTypes.Integer `json:"device_model_id"` DeviceModelID valueTypes.Integer `json:"device_model_id"`
DeviceName valueTypes.String `json:"device_name"` DeviceName valueTypes.String `json:"device_name"`
DeviceProSn valueTypes.String `json:"device_pro_sn"` DeviceProSn valueTypes.String `json:"device_pro_sn"`
DeviceState string `json:"device_state"` DeviceState valueTypes.Integer `json:"device_state"`
DeviceSubType interface{} `json:"device_sub_type"` DeviceSubType interface{} `json:"device_sub_type"`
DeviceSubTypeName interface{} `json:"device_sub_type_name"` DeviceSubTypeName interface{} `json:"device_sub_type_name"`
DeviceType valueTypes.Integer `json:"device_type"` DeviceType valueTypes.Integer `json:"device_type"`
FactoryName valueTypes.String `json:"factory_name"` FactoryName valueTypes.String `json:"factory_name"`
InstallerDevFaultStatus string `json:"installer_dev_fault_status"` InstallerDevFaultStatus valueTypes.Integer `json:"installer_dev_fault_status"`
InverterModelType valueTypes.Integer `json:"inverter_model_type"` InverterModelType valueTypes.Integer `json:"inverter_model_type"`
IsCountryCheck valueTypes.Bool `json:"is_country_check"` IsCountryCheck valueTypes.Bool `json:"is_country_check"`
IsHasFunctionEnum valueTypes.Bool `json:"is_has_function_enum"` IsHasFunctionEnum valueTypes.Bool `json:"is_has_function_enum"`
@ -61,7 +61,7 @@ type ResultData struct {
IsSecond valueTypes.Bool `json:"is_second"` IsSecond valueTypes.Bool `json:"is_second"`
IsThirdParty valueTypes.Bool `json:"is_third_party"` IsThirdParty valueTypes.Bool `json:"is_third_party"`
ModuleUUID valueTypes.Integer `json:"module_uuid"` ModuleUUID valueTypes.Integer `json:"module_uuid"`
OwnerDevFaultStatus string `json:"owner_dev_fault_status"` OwnerDevFaultStatus valueTypes.Integer `json:"owner_dev_fault_status"`
P24 interface{} `json:"p24"` P24 interface{} `json:"p24"`
Posx interface{} `json:"posx"` Posx interface{} `json:"posx"`
Posy interface{} `json:"posy"` Posy interface{} `json:"posy"`
@ -86,25 +86,6 @@ func (e *ResultData) IsValid() error {
return err return err
} }
//type DecodeResultData ResultData
//
//func (e *ResultData) UnmarshalJSON(data []byte) error {
// var err error
//
// for range Only.Once {
// if len(data) == 0 {
// break
// }
// var pd DecodeResultData
//
// // Store ResultData
// _ = json.Unmarshal(data, &pd)
// e.Dummy = pd.Dummy
// }
//
// return err
//}
type Device struct { type Device struct {
Vendor valueTypes.String Vendor valueTypes.String
PsId valueTypes.Integer PsId valueTypes.Integer
@ -117,8 +98,8 @@ type Device struct {
ChannelId valueTypes.Integer ChannelId valueTypes.Integer
DeviceModelID valueTypes.Integer DeviceModelID valueTypes.Integer
TypeName valueTypes.String TypeName valueTypes.String
DeviceState string DeviceState valueTypes.Integer
DevStatus string DevStatus valueTypes.Integer
Uuid valueTypes.Integer Uuid valueTypes.Integer
} }
type Devices []Device type Devices []Device
@ -284,7 +265,7 @@ func (e *EndPoint) GetData() api.DataMap {
for range Only.Once { for range Only.Once {
pkg := apiReflect.GetName("", *e) pkg := apiReflect.GetName("", *e)
for _, d := range e.Response.ResultData.PageList { for _, d := range e.Response.ResultData.PageList {
name := fmt.Sprintf("%s.%s", pkg, d.PsKey.Value()) name := api.JoinWithDots(0, valueTypes.DateTimeLayoutDay, pkg, d.PsKey)
entries.StructToPoints(d, name, e.Request.PsId.String(), valueTypes.NewDateTime("")) entries.StructToPoints(d, name, e.Request.PsId.String(), valueTypes.NewDateTime(""))
} }
} }

View File

@ -46,42 +46,42 @@ type DayData struct {
JthdMapVirgin valueTypes.UnitValue `json:"jthd_map_virgin" PointIgnore:"true"` JthdMapVirgin valueTypes.UnitValue `json:"jthd_map_virgin" PointIgnore:"true"`
JtydMap valueTypes.UnitValue `json:"jtyd_map"` JtydMap valueTypes.UnitValue `json:"jtyd_map"`
JtydMapVirgin valueTypes.UnitValue `json:"jtyd_map_virgin" PointIgnore:"true"` JtydMapVirgin valueTypes.UnitValue `json:"jtyd_map_virgin" PointIgnore:"true"`
P83072Map valueTypes.UnitValue `json:"p83072_map" PointId:"p83072" PointValueType:"" PointTimeSpan:"PointTimeSpanDaily"` P83072Map valueTypes.UnitValue `json:"p83072_map" PointId:"p83072" PointValueType:"" PointUpdateFreq:"UpdateFreqDaily"`
P83072MapVirgin valueTypes.UnitValue `json:"p83072_map_virgin" PointIgnore:"true"` P83072MapVirgin valueTypes.UnitValue `json:"p83072_map_virgin" PointIgnore:"true"`
P83077Map valueTypes.UnitValue `json:"p83077_map" PointId:"p83077" PointValueType:"" PointTimeSpan:"PointTimeSpanDaily"` P83077Map valueTypes.UnitValue `json:"p83077_map" PointId:"p83077" PointValueType:"" PointUpdateFreq:"UpdateFreqDaily"`
P83077MapVirgin valueTypes.UnitValue `json:"p83077_map_virgin" PointIgnore:"true"` P83077MapVirgin valueTypes.UnitValue `json:"p83077_map_virgin" PointIgnore:"true"`
P83088Map valueTypes.UnitValue `json:"p83088_map" PointId:"p83088" PointValueType:"" PointTimeSpan:"PointTimeSpanDaily"` P83088Map valueTypes.UnitValue `json:"p83088_map" PointId:"p83088" PointValueType:"" PointUpdateFreq:"UpdateFreqDaily"`
P83088MapVirgin valueTypes.UnitValue `json:"p83088_map_virgin" PointIgnore:"true"` P83088MapVirgin valueTypes.UnitValue `json:"p83088_map_virgin" PointIgnore:"true"`
P83089Map valueTypes.UnitValue `json:"p83089_map" PointId:"p83089" PointValueType:"" PointTimeSpan:"PointTimeSpanDaily"` P83089Map valueTypes.UnitValue `json:"p83089_map" PointId:"p83089" PointValueType:"" PointUpdateFreq:"UpdateFreqDaily"`
P83089MapVirgin valueTypes.UnitValue `json:"p83089_map_virgin" PointIgnore:"true"` P83089MapVirgin valueTypes.UnitValue `json:"p83089_map_virgin" PointIgnore:"true"`
P83097Map valueTypes.UnitValue `json:"p83097_map" PointId:"p83097" PointValueType:"" PointTimeSpan:"PointTimeSpanDaily"` P83097Map valueTypes.UnitValue `json:"p83097_map" PointId:"p83097" PointValueType:"" PointUpdateFreq:"UpdateFreqDaily"`
P83097MapVirgin valueTypes.UnitValue `json:"p83097_map_virgin" PointIgnore:"true"` P83097MapVirgin valueTypes.UnitValue `json:"p83097_map_virgin" PointIgnore:"true"`
P83102Map valueTypes.UnitValue `json:"p83102_map" PointId:"p83102" PointValueType:"" PointTimeSpan:"PointTimeSpanDaily"` P83102Map valueTypes.UnitValue `json:"p83102_map" PointId:"p83102" PointValueType:"" PointUpdateFreq:"UpdateFreqDaily"`
P83102MapVirgin valueTypes.UnitValue `json:"p83102_map_virgin" PointIgnore:"true"` P83102MapVirgin valueTypes.UnitValue `json:"p83102_map_virgin" PointIgnore:"true"`
P83118Map valueTypes.UnitValue `json:"p83118_map" PointId:"p83118" PointValueType:"" PointTimeSpan:"PointTimeSpanDaily"` P83118Map valueTypes.UnitValue `json:"p83118_map" PointId:"p83118" PointValueType:"" PointUpdateFreq:"UpdateFreqDaily"`
P83118MapVirgin valueTypes.UnitValue `json:"p83118_map_virgin" PointIgnore:"true"` P83118MapVirgin valueTypes.UnitValue `json:"p83118_map_virgin" PointIgnore:"true"`
P83119Map valueTypes.UnitValue `json:"p83119_map" PointId:"p83119" PointValueType:"" PointTimeSpan:"PointTimeSpanDaily"` P83119Map valueTypes.UnitValue `json:"p83119_map" PointId:"p83119" PointValueType:"" PointUpdateFreq:"UpdateFreqDaily"`
P83119MapVirgin valueTypes.UnitValue `json:"p83119_map_virgin" PointIgnore:"true"` P83119MapVirgin valueTypes.UnitValue `json:"p83119_map_virgin" PointIgnore:"true"`
P83120Map valueTypes.UnitValue `json:"p83120_map" PointId:"p83120" PointValueType:"" PointTimeSpan:"PointTimeSpanDaily"` P83120Map valueTypes.UnitValue `json:"p83120_map" PointId:"p83120" PointValueType:"" PointUpdateFreq:"UpdateFreqDaily"`
P83120MapVirgin valueTypes.UnitValue `json:"p83120_map_virgin" PointIgnore:"true"` P83120MapVirgin valueTypes.UnitValue `json:"p83120_map_virgin" PointIgnore:"true"`
P83121 valueTypes.Float `json:"p83121" PointId:"p83121" PointUnitFrom:"FOO" PointTimeSpan:"PointTimeSpanDaily"` P83121 valueTypes.Float `json:"p83121" PointId:"p83121" PointUnitFrom:"FOO" PointUpdateFreq:"UpdateFreqDaily"`
P83122 valueTypes.Float `json:"p83122" PointId:"p83122" PointUnitFrom:"FOO" PointTimeSpan:"PointTimeSpanDaily"` P83122 valueTypes.Float `json:"p83122" PointId:"p83122" PointUnitFrom:"FOO" PointUpdateFreq:"UpdateFreqDaily"`
PointData15List []struct { PointData15List []struct {
P83076 valueTypes.Float `json:"p83076" PointId:"p83076" PointUnitFrom:"p83076_unit" PointTimeSpan:"PointTimeSpanDaily"` P83076 valueTypes.Float `json:"p83076" PointId:"p83076" PointUnitFrom:"p83076_unit" PointUpdateFreq:"UpdateFreqDaily"`
P83076Unit valueTypes.String `json:"p83076_unit"` P83076Unit valueTypes.String `json:"p83076_unit"`
P83080 valueTypes.Float `json:"p83080" PointId:"p83080" PointUnitFrom:"p83080_unit" PointTimeSpan:"PointTimeSpanDaily"` P83080 valueTypes.Float `json:"p83080" PointId:"p83080" PointUnitFrom:"p83080_unit" PointUpdateFreq:"UpdateFreqDaily"`
P83080Unit valueTypes.String `json:"p83080_unit"` P83080Unit valueTypes.String `json:"p83080_unit"`
P83086 valueTypes.Float `json:"p83086" PointId:"p83086" PointUnitFrom:"p83086_unit" PointTimeSpan:"PointTimeSpanDaily"` P83086 valueTypes.Float `json:"p83086" PointId:"p83086" PointUnitFrom:"p83086_unit" PointUpdateFreq:"UpdateFreqDaily"`
P83086Unit valueTypes.String `json:"p83086_unit"` P83086Unit valueTypes.String `json:"p83086_unit"`
P83087 valueTypes.Float `json:"p83087" PointId:"p83087" PointUnitFrom:"p83087_unit" PointTimeSpan:"PointTimeSpanDaily"` P83087 valueTypes.Float `json:"p83087" PointId:"p83087" PointUnitFrom:"p83087_unit" PointUpdateFreq:"UpdateFreqDaily"`
P83087Unit valueTypes.String `json:"p83087_unit"` P83087Unit valueTypes.String `json:"p83087_unit"`
P83096 valueTypes.Float `json:"p83096" PointId:"p83096" PointUnitFrom:"p83096_unit" PointTimeSpan:"PointTimeSpanDaily"` P83096 valueTypes.Float `json:"p83096" PointId:"p83096" PointUnitFrom:"p83096_unit" PointUpdateFreq:"UpdateFreqDaily"`
P83096Unit valueTypes.String `json:"p83096_unit"` P83096Unit valueTypes.String `json:"p83096_unit"`
P83101 valueTypes.Float `json:"p83101" PointId:"p83101" PointUnitFrom:"p83101_unit" PointTimeSpan:"PointTimeSpanDaily"` P83101 valueTypes.Float `json:"p83101" PointId:"p83101" PointUnitFrom:"p83101_unit" PointUpdateFreq:"UpdateFreqDaily"`
P83101Unit valueTypes.String `json:"p83101_unit"` P83101Unit valueTypes.String `json:"p83101_unit"`
P83106 valueTypes.Float `json:"p83106" PointId:"p83106" PointUnitFrom:"p83106_unit" PointTimeSpan:"PointTimeSpanDaily"` P83106 valueTypes.Float `json:"p83106" PointId:"p83106" PointUnitFrom:"p83106_unit" PointUpdateFreq:"UpdateFreqDaily"`
P83106Unit valueTypes.String `json:"p83106_unit"` P83106Unit valueTypes.String `json:"p83106_unit"`
P83128 valueTypes.Float `json:"p83128" PointId:"p83128" PointUnitFrom:"p83128_unit" PointTimeSpan:"PointTimeSpanDaily"` P83128 valueTypes.Float `json:"p83128" PointId:"p83128" PointUnitFrom:"p83128_unit" PointUpdateFreq:"UpdateFreqDaily"`
P83128Unit valueTypes.String `json:"p83128_unit"` P83128Unit valueTypes.String `json:"p83128_unit"`
TimeStamp valueTypes.DateTime `json:"time_stamp"` TimeStamp valueTypes.DateTime `json:"time_stamp"`
Zfzy valueTypes.Float `json:"zfzy" PointUnitFrom:"zfzy_unit"` Zfzy valueTypes.Float `json:"zfzy" PointUnitFrom:"zfzy_unit"`
@ -104,51 +104,51 @@ type MonthData struct {
JthdUnit valueTypes.String `json:"jthd_unit"` JthdUnit valueTypes.String `json:"jthd_unit"`
Jtyd valueTypes.Float `json:"jtyd" PointUnitFrom:"jtyd_unit"` Jtyd valueTypes.Float `json:"jtyd" PointUnitFrom:"jtyd_unit"`
JtydUnit valueTypes.String `json:"jtyd_unit"` JtydUnit valueTypes.String `json:"jtyd_unit"`
P83022 valueTypes.Float `json:"p83022" PointId:"p83022" PointTimeSpan:"PointTimeSpanMonthly"` P83022 valueTypes.Float `json:"p83022" PointId:"p83022" PointUpdateFreq:"UpdateFreqMonthly"`
P83072 valueTypes.Float `json:"p83072" PointId:"p83072" PointUnitFrom:"p83072_unit" PointTimeSpan:"PointTimeSpanMonthly"` P83072 valueTypes.Float `json:"p83072" PointId:"p83072" PointUnitFrom:"p83072_unit" PointUpdateFreq:"UpdateFreqMonthly"`
P83072Unit valueTypes.String `json:"p83072_unit"` P83072Unit valueTypes.String `json:"p83072_unit"`
P83077 valueTypes.Float `json:"p83077" PointId:"p83077" PointUnitFrom:"p83077_unit" PointTimeSpan:"PointTimeSpanMonthly"` P83077 valueTypes.Float `json:"p83077" PointId:"p83077" PointUnitFrom:"p83077_unit" PointUpdateFreq:"UpdateFreqMonthly"`
P83077Unit valueTypes.String `json:"p83077_unit"` P83077Unit valueTypes.String `json:"p83077_unit"`
P83088 valueTypes.Float `json:"p83088" PointId:"p83088" PointUnitFrom:"p83088_unit" PointTimeSpan:"PointTimeSpanMonthly"` P83088 valueTypes.Float `json:"p83088" PointId:"p83088" PointUnitFrom:"p83088_unit" PointUpdateFreq:"UpdateFreqMonthly"`
P83088Unit valueTypes.String `json:"p83088_unit"` P83088Unit valueTypes.String `json:"p83088_unit"`
P83089 valueTypes.Float `json:"p83089" PointId:"p83089" PointUnitFrom:"p83089_unit" PointTimeSpan:"PointTimeSpanMonthly"` P83089 valueTypes.Float `json:"p83089" PointId:"p83089" PointUnitFrom:"p83089_unit" PointUpdateFreq:"UpdateFreqMonthly"`
P83089Unit valueTypes.String `json:"p83089_unit"` P83089Unit valueTypes.String `json:"p83089_unit"`
P83097 valueTypes.Float `json:"p83097" PointId:"p83097" PointUnitFrom:"p83097_unit" PointTimeSpan:"PointTimeSpanMonthly"` P83097 valueTypes.Float `json:"p83097" PointId:"p83097" PointUnitFrom:"p83097_unit" PointUpdateFreq:"UpdateFreqMonthly"`
P83097Unit valueTypes.String `json:"p83097_unit"` P83097Unit valueTypes.String `json:"p83097_unit"`
P83102 valueTypes.Float `json:"p83102" PointId:"p83102" PointUnitFrom:"p83102_unit" PointTimeSpan:"PointTimeSpanMonthly"` P83102 valueTypes.Float `json:"p83102" PointId:"p83102" PointUnitFrom:"p83102_unit" PointUpdateFreq:"UpdateFreqMonthly"`
P83102Unit valueTypes.String `json:"p83102_unit"` P83102Unit valueTypes.String `json:"p83102_unit"`
P83118 valueTypes.Float `json:"p83118" PointId:"p83118" PointUnitFrom:"p83118_unit" PointTimeSpan:"PointTimeSpanMonthly"` P83118 valueTypes.Float `json:"p83118" PointId:"p83118" PointUnitFrom:"p83118_unit" PointUpdateFreq:"UpdateFreqMonthly"`
P83118Unit valueTypes.String `json:"p83118_unit"` P83118Unit valueTypes.String `json:"p83118_unit"`
P83119 valueTypes.Float `json:"p83119" PointId:"p83119" PointUnitFrom:"p83119_unit" PointTimeSpan:"PointTimeSpanMonthly"` P83119 valueTypes.Float `json:"p83119" PointId:"p83119" PointUnitFrom:"p83119_unit" PointUpdateFreq:"UpdateFreqMonthly"`
P83119Unit valueTypes.String `json:"p83119_unit"` P83119Unit valueTypes.String `json:"p83119_unit"`
P83120 valueTypes.Float `json:"p83120" PointId:"p83120" PointTimeSpan:"PointTimeSpanMonthly"` P83120 valueTypes.Float `json:"p83120" PointId:"p83120" PointUpdateFreq:"UpdateFreqMonthly"`
P83121 valueTypes.Float `json:"p83121" PointId:"p83121" PointTimeSpan:"PointTimeSpanMonthly"` P83121 valueTypes.Float `json:"p83121" PointId:"p83121" PointUpdateFreq:"UpdateFreqMonthly"`
P83122 valueTypes.Float `json:"p83122" PointId:"p83122" PointTimeSpan:"PointTimeSpanMonthly"` P83122 valueTypes.Float `json:"p83122" PointId:"p83122" PointUpdateFreq:"UpdateFreqMonthly"`
PsID valueTypes.Integer `json:"ps_id"` PsID valueTypes.Integer `json:"ps_id"`
SelfConsumptionYield valueTypes.Float `json:"self_consumption_yield" PointUnitFrom:"self_consumption_yield_unit"` SelfConsumptionYield valueTypes.Float `json:"self_consumption_yield" PointUnitFrom:"self_consumption_yield_unit"`
SelfConsumptionYieldUnit valueTypes.String `json:"self_consumption_yield_unit"` SelfConsumptionYieldUnit valueTypes.String `json:"self_consumption_yield_unit"`
TimeStamp valueTypes.DateTime `json:"time_stamp"` TimeStamp valueTypes.DateTime `json:"time_stamp"`
} `json:"month_data_day_list"` } `json:"month_data_day_list"`
P83073Map valueTypes.UnitValue `json:"p83073_map" PointId:"p83073" PointValueType:"" PointTimeSpan:"PointTimeSpanMonthly"` P83073Map valueTypes.UnitValue `json:"p83073_map" PointId:"p83073" PointValueType:"" PointUpdateFreq:"UpdateFreqMonthly"`
P83073MapVirgin valueTypes.UnitValue `json:"p83073_map_virgin" PointIgnore:"true"` P83073MapVirgin valueTypes.UnitValue `json:"p83073_map_virgin" PointIgnore:"true"`
P83078Map valueTypes.UnitValue `json:"p83078_map" PointId:"p83078" PointValueType:"" PointTimeSpan:"PointTimeSpanMonthly"` P83078Map valueTypes.UnitValue `json:"p83078_map" PointId:"p83078" PointValueType:"" PointUpdateFreq:"UpdateFreqMonthly"`
P83078MapVirgin valueTypes.UnitValue `json:"p83078_map_virgin" PointIgnore:"true"` P83078MapVirgin valueTypes.UnitValue `json:"p83078_map_virgin" PointIgnore:"true"`
P83088Map valueTypes.UnitValue `json:"p83088_map" PointId:"p83088" PointValueType:"" PointTimeSpan:"PointTimeSpanMonthly"` P83088Map valueTypes.UnitValue `json:"p83088_map" PointId:"p83088" PointValueType:"" PointUpdateFreq:"UpdateFreqMonthly"`
P83088MapVirgin valueTypes.UnitValue `json:"p83088_map_virgin" PointIgnore:"true"` P83088MapVirgin valueTypes.UnitValue `json:"p83088_map_virgin" PointIgnore:"true"`
P83091Map valueTypes.UnitValue `json:"p83091_map" PointId:"p83091" PointValueType:"" PointTimeSpan:"PointTimeSpanMonthly"` P83091Map valueTypes.UnitValue `json:"p83091_map" PointId:"p83091" PointValueType:"" PointUpdateFreq:"UpdateFreqMonthly"`
P83091MapVirgin valueTypes.UnitValue `json:"p83091_map_virgin" PointIgnore:"true"` P83091MapVirgin valueTypes.UnitValue `json:"p83091_map_virgin" PointIgnore:"true"`
P83097Map valueTypes.UnitValue `json:"p83097_map" PointId:"p83097" PointValueType:"" PointTimeSpan:"PointTimeSpanMonthly"` P83097Map valueTypes.UnitValue `json:"p83097_map" PointId:"p83097" PointValueType:"" PointUpdateFreq:"UpdateFreqMonthly"`
P83097MapVirgin valueTypes.UnitValue `json:"p83097_map_virgin" PointIgnore:"true"` P83097MapVirgin valueTypes.UnitValue `json:"p83097_map_virgin" PointIgnore:"true"`
P83103Map valueTypes.UnitValue `json:"p83103_map" PointId:"p83103" PointValueType:"" PointTimeSpan:"PointTimeSpanMonthly"` P83103Map valueTypes.UnitValue `json:"p83103_map" PointId:"p83103" PointValueType:"" PointUpdateFreq:"UpdateFreqMonthly"`
P83103MapVirgin valueTypes.UnitValue `json:"p83103_map_virgin" PointIgnore:"true"` P83103MapVirgin valueTypes.UnitValue `json:"p83103_map_virgin" PointIgnore:"true"`
P83118Map valueTypes.UnitValue `json:"p83118_map" PointId:"p83118" PointValueType:"" PointTimeSpan:"PointTimeSpanMonthly"` P83118Map valueTypes.UnitValue `json:"p83118_map" PointId:"p83118" PointValueType:"" PointUpdateFreq:"UpdateFreqMonthly"`
P83118MapVirgin valueTypes.UnitValue `json:"p83118_map_virgin" PointIgnore:"true"` P83118MapVirgin valueTypes.UnitValue `json:"p83118_map_virgin" PointIgnore:"true"`
P83119Map valueTypes.UnitValue `json:"p83119_map" PointId:"p83119" PointValueType:"" PointTimeSpan:"PointTimeSpanMonthly"` P83119Map valueTypes.UnitValue `json:"p83119_map" PointId:"p83119" PointValueType:"" PointUpdateFreq:"UpdateFreqMonthly"`
P83119MapVirgin valueTypes.UnitValue `json:"p83119_map_virgin" PointIgnore:"true"` P83119MapVirgin valueTypes.UnitValue `json:"p83119_map_virgin" PointIgnore:"true"`
P83120Map valueTypes.UnitValue `json:"p83120_map" PointId:"p83120" PointValueType:"" PointTimeSpan:"PointTimeSpanMonthly"` P83120Map valueTypes.UnitValue `json:"p83120_map" PointId:"p83120" PointValueType:"" PointUpdateFreq:"UpdateFreqMonthly"`
P83120MapVirgin valueTypes.UnitValue `json:"p83120_map_virgin" PointIgnore:"true"` P83120MapVirgin valueTypes.UnitValue `json:"p83120_map_virgin" PointIgnore:"true"`
P83121 valueTypes.Float `json:"p83121" PointId:"p83121" PointUnitFrom:"FOO" PointTimeSpan:"PointTimeSpanMonthly"` P83121 valueTypes.Float `json:"p83121" PointId:"p83121" PointUnitFrom:"FOO" PointUpdateFreq:"UpdateFreqMonthly"`
P83122 valueTypes.Float `json:"p83122" PointId:"p83122" PointUnitFrom:"FOO" PointTimeSpan:"PointTimeSpanMonthly"` P83122 valueTypes.Float `json:"p83122" PointId:"p83122" PointUnitFrom:"FOO" PointUpdateFreq:"UpdateFreqMonthly"`
ZfzyMap valueTypes.UnitValue `json:"zfzy_map"` ZfzyMap valueTypes.UnitValue `json:"zfzy_map"`
ZfzyMapVirgin valueTypes.UnitValue `json:"zfzy_map_virgin" PointIgnore:"true"` ZfzyMapVirgin valueTypes.UnitValue `json:"zfzy_map_virgin" PointIgnore:"true"`
ZjzzMap valueTypes.UnitValue `json:"zjzz_map"` ZjzzMap valueTypes.UnitValue `json:"zjzz_map"`
@ -160,52 +160,52 @@ type YearData struct {
JthdMapVirgin valueTypes.UnitValue `json:"jthd_map_virgin" PointIgnore:"true"` JthdMapVirgin valueTypes.UnitValue `json:"jthd_map_virgin" PointIgnore:"true"`
JtydMap valueTypes.UnitValue `json:"jtyd_map"` JtydMap valueTypes.UnitValue `json:"jtyd_map"`
JtydMapVirgin valueTypes.UnitValue `json:"jtyd_map_virgin" PointIgnore:"true"` JtydMapVirgin valueTypes.UnitValue `json:"jtyd_map_virgin" PointIgnore:"true"`
P83074 valueTypes.UnitValue `json:"p83074_map" PointId:"p83074" PointValueType:"" PointTimeSpan:"PointTimeSpanYearly"` P83074 valueTypes.UnitValue `json:"p83074_map" PointId:"p83074" PointValueType:"" PointUpdateFreq:"UpdateFreqYearly"`
P83074MapVirgin valueTypes.UnitValue `json:"p83074_map_virgin" PointIgnore:"true"` P83074MapVirgin valueTypes.UnitValue `json:"p83074_map_virgin" PointIgnore:"true"`
P83079 valueTypes.UnitValue `json:"p83079_map" PointId:"p83079" PointValueType:"" PointTimeSpan:"PointTimeSpanYearly"` P83079 valueTypes.UnitValue `json:"p83079_map" PointId:"p83079" PointValueType:"" PointUpdateFreq:"UpdateFreqYearly"`
P83079MapVirgin valueTypes.UnitValue `json:"p83079_map_virgin" PointIgnore:"true"` P83079MapVirgin valueTypes.UnitValue `json:"p83079_map_virgin" PointIgnore:"true"`
P83088 valueTypes.UnitValue `json:"p83088_map" PointId:"p83088" PointValueType:"" PointTimeSpan:"PointTimeSpanYearly"` P83088 valueTypes.UnitValue `json:"p83088_map" PointId:"p83088" PointValueType:"" PointUpdateFreq:"UpdateFreqYearly"`
P83088MapVirgin valueTypes.UnitValue `json:"p83088_map_virgin" PointIgnore:"true"` P83088MapVirgin valueTypes.UnitValue `json:"p83088_map_virgin" PointIgnore:"true"`
P83093 valueTypes.UnitValue `json:"p83093_map" PointId:"p83093" PointValueType:"" PointTimeSpan:"PointTimeSpanYearly"` P83093 valueTypes.UnitValue `json:"p83093_map" PointId:"p83093" PointValueType:"" PointUpdateFreq:"UpdateFreqYearly"`
P83093MapVirgin valueTypes.UnitValue `json:"p83093_map_virgin" PointIgnore:"true"` P83093MapVirgin valueTypes.UnitValue `json:"p83093_map_virgin" PointIgnore:"true"`
P83097 valueTypes.UnitValue `json:"p83097_map" PointId:"p83097" PointValueType:"" PointTimeSpan:"PointTimeSpanYearly"` P83097 valueTypes.UnitValue `json:"p83097_map" PointId:"p83097" PointValueType:"" PointUpdateFreq:"UpdateFreqYearly"`
P83097MapVirgin valueTypes.UnitValue `json:"p83097_map_virgin" PointIgnore:"true"` P83097MapVirgin valueTypes.UnitValue `json:"p83097_map_virgin" PointIgnore:"true"`
P83104 valueTypes.UnitValue `json:"p83104_map" PointId:"p83104" PointValueType:"" PointTimeSpan:"PointTimeSpanYearly"` P83104 valueTypes.UnitValue `json:"p83104_map" PointId:"p83104" PointValueType:"" PointUpdateFreq:"UpdateFreqYearly"`
P83104MapVirgin valueTypes.UnitValue `json:"p83104_map_virgin" PointIgnore:"true"` P83104MapVirgin valueTypes.UnitValue `json:"p83104_map_virgin" PointIgnore:"true"`
P83118 valueTypes.UnitValue `json:"p83118_map" PointId:"p83118" PointValueType:"" PointTimeSpan:"PointTimeSpanYearly"` P83118 valueTypes.UnitValue `json:"p83118_map" PointId:"p83118" PointValueType:"" PointUpdateFreq:"UpdateFreqYearly"`
P83118MapVirgin valueTypes.UnitValue `json:"p83118_map_virgin" PointIgnore:"true"` P83118MapVirgin valueTypes.UnitValue `json:"p83118_map_virgin" PointIgnore:"true"`
P83119 valueTypes.UnitValue `json:"p83119_map" PointId:"p83119" PointValueType:"" PointTimeSpan:"PointTimeSpanYearly"` P83119 valueTypes.UnitValue `json:"p83119_map" PointId:"p83119" PointValueType:"" PointUpdateFreq:"UpdateFreqYearly"`
P83119MapVirgin valueTypes.UnitValue `json:"p83119_map_virgin" PointIgnore:"true"` P83119MapVirgin valueTypes.UnitValue `json:"p83119_map_virgin" PointIgnore:"true"`
P83120 valueTypes.UnitValue `json:"p83120_map" PointId:"p83120" PointValueType:"" PointTimeSpan:"PointTimeSpanYearly"` P83120 valueTypes.UnitValue `json:"p83120_map" PointId:"p83120" PointValueType:"" PointUpdateFreq:"UpdateFreqYearly"`
P83120MapVirgin valueTypes.UnitValue `json:"p83120_map_virgin" PointIgnore:"true"` P83120MapVirgin valueTypes.UnitValue `json:"p83120_map_virgin" PointIgnore:"true"`
P83121 valueTypes.Float `json:"p83121" PointId:"p83121" PointUnitFrom:"FOO" PointTimeSpan:"PointTimeSpanYearly"` P83121 valueTypes.Float `json:"p83121" PointId:"p83121" PointUnitFrom:"FOO" PointUpdateFreq:"UpdateFreqYearly"`
P83122 valueTypes.Float `json:"p83122" PointId:"p83122" PointUnitFrom:"FOO" PointTimeSpan:"PointTimeSpanYearly"` P83122 valueTypes.Float `json:"p83122" PointId:"p83122" PointUnitFrom:"FOO" PointUpdateFreq:"UpdateFreqYearly"`
YearDataMonthList []struct { YearDataMonthList []struct {
DateID valueTypes.Integer `json:"date_id"` DateID valueTypes.Integer `json:"date_id"`
Jthd valueTypes.Float `json:"jthd" PointUnitFrom:"jthd_unit"` Jthd valueTypes.Float `json:"jthd" PointUnitFrom:"jthd_unit"`
JthdUnit valueTypes.String `json:"jthd_unit"` JthdUnit valueTypes.String `json:"jthd_unit"`
Jtyd valueTypes.Float `json:"jtyd" PointUnitFrom:"jtyd_unit"` Jtyd valueTypes.Float `json:"jtyd" PointUnitFrom:"jtyd_unit"`
JtydUnit valueTypes.String `json:"jtyd_unit"` JtydUnit valueTypes.String `json:"jtyd_unit"`
P83037 valueTypes.Float `json:"p83037" PointId:"p83037" PointTimeSpan:"PointTimeSpanYearly"` P83037 valueTypes.Float `json:"p83037" PointId:"p83037" PointUpdateFreq:"UpdateFreqYearly"`
P83073 valueTypes.Float `json:"p83073" PointId:"p83073" PointUnitFrom:"p83073_unit" PointTimeSpan:"PointTimeSpanYearly"` P83073 valueTypes.Float `json:"p83073" PointId:"p83073" PointUnitFrom:"p83073_unit" PointUpdateFreq:"UpdateFreqYearly"`
P83073Unit valueTypes.String `json:"p83073_unit"` P83073Unit valueTypes.String `json:"p83073_unit"`
P83078 valueTypes.Float `json:"p83078" PointId:"p83078" PointUnitFrom:"p83078_unit" PointTimeSpan:"PointTimeSpanYearly"` P83078 valueTypes.Float `json:"p83078" PointId:"p83078" PointUnitFrom:"p83078_unit" PointUpdateFreq:"UpdateFreqYearly"`
P83078Unit valueTypes.String `json:"p83078_unit"` P83078Unit valueTypes.String `json:"p83078_unit"`
P83088 valueTypes.Float `json:"p83088" PointId:"p83088" PointUnitFrom:"p83088_unit" PointTimeSpan:"PointTimeSpanYearly"` P83088 valueTypes.Float `json:"p83088" PointId:"p83088" PointUnitFrom:"p83088_unit" PointUpdateFreq:"UpdateFreqYearly"`
P83088Unit valueTypes.String `json:"p83088_unit"` P83088Unit valueTypes.String `json:"p83088_unit"`
P83091 valueTypes.Float `json:"p83091" PointId:"p83091" PointUnitFrom:"p83091_unit" PointTimeSpan:"PointTimeSpanYearly"` P83091 valueTypes.Float `json:"p83091" PointId:"p83091" PointUnitFrom:"p83091_unit" PointUpdateFreq:"UpdateFreqYearly"`
P83091Unit valueTypes.String `json:"p83091_unit"` P83091Unit valueTypes.String `json:"p83091_unit"`
P83098 valueTypes.Float `json:"p83098" PointId:"p83098" PointUnitFrom:"p83098_unit" PointTimeSpan:"PointTimeSpanYearly"` P83098 valueTypes.Float `json:"p83098" PointId:"p83098" PointUnitFrom:"p83098_unit" PointUpdateFreq:"UpdateFreqYearly"`
P83098Unit valueTypes.String `json:"p83098_unit"` P83098Unit valueTypes.String `json:"p83098_unit"`
P83103 valueTypes.Float `json:"p83103" PointId:"p83103" PointUnitFrom:"p83103_unit" PointTimeSpan:"PointTimeSpanYearly"` P83103 valueTypes.Float `json:"p83103" PointId:"p83103" PointUnitFrom:"p83103_unit" PointUpdateFreq:"UpdateFreqYearly"`
P83103Unit valueTypes.String `json:"p83103_unit"` P83103Unit valueTypes.String `json:"p83103_unit"`
P83118 valueTypes.Float `json:"p83118" PointId:"p83118" PointUnitFrom:"p83118_unit" PointTimeSpan:"PointTimeSpanYearly"` P83118 valueTypes.Float `json:"p83118" PointId:"p83118" PointUnitFrom:"p83118_unit" PointUpdateFreq:"UpdateFreqYearly"`
P83118Unit valueTypes.String `json:"p83118_unit"` P83118Unit valueTypes.String `json:"p83118_unit"`
P83119 valueTypes.Float `json:"p83119" PointId:"p83119" PointUnitFrom:"p83119_unit" PointTimeSpan:"PointTimeSpanYearly"` P83119 valueTypes.Float `json:"p83119" PointId:"p83119" PointUnitFrom:"p83119_unit" PointUpdateFreq:"UpdateFreqYearly"`
P83119Unit valueTypes.String `json:"p83119_unit"` P83119Unit valueTypes.String `json:"p83119_unit"`
P83120 valueTypes.Float `json:"p83120" PointId:"p83120" PointTimeSpan:"PointTimeSpanYearly"` P83120 valueTypes.Float `json:"p83120" PointId:"p83120" PointUpdateFreq:"UpdateFreqYearly"`
P83121 valueTypes.Float `json:"p83121" PointId:"p83121" PointTimeSpan:"PointTimeSpanYearly"` P83121 valueTypes.Float `json:"p83121" PointId:"p83121" PointUpdateFreq:"UpdateFreqYearly"`
P83122 valueTypes.Float `json:"p83122" PointId:"p83122" PointTimeSpan:"PointTimeSpanYearly"` P83122 valueTypes.Float `json:"p83122" PointId:"p83122" PointUpdateFreq:"UpdateFreqYearly"`
PsID valueTypes.Integer `json:"ps_id"` PsID valueTypes.Integer `json:"ps_id"`
SelfConsumptionYield valueTypes.Float `json:"self_consumption_yield" PointUnitFrom:"self_consumption_yield_unit"` SelfConsumptionYield valueTypes.Float `json:"self_consumption_yield" PointUnitFrom:"self_consumption_yield_unit"`
SelfConsumptionYieldUnit valueTypes.String `json:"self_consumption_yield_unit"` SelfConsumptionYieldUnit valueTypes.String `json:"self_consumption_yield_unit"`
@ -222,23 +222,23 @@ type TotalData struct {
JthdMapVirgin valueTypes.UnitValue `json:"jthd_map_virgin" PointIgnore:"true"` JthdMapVirgin valueTypes.UnitValue `json:"jthd_map_virgin" PointIgnore:"true"`
JtydMap valueTypes.UnitValue `json:"jtyd_map"` JtydMap valueTypes.UnitValue `json:"jtyd_map"`
JtydMapVirgin valueTypes.UnitValue `json:"jtyd_map_virgin" PointIgnore:"true"` JtydMapVirgin valueTypes.UnitValue `json:"jtyd_map_virgin" PointIgnore:"true"`
P83075 valueTypes.UnitValue `json:"p83075_map" PointId:"p83075" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` P83075 valueTypes.UnitValue `json:"p83075_map" PointId:"p83075" PointValueType:"" PointUpdateFreq:"UpdateFreqTotal"`
P83075MapVirgin valueTypes.UnitValue `json:"p83075_map_virgin" PointIgnore:"true"` P83075MapVirgin valueTypes.UnitValue `json:"p83075_map_virgin" PointIgnore:"true"`
P83094 valueTypes.UnitValue `json:"p83094_map" PointId:"p83094" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` P83094 valueTypes.UnitValue `json:"p83094_map" PointId:"p83094" PointValueType:"" PointUpdateFreq:"UpdateFreqTotal"`
P83094MapVirgin valueTypes.UnitValue `json:"p83094_map_virgin" PointIgnore:"true"` P83094MapVirgin valueTypes.UnitValue `json:"p83094_map_virgin" PointIgnore:"true"`
P83095 valueTypes.UnitValue `json:"p83095_map" PointId:"p83095" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` P83095 valueTypes.UnitValue `json:"p83095_map" PointId:"p83095" PointValueType:"" PointUpdateFreq:"UpdateFreqTotal"`
P83095MapVirgin valueTypes.UnitValue `json:"p83095_map_virgin" PointIgnore:"true"` P83095MapVirgin valueTypes.UnitValue `json:"p83095_map_virgin" PointIgnore:"true"`
P83105 valueTypes.UnitValue `json:"p83105_map" PointId:"p83105" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` P83105 valueTypes.UnitValue `json:"p83105_map" PointId:"p83105" PointValueType:"" PointUpdateFreq:"UpdateFreqTotal"`
P83105MapVirgin valueTypes.UnitValue `json:"p83105_map_virgin" PointIgnore:"true"` P83105MapVirgin valueTypes.UnitValue `json:"p83105_map_virgin" PointIgnore:"true"`
P83107 valueTypes.UnitValue `json:"p83107_map" PointId:"p83107" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` P83107 valueTypes.UnitValue `json:"p83107_map" PointId:"p83107" PointValueType:"" PointUpdateFreq:"UpdateFreqTotal"`
P83107MapVirgin valueTypes.UnitValue `json:"p83107_map_virgin" PointIgnore:"true"` P83107MapVirgin valueTypes.UnitValue `json:"p83107_map_virgin" PointIgnore:"true"`
P83123 valueTypes.UnitValue `json:"p83123_map" PointId:"p83123" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` P83123 valueTypes.UnitValue `json:"p83123_map" PointId:"p83123" PointValueType:"" PointUpdateFreq:"UpdateFreqTotal"`
P83123MapVirgin valueTypes.UnitValue `json:"p83123_map_virgin" PointIgnore:"true"` P83123MapVirgin valueTypes.UnitValue `json:"p83123_map_virgin" PointIgnore:"true"`
P83124 valueTypes.UnitValue `json:"p83124_map" PointId:"p83124" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` P83124 valueTypes.UnitValue `json:"p83124_map" PointId:"p83124" PointValueType:"" PointUpdateFreq:"UpdateFreqTotal"`
P83124MapVirgin valueTypes.UnitValue `json:"p83124_map_virgin" PointIgnore:"true"` P83124MapVirgin valueTypes.UnitValue `json:"p83124_map_virgin" PointIgnore:"true"`
P83125 valueTypes.Float `json:"p83125" PointId:"p83125" PointUnitFrom:"FOO" PointTimeSpan:"PointTimeSpanTotal"` P83125 valueTypes.Float `json:"p83125" PointId:"p83125" PointUnitFrom:"FOO" PointUpdateFreq:"UpdateFreqTotal"`
P83126 valueTypes.Float `json:"p83126" PointId:"p83126" PointUnitFrom:"FOO" PointTimeSpan:"PointTimeSpanTotal"` P83126 valueTypes.Float `json:"p83126" PointId:"p83126" PointUnitFrom:"FOO" PointUpdateFreq:"UpdateFreqTotal"`
P83127 valueTypes.UnitValue `json:"p83127_map" PointId:"p83127" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` P83127 valueTypes.UnitValue `json:"p83127_map" PointId:"p83127" PointValueType:"" PointUpdateFreq:"UpdateFreqTotal"`
P83127MapVirgin valueTypes.UnitValue `json:"p83127_map_virgin" PointIgnore:"true"` P83127MapVirgin valueTypes.UnitValue `json:"p83127_map_virgin" PointIgnore:"true"`
TotalDataYearList []struct { TotalDataYearList []struct {
DateID valueTypes.Integer `json:"date_id"` DateID valueTypes.Integer `json:"date_id"`
@ -246,26 +246,26 @@ type TotalData struct {
JthdUnit valueTypes.String `json:"jthd_unit"` JthdUnit valueTypes.String `json:"jthd_unit"`
Jtyd valueTypes.Float `json:"jtyd" PointUnitFrom:"jtyd_unit"` Jtyd valueTypes.Float `json:"jtyd" PointUnitFrom:"jtyd_unit"`
JtydUnit valueTypes.String `json:"jtyd_unit"` JtydUnit valueTypes.String `json:"jtyd_unit"`
P83038 valueTypes.Float `json:"p83038" PointId:"p83038" PointTimeSpan:"PointTimeSpanTotal"` P83038 valueTypes.Float `json:"p83038" PointId:"p83038" PointUpdateFreq:"UpdateFreqTotal"`
P83074 valueTypes.Float `json:"p83074" PointId:"p83074" PointUnitFrom:"p83074_unit" PointTimeSpan:"PointTimeSpanTotal"` P83074 valueTypes.Float `json:"p83074" PointId:"p83074" PointUnitFrom:"p83074_unit" PointUpdateFreq:"UpdateFreqTotal"`
P83074Unit valueTypes.String `json:"p83074_unit"` P83074Unit valueTypes.String `json:"p83074_unit"`
P83079 valueTypes.Float `json:"p83079" PointId:"p83079" PointUnitFrom:"p83079_unit" PointTimeSpan:"PointTimeSpanTotal"` P83079 valueTypes.Float `json:"p83079" PointId:"p83079" PointUnitFrom:"p83079_unit" PointUpdateFreq:"UpdateFreqTotal"`
P83079Unit valueTypes.String `json:"p83079_unit"` P83079Unit valueTypes.String `json:"p83079_unit"`
P83088 valueTypes.Float `json:"p83088" PointId:"p83088" PointUnitFrom:"p83088_unit" PointTimeSpan:"PointTimeSpanTotal"` P83088 valueTypes.Float `json:"p83088" PointId:"p83088" PointUnitFrom:"p83088_unit" PointUpdateFreq:"UpdateFreqTotal"`
P83088Unit valueTypes.String `json:"p83088_unit"` P83088Unit valueTypes.String `json:"p83088_unit"`
P83093 valueTypes.Float `json:"p83093" PointId:"p83093" PointUnitFrom:"p83093_unit" PointTimeSpan:"PointTimeSpanTotal"` P83093 valueTypes.Float `json:"p83093" PointId:"p83093" PointUnitFrom:"p83093_unit" PointUpdateFreq:"UpdateFreqTotal"`
P83093Unit valueTypes.String `json:"p83093_unit"` P83093Unit valueTypes.String `json:"p83093_unit"`
P83099 valueTypes.Float `json:"p83099" PointId:"p83099" PointUnitFrom:"p83099_unit" PointTimeSpan:"PointTimeSpanTotal"` P83099 valueTypes.Float `json:"p83099" PointId:"p83099" PointUnitFrom:"p83099_unit" PointUpdateFreq:"UpdateFreqTotal"`
P83099Unit valueTypes.String `json:"p83099_unit"` P83099Unit valueTypes.String `json:"p83099_unit"`
P83104 valueTypes.Float `json:"p83104" PointId:"p83104" PointUnitFrom:"p83104_unit" PointTimeSpan:"PointTimeSpanTotal"` P83104 valueTypes.Float `json:"p83104" PointId:"p83104" PointUnitFrom:"p83104_unit" PointUpdateFreq:"UpdateFreqTotal"`
P83104Unit valueTypes.String `json:"p83104_unit"` P83104Unit valueTypes.String `json:"p83104_unit"`
P83118 valueTypes.Float `json:"p83118" PointId:"p83118" PointUnitFrom:"p83118_unit" PointTimeSpan:"PointTimeSpanTotal"` P83118 valueTypes.Float `json:"p83118" PointId:"p83118" PointUnitFrom:"p83118_unit" PointUpdateFreq:"UpdateFreqTotal"`
P83118Unit valueTypes.String `json:"p83118_unit"` P83118Unit valueTypes.String `json:"p83118_unit"`
P83119 valueTypes.Float `json:"p83119" PointId:"p83119" PointUnitFrom:"p83119_unit" PointTimeSpan:"PointTimeSpanTotal"` P83119 valueTypes.Float `json:"p83119" PointId:"p83119" PointUnitFrom:"p83119_unit" PointUpdateFreq:"UpdateFreqTotal"`
P83119Unit valueTypes.String `json:"p83119_unit"` P83119Unit valueTypes.String `json:"p83119_unit"`
P83120 valueTypes.Float `json:"p83120" PointId:"p83120" PointTimeSpan:"PointTimeSpanTotal"` P83120 valueTypes.Float `json:"p83120" PointId:"p83120" PointUpdateFreq:"UpdateFreqTotal"`
P83121 valueTypes.Float `json:"p83121" PointId:"p83121" PointTimeSpan:"PointTimeSpanTotal"` P83121 valueTypes.Float `json:"p83121" PointId:"p83121" PointUpdateFreq:"UpdateFreqTotal"`
P83122 valueTypes.Float `json:"p83122" PointId:"p83122" PointTimeSpan:"PointTimeSpanTotal"` P83122 valueTypes.Float `json:"p83122" PointId:"p83122" PointUpdateFreq:"UpdateFreqTotal"`
PsID valueTypes.Integer `json:"ps_id"` PsID valueTypes.Integer `json:"ps_id"`
SelfConsumptionYield valueTypes.Float `json:"self_consumption_yield" PointUnitFrom:"self_consumption_yield_unit"` SelfConsumptionYield valueTypes.Float `json:"self_consumption_yield" PointUnitFrom:"self_consumption_yield_unit"`
SelfConsumptionYieldUnit valueTypes.String `json:"self_consumption_yield_unit"` SelfConsumptionYieldUnit valueTypes.String `json:"self_consumption_yield_unit"`

View File

@ -29,13 +29,13 @@ func (rd RequestData) Help() string {
type ResultData struct { type ResultData struct {
DeviceType valueTypes.Integer `json:"device_type" PointId:"device_type" PointValueType:"" PointTimeSpan:""` DeviceType valueTypes.Integer `json:"device_type" PointId:"device_type" PointValueType:"" PointUpdateFreq:""`
ID valueTypes.Integer `json:"id" PointId:"id" PointValueType:"" PointTimeSpan:""` ID valueTypes.Integer `json:"id" PointId:"id" PointValueType:"" PointUpdateFreq:""`
Period valueTypes.Integer `json:"period" PointId:"period" PointValueType:"" PointTimeSpan:""` Period valueTypes.Integer `json:"period" PointId:"period" PointValueType:"" PointUpdateFreq:""`
PointID valueTypes.Integer `json:"point_id" PointId:"point_id" PointValueType:"" PointTimeSpan:""` PointID valueTypes.Integer `json:"point_id" PointId:"point_id" PointValueType:"" PointUpdateFreq:""`
PointName string `json:"point_name" PointId:"point_name" PointValueType:"" PointTimeSpan:""` PointName string `json:"point_name" PointId:"point_name" PointValueType:"" PointUpdateFreq:""`
ShowPointName string `json:"show_point_name" PointId:"show_point_name" PointValueType:"" PointTimeSpan:""` ShowPointName string `json:"show_point_name" PointId:"show_point_name" PointValueType:"" PointUpdateFreq:""`
TranslationID valueTypes.Integer `json:"translation_id" PointId:"translation_id" PointValueType:"" PointTimeSpan:""` TranslationID valueTypes.Integer `json:"translation_id" PointId:"translation_id" PointValueType:"" PointUpdateFreq:""`
} }
func (e *ResultData) IsValid() error { func (e *ResultData) IsValid() error {

View File

@ -25,22 +25,22 @@ func (rd RequestData) Help() string {
} }
type ResultData struct { type ResultData struct {
ActualEnergy []valueTypes.Float `json:"actual_energy" PointUnitFrom:"actual_energy_unit"` ActualEnergy []valueTypes.Float `json:"actual_energy" PointId:"actual_energy" PointName:"Actual Energy" PointUnitFrom:"ActualEnergyUnit"`
ActualEnergyUnit valueTypes.String `json:"actual_energy_unit" PointId:"actual_energy_unit"` ActualEnergyUnit valueTypes.String `json:"actual_energy_unit" PointId:"actual_energy_unit" PointIgnore:"true"`
AlarmCount valueTypes.Integer `json:"alarm_count"` AlarmCount valueTypes.Integer `json:"alarm_count"`
AreaID interface{} `json:"area_id"` AreaID interface{} `json:"area_id"`
AreaType valueTypes.Integer `json:"area_type"` AreaType valueTypes.Integer `json:"area_type"`
BuildDate valueTypes.DateTime `json:"build_date"` BuildDate valueTypes.DateTime `json:"build_date"`
Co2Reduce valueTypes.UnitValue `json:"co2_reduce"` Co2Reduce valueTypes.UnitValue `json:"co2_reduce"`
Co2ReduceTotal valueTypes.UnitValue `json:"co2_reduce_total" PointId:"co2_reduce_total" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` Co2ReduceTotal valueTypes.UnitValue `json:"co2_reduce_total" PointId:"co2_reduce_total" PointUpdateFreq:"UpdateFreqTotal"`
CoalReduce valueTypes.UnitValue `json:"coal_reduce"` CoalReduce valueTypes.UnitValue `json:"coal_reduce"`
CoalReduceTotal valueTypes.UnitValue `json:"coal_reduce_total" PointId:"coal_reduce_total" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` CoalReduceTotal valueTypes.UnitValue `json:"coal_reduce_total" PointId:"coal_reduce_total" PointUpdateFreq:"UpdateFreqTotal"`
ConnectGrid string `json:"connect_grid"` ConnectGrid string `json:"connect_grid"`
ConnectType valueTypes.Integer `json:"connect_type"` ConnectType valueTypes.Integer `json:"connect_type"`
ContactPerson valueTypes.String `json:"contact_person"` ContactPerson valueTypes.String `json:"contact_person"`
CurrPower valueTypes.UnitValue `json:"curr_power"` // Pv Power CurrPower valueTypes.UnitValue `json:"curr_power"` // Pv Power
DataLastUpdateTime valueTypes.DateTime `json:"data_last_update_time"` DataLastUpdateTime valueTypes.DateTime `json:"data_last_update_time"`
DayEqHours string `json:"day_eq_hours"` DayEqHours valueTypes.Float `json:"day_eq_hours" PointUnit:"h" PointUpdateFreq:"UpdateFreqDaily"`
Description interface{} `json:"description"` Description interface{} `json:"description"`
DesignCapacity valueTypes.UnitValue `json:"design_capacity"` DesignCapacity valueTypes.UnitValue `json:"design_capacity"`
DesignCapacityBattery valueTypes.UnitValue `json:"design_capacity_battery"` DesignCapacityBattery valueTypes.UnitValue `json:"design_capacity_battery"`
@ -61,10 +61,10 @@ type ResultData struct {
PicType valueTypes.Integer `json:"pic_type"` PicType valueTypes.Integer `json:"pic_type"`
PictureName valueTypes.String `json:"picture_name"` PictureName valueTypes.String `json:"picture_name"`
PictureURL valueTypes.String `json:"picture_url"` PictureURL valueTypes.String `json:"picture_url"`
PsUnitUUID interface{} `json:"ps_unit_uuid"` PsUnitUUID interface{} `json:"ps_unit_uuid" PointName:"Images"`
} `json:"images"` } `json:"images" PointName:"Images"`
InstallDate valueTypes.DateTime `json:"install_date"` InstallDate valueTypes.DateTime `json:"install_date"`
InstallerPsFaultStatus string `json:"installer_ps_fault_status"` InstallerPsFaultStatus valueTypes.Integer `json:"installer_ps_fault_status"`
IsHaveEsInverter valueTypes.Bool `json:"is_have_es_inverter"` IsHaveEsInverter valueTypes.Bool `json:"is_have_es_inverter"`
IsTransformSystem valueTypes.Bool `json:"is_transform_system"` IsTransformSystem valueTypes.Bool `json:"is_transform_system"`
IsTuv valueTypes.Bool `json:"is_tuv"` IsTuv valueTypes.Bool `json:"is_tuv"`
@ -73,28 +73,28 @@ type ResultData struct {
MapLatitude valueTypes.Float `json:"map_latitude"` MapLatitude valueTypes.Float `json:"map_latitude"`
MapLongitude valueTypes.Float `json:"map_longitude"` MapLongitude valueTypes.Float `json:"map_longitude"`
MeterReduce valueTypes.UnitValue `json:"meter_reduce"` MeterReduce valueTypes.UnitValue `json:"meter_reduce"`
MeterReduceTotal valueTypes.UnitValue `json:"meter_reduce_total" PointId:"meter_reduce_total" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` MeterReduceTotal valueTypes.UnitValue `json:"meter_reduce_total" PointId:"meter_reduce_total" PointUpdateFreq:"UpdateFreqTotal"`
MobileTel valueTypes.String `json:"mibile_tel" PointId:"mobile_tel"` MobileTel valueTypes.String `json:"mibile_tel" PointId:"mobile_tel"`
MonthPr string `json:"monthPr" PointId:"monthPr" PointValueType:"" PointTimeSpan:"PointTimeSpanMonth"` MonthPr string `json:"monthPr" PointId:"monthPr" PointUpdateFreq:"UpdateFreqMonth"`
MonthEnergy valueTypes.UnitValue `json:"month_energy" PointId:"month_energy" PointValueType:"" PointTimeSpan:"PointTimeSpanMonth"` MonthEnergy valueTypes.UnitValue `json:"month_energy" PointId:"month_energy" PointUpdateFreq:"UpdateFreqMonth"`
MonthEnergyVirgin valueTypes.UnitValue `json:"month_energy_virgin" PointIgnore:"true"` MonthEnergyVirgin valueTypes.UnitValue `json:"month_energy_virgin" PointIgnore:"true"`
MonthEqHours valueTypes.Float `json:"month_eq_hours" PointId:"month_eq_hours" PointValueType:"" PointTimeSpan:"PointTimeSpanMonth"` MonthEqHours valueTypes.Float `json:"month_eq_hours" PointId:"month_eq_hours" PointUnit:"h" PointUpdateFreq:"UpdateFreqMonth"`
MonthIncome valueTypes.UnitValue `json:"month_income" PointId:"month_income" PointValueType:"" PointTimeSpan:"PointTimeSpanMonth"` MonthIncome valueTypes.UnitValue `json:"month_income" PointId:"month_income" PointUpdateFreq:"UpdateFreqMonth"`
NoxReduce valueTypes.UnitValue `json:"nox_reduce"` NoxReduce valueTypes.UnitValue `json:"nox_reduce"`
NoxReduceTotal valueTypes.UnitValue `json:"nox_reduce_total" PointId:"nox_reduce_total" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` NoxReduceTotal valueTypes.UnitValue `json:"nox_reduce_total" PointId:"nox_reduce_total" PointUpdateFreq:"UpdateFreqTotal"`
OperateYear string `json:"operate_year"` OperateYear string `json:"operate_year"`
OperationBusName valueTypes.String `json:"operation_bus_name"` OperationBusName valueTypes.String `json:"operation_bus_name"`
OwnerPsFaultStatus string `json:"owner_ps_fault_status"` OwnerPsFaultStatus valueTypes.Integer `json:"owner_ps_fault_status"`
P83012Value valueTypes.Float `json:"p83012_value" PointId:"p83012" PointUnitFrom:"p83012_unit"` P83012Value valueTypes.Float `json:"p83012_value" PointId:"p83012" PointUnitFrom:"P83012Unit"`
P83012Unit valueTypes.String `json:"p83012_unit" PointId:"p83012_unit"` P83012Unit valueTypes.String `json:"p83012_unit" PointId:"p83012_unit" PointIgnore:"true"`
P83013Value valueTypes.Float `json:"p83013_value" PointId:"p83013" PointUnitFrom:"p83013_unit"` P83013Value valueTypes.Float `json:"p83013_value" PointId:"p83013" PointUnitFrom:"P83013Unit"`
P83013Unit valueTypes.String `json:"p83013_unit" PointId:"p83013_unit"` P83013Unit valueTypes.String `json:"p83013_unit" PointId:"p83013_unit" PointIgnore:"true"`
P83036Value valueTypes.Float `json:"p83036_value" PointId:"p83036" PointUnitFrom:"p83036_unit"` P83036Value valueTypes.Float `json:"p83036_value" PointId:"p83036" PointUnitFrom:"P83036Unit"`
P83036Unit valueTypes.String `json:"p83036_unit" PointId:"p83036_unit"` P83036Unit valueTypes.String `json:"p83036_unit" PointId:"p83036_unit" PointIgnore:"true"`
P83016 valueTypes.Float `json:"p83016" PointId:"p83016" PointUnitFrom:"p83016_unit"` P83016 valueTypes.Float `json:"p83016" PointId:"p83016" PointUnitFrom:"P83016Unit"`
P83016Unit valueTypes.String `json:"p83016_unit" PointId:"p83016_unit"` P83016Unit valueTypes.String `json:"p83016_unit" PointId:"p83016_unit" PointIgnore:"true"`
P83017 valueTypes.Float `json:"p83017" PointId:"p83017" PointUnitFrom:"p83017_unit"` P83017 valueTypes.Float `json:"p83017" PointId:"p83017" PointUnitFrom:"P83017Unit"`
P83017Unit valueTypes.String `json:"p83017_unit" PointId:"p83017_unit"` P83017Unit valueTypes.String `json:"p83017_unit" PointId:"p83017_unit" PointIgnore:"true"`
P83023 valueTypes.Float `json:"p83023" PointId:"p83023"` P83023 valueTypes.Float `json:"p83023" PointId:"p83023"`
P83023y string `json:"p83023y" PointId:"p83023y"` P83023y string `json:"p83023y" PointId:"p83023y"`
P83023year string `json:"p83023year" PointId:"p83023y"` P83023year string `json:"p83023year" PointId:"p83023y"`
@ -110,24 +110,24 @@ type ResultData struct {
P83074MapVirgin valueTypes.UnitValue `json:"p83074_map_virgin" PointIgnore:"true"` P83074MapVirgin valueTypes.UnitValue `json:"p83074_map_virgin" PointIgnore:"true"`
P83075Map valueTypes.UnitValue `json:"p83075_map" PointId:"p83075"` P83075Map valueTypes.UnitValue `json:"p83075_map" PointId:"p83075"`
P83075MapVirgin valueTypes.UnitValue `json:"p83075_map_virgin" PointIgnore:"true"` P83075MapVirgin valueTypes.UnitValue `json:"p83075_map_virgin" PointIgnore:"true"`
P83076Map valueTypes.UnitValue `json:"p83076_map" PointId:"p83076"` // Pv Power P83076Map valueTypes.UnitValue `json:"p83076_map" PointName:"Pv Power" PointId:"p83076"` // Pv Power
P83076MapVirgin valueTypes.UnitValue `json:"p83076_map_virgin" PointIgnore:"true"` // Pv Power P83076MapVirgin valueTypes.UnitValue `json:"p83076_map_virgin" PointIgnore:"true"`
P83077Map valueTypes.UnitValue `json:"p83077_map" PointId:"p83077"` // Pv Energy P83077Map valueTypes.UnitValue `json:"p83077_map" PointName:"Pv Energy" PointId:"p83077"` // Pv Energy
P83077MapVirgin valueTypes.UnitValue `json:"p83077_map_virgin" PointIgnore:"true"` // Pv Energy P83077MapVirgin valueTypes.UnitValue `json:"p83077_map_virgin" PointIgnore:"true"`
P83078Map valueTypes.UnitValue `json:"p83078_map" PointId:"p83078"` P83078Map valueTypes.UnitValue `json:"p83078_map" PointId:"p83078"`
P83078MapVirgin valueTypes.UnitValue `json:"p83078_map_virgin" PointIgnore:"true"` P83078MapVirgin valueTypes.UnitValue `json:"p83078_map_virgin" PointIgnore:"true"`
P83079Map valueTypes.UnitValue `json:"p83079_map" PointId:"p83079"` P83079Map valueTypes.UnitValue `json:"p83079_map" PointId:"p83079"`
P83079MapVirgin valueTypes.UnitValue `json:"p83079_map_virgin" PointIgnore:"true"` P83079MapVirgin valueTypes.UnitValue `json:"p83079_map_virgin" PointIgnore:"true"`
P83080Map valueTypes.UnitValue `json:"p83080_map" PointId:"p83080"` P83080Map valueTypes.UnitValue `json:"p83080_map" PointId:"p83080"`
P83080MapVirgin valueTypes.UnitValue `json:"p83080_map_virgin" PointIgnore:"true"` P83080MapVirgin valueTypes.UnitValue `json:"p83080_map_virgin" PointIgnore:"true"`
P83088Map valueTypes.UnitValue `json:"p83088_map" PointId:"p83088"` // Es Energy P83088Map valueTypes.UnitValue `json:"p83088_map" PointName:"ES Energy" PointId:"p83088"` // Es Energy
P83088MapVirgin valueTypes.UnitValue `json:"p83088_map_virgin" PointIgnore:"true"` // Es Energy P83088MapVirgin valueTypes.UnitValue `json:"p83088_map_virgin" PointIgnore:"true"`
P83089Map valueTypes.UnitValue `json:"p83089_map" PointId:"p83089"` // Es Discharge Energy P83089Map valueTypes.UnitValue `json:"p83089_map" PointName:"ES Discharge Energy" PointId:"p83089"` // Es Discharge Energy
P83089MapVirgin valueTypes.UnitValue `json:"p83089_map_virgin" PointIgnore:"true"` // Es Discharge Energy P83089MapVirgin valueTypes.UnitValue `json:"p83089_map_virgin" PointIgnore:"true"`
P83094Map valueTypes.UnitValue `json:"p83094_map" PointId:"p83094"` P83094Map valueTypes.UnitValue `json:"p83094_map" PointId:"p83094"`
P83094MapVirgin valueTypes.UnitValue `json:"p83094_map_virgin" PointIgnore:"true"` P83094MapVirgin valueTypes.UnitValue `json:"p83094_map_virgin" PointIgnore:"true"`
P83095Map valueTypes.UnitValue `json:"p83095_map" PointId:"p83095" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` // Es Total Discharge Energy P83095Map valueTypes.UnitValue `json:"p83095_map" PointId:"p83095" PointName:"ES Total Discharge Energy" PointUpdateFreq:"UpdateFreqTotal"` // Es Total Discharge Energy
P83095MapVirgin valueTypes.UnitValue `json:"p83095_map_virgin" PointIgnore:"true"` // Es Total Discharge Energy P83095MapVirgin valueTypes.UnitValue `json:"p83095_map_virgin" PointIgnore:"true"`
P83097Map valueTypes.UnitValue `json:"p83097_map" PointId:"p83097"` P83097Map valueTypes.UnitValue `json:"p83097_map" PointId:"p83097"`
P83097MapVirgin valueTypes.UnitValue `json:"p83097_map_virgin" PointIgnore:"true"` P83097MapVirgin valueTypes.UnitValue `json:"p83097_map_virgin" PointIgnore:"true"`
P83100Map valueTypes.UnitValue `json:"p83100_map" PointId:"p83100"` P83100Map valueTypes.UnitValue `json:"p83100_map" PointId:"p83100"`
@ -161,21 +161,21 @@ type ResultData struct {
P83202Map valueTypes.UnitValue `json:"p83202_map" PointId:"p83202"` P83202Map valueTypes.UnitValue `json:"p83202_map" PointId:"p83202"`
P83202MapVirgin valueTypes.UnitValue `json:"p83202_map_virgin" PointIgnore:"true"` P83202MapVirgin valueTypes.UnitValue `json:"p83202_map_virgin" PointIgnore:"true"`
PercentPlanYear valueTypes.Float `json:"percent_plan_year"` PercentPlanYear valueTypes.Float `json:"percent_plan_year"`
PlanEnergy []valueTypes.Float `json:"plan_energy" PointUnitFrom:"plan_energy_unit"` PlanEnergy []valueTypes.Float `json:"plan_energy" PointUnitFrom:"PlanEnergyUnit"`
PlanEnergyUnit valueTypes.String `json:"plan_energy_unit" PointId:"plan_energy_unit"` PlanEnergyUnit valueTypes.String `json:"plan_energy_unit" PointId:"plan_energy_unit" PointIgnore:"true"`
PlanEnergyYear valueTypes.UnitValue `json:"plan_energy_year"` PlanEnergyYear valueTypes.UnitValue `json:"plan_energy_year"`
PowderReduce valueTypes.UnitValue `json:"powder_reduce"` PowderReduce valueTypes.UnitValue `json:"powder_reduce"`
PowderReduceTotal valueTypes.UnitValue `json:"powder_reduce_total" PointId:"powder_reduce_total" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` PowderReduceTotal valueTypes.UnitValue `json:"powder_reduce_total" PointId:"powder_reduce_total" PointUpdateFreq:"UpdateFreqTotal"`
PowerChargeSetted valueTypes.Bool `json:"power_charge_setted" PointId:"power_charge_setted" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` PowerChargeSetted valueTypes.Bool `json:"power_charge_setted" PointId:"power_charge_set" PointUpdateFreq:"UpdateFreqTotal"`
Producer string `json:"producer"` Producer string `json:"producer"`
PsCountryID valueTypes.Integer `json:"ps_country_id"` PsCountryID valueTypes.Integer `json:"ps_country_id"`
PsFaultStatus string `json:"ps_fault_status"` PsFaultStatus valueTypes.Integer `json:"ps_fault_status"`
PsHealthStatus string `json:"ps_health_status"` PsHealthStatus valueTypes.Integer `json:"ps_health_status"`
PsHolder valueTypes.String `json:"ps_holder"` PsHolder valueTypes.String `json:"ps_holder"`
PsLocation valueTypes.String `json:"ps_location"` PsLocation valueTypes.String `json:"ps_location"`
PsName valueTypes.String `json:"ps_name"` PsName valueTypes.String `json:"ps_name"`
PsShortName valueTypes.String `json:"ps_short_name"` PsShortName valueTypes.String `json:"ps_short_name"`
PsState string `json:"ps_state"` PsState valueTypes.Integer `json:"ps_state"`
PsType valueTypes.Integer `json:"ps_type"` PsType valueTypes.Integer `json:"ps_type"`
PsTypeName valueTypes.String `json:"ps_type_name"` PsTypeName valueTypes.String `json:"ps_type_name"`
PsWindLevel string `json:"ps_wind_level"` PsWindLevel string `json:"ps_wind_level"`
@ -191,7 +191,7 @@ type ResultData struct {
ShippingAddress valueTypes.String `json:"shipping_address"` ShippingAddress valueTypes.String `json:"shipping_address"`
ShippingZipCode valueTypes.String `json:"shipping_zip_code"` ShippingZipCode valueTypes.String `json:"shipping_zip_code"`
So2Reduce valueTypes.UnitValue `json:"so2_reduce"` So2Reduce valueTypes.UnitValue `json:"so2_reduce"`
So2ReduceTotal valueTypes.UnitValue `json:"so2_reduce_total" PointId:"so2_reduce_total" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` So2ReduceTotal valueTypes.UnitValue `json:"so2_reduce_total" PointId:"so2_reduce_total" PointUpdateFreq:"UpdateFreqTotal"`
StorageInverterData []struct { StorageInverterData []struct {
CommunicationDevSn valueTypes.String `json:"communication_dev_sn"` CommunicationDevSn valueTypes.String `json:"communication_dev_sn"`
DevFaultStatus valueTypes.Integer `json:"dev_fault_status"` DevFaultStatus valueTypes.Integer `json:"dev_fault_status"`
@ -203,51 +203,51 @@ type ResultData struct {
DeviceType valueTypes.Integer `json:"device_type"` DeviceType valueTypes.Integer `json:"device_type"`
DrmStatus valueTypes.Integer `json:"drm_status"` DrmStatus valueTypes.Integer `json:"drm_status"`
DrmStatusName valueTypes.String `json:"drm_status_name"` DrmStatusName valueTypes.String `json:"drm_status_name"`
EnergyFlow []valueTypes.Integer `json:"energy_flow"` EnergyFlow []valueTypes.Integer `json:"energy_flow" PointName:"Energy Flow"`
HasAmmeter valueTypes.Bool `json:"has_ammeter"` HasAmmeter valueTypes.Bool `json:"has_ammeter"`
InstallerDevFaultStatus valueTypes.Integer `json:"installer_dev_fault_status"` InstallerDevFaultStatus valueTypes.Integer `json:"installer_dev_fault_status"`
InverterSn valueTypes.String `json:"inverter_sn"` InverterSn valueTypes.String `json:"inverter_sn"`
OwnerDevFaultStatus valueTypes.Integer `json:"owner_dev_fault_status"` OwnerDevFaultStatus valueTypes.Integer `json:"owner_dev_fault_status"`
P13003Map valueTypes.UnitValue `json:"p13003_map" PointId:"p13003" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"` P13003Map valueTypes.UnitValue `json:"p13003_map" PointId:"p13003" PointUpdateFreq:"UpdateFreqInstant"`
P13003MapVirgin valueTypes.UnitValue `json:"p13003_map_virgin" PointIgnore:"true"` P13003MapVirgin valueTypes.UnitValue `json:"p13003_map_virgin" PointIgnore:"true"`
P13011Map valueTypes.UnitValue `json:"p13011_map" PointId:"p13011" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"` P13011Map valueTypes.UnitValue `json:"p13011_map" PointId:"p13011" PointUpdateFreq:"UpdateFreqInstant"`
P13011MapVirgin valueTypes.UnitValue `json:"p13011_map_virgin" PointIgnore:"true"` P13011MapVirgin valueTypes.UnitValue `json:"p13011_map_virgin" PointIgnore:"true"`
P13115Map valueTypes.UnitValue `json:"p13115_map" PointId:"p13115" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"` P13115Map valueTypes.UnitValue `json:"p13115_map" PointId:"p13115" PointUpdateFreq:"UpdateFreqInstant"`
P13115MapVirgin valueTypes.UnitValue `json:"p13115_map_virgin" PointIgnore:"true"` P13115MapVirgin valueTypes.UnitValue `json:"p13115_map_virgin" PointIgnore:"true"`
P13119Map valueTypes.UnitValue `json:"p13119_map" PointId:"p13119" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"` P13119Map valueTypes.UnitValue `json:"p13119_map" PointId:"p13119" PointUpdateFreq:"UpdateFreqInstant"`
P13119MapVirgin valueTypes.UnitValue `json:"p13119_map_virgin" PointIgnore:"true"` P13119MapVirgin valueTypes.UnitValue `json:"p13119_map_virgin" PointIgnore:"true"`
P13121Map valueTypes.UnitValue `json:"p13121_map" PointId:"p13121" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"` P13121Map valueTypes.UnitValue `json:"p13121_map" PointId:"p13121" PointUpdateFreq:"UpdateFreqInstant"`
P13121MapVirgin valueTypes.UnitValue `json:"p13121_map_virgin" PointIgnore:"true"` P13121MapVirgin valueTypes.UnitValue `json:"p13121_map_virgin" PointIgnore:"true"`
P13126Map valueTypes.UnitValue `json:"p13126_map" PointId:"p13126" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"` P13126Map valueTypes.UnitValue `json:"p13126_map" PointId:"p13126" PointUpdateFreq:"UpdateFreqInstant"`
P13126MapVirgin valueTypes.UnitValue `json:"p13126_map_virgin" PointIgnore:"true"` P13126MapVirgin valueTypes.UnitValue `json:"p13126_map_virgin" PointIgnore:"true"`
P13141 valueTypes.Float `json:"p13141" PointId:"p13141" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"` P13141 valueTypes.Float `json:"p13141" PointId:"p13141" PointUpdateFreq:"UpdateFreqInstant"`
P13142 valueTypes.Float `json:"p13142" PointId:"p13142" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"` P13142 valueTypes.Float `json:"p13142" PointId:"p13142" PointUpdateFreq:"UpdateFreqInstant"`
P13149Map valueTypes.UnitValue `json:"p13149_map" PointId:"p13149" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"` P13149Map valueTypes.UnitValue `json:"p13149_map" PointId:"p13149" PointUpdateFreq:"UpdateFreqInstant"`
P13149MapVirgin valueTypes.UnitValue `json:"p13149_map_virgin" PointIgnore:"true"` P13149MapVirgin valueTypes.UnitValue `json:"p13149_map_virgin" PointIgnore:"true"`
P13150Map valueTypes.UnitValue `json:"p13150_map" PointId:"p13150" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"` P13150Map valueTypes.UnitValue `json:"p13150_map" PointId:"p13150" PointUpdateFreq:"UpdateFreqInstant"`
P13150MapVirgin valueTypes.UnitValue `json:"p13150_map_virgin" PointIgnore:"true"` P13150MapVirgin valueTypes.UnitValue `json:"p13150_map_virgin" PointIgnore:"true"`
P13155 valueTypes.Float `json:"p13155" PointId:"p13155" PointValueType:"" PointTimeSpan:"PointTimeSpanInstant"` P13155 valueTypes.Float `json:"p13155" PointId:"p13155" PointUpdateFreq:"UpdateFreqInstant"`
PsKey valueTypes.PsKey `json:"ps_key"` PsKey valueTypes.PsKey `json:"ps_key"`
UpdateTime valueTypes.DateTime `json:"update_time"` UpdateTime valueTypes.DateTime `json:"update_time"`
UUID valueTypes.Integer `json:"uuid"` UUID valueTypes.Integer `json:"uuid"`
} `json:"storage_inverter_data"` } `json:"storage_inverter_data" PointNameFromChild:"PsKey"`
SysScheme valueTypes.Integer `json:"sys_scheme"` SysScheme valueTypes.Integer `json:"sys_scheme"`
TimeZoneID valueTypes.Integer `json:"time_zone_id"` TimeZoneID valueTypes.Integer `json:"time_zone_id"`
Timezone valueTypes.String `json:"timezone"` Timezone valueTypes.String `json:"timezone"`
TodayEnergy valueTypes.UnitValue `json:"today_energy" PointId:"today_energy" PointValueType:"" PointTimeSpan:"PointTimeSpanDaily"` TodayEnergy valueTypes.UnitValue `json:"today_energy" PointId:"today_energy" PointUpdateFreq:"UpdateFreqDaily"`
TodayEnergyVirgin valueTypes.UnitValue `json:"today_energy_virgin" PointIgnore:"true"` TodayEnergyVirgin valueTypes.UnitValue `json:"today_energy_virgin" PointIgnore:"true"`
TodayIncome valueTypes.UnitValue `json:"today_income" PointId:"today_income" PointValueType:"" PointTimeSpan:"PointTimeSpanDaily"` TodayIncome valueTypes.UnitValue `json:"today_income" PointId:"today_income" PointUpdateFreq:"UpdateFreqDaily"`
TotalEnergy valueTypes.UnitValue `json:"total_energy" PointId:"total_energy" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` TotalEnergy valueTypes.UnitValue `json:"total_energy" PointId:"total_energy" PointUpdateFreq:"UpdateFreqTotal"`
TotalEnergyVirgin valueTypes.UnitValue `json:"total_energy_virgin" PointIgnore:"true"` TotalEnergyVirgin valueTypes.UnitValue `json:"total_energy_virgin" PointIgnore:"true"`
TotalEnergyYear valueTypes.UnitValue `json:"total_energy_year" PointId:"total_energy_year" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` TotalEnergyYear valueTypes.UnitValue `json:"total_energy_year" PointId:"total_energy_year" PointUpdateFreq:"UpdateFreqTotal"`
TotalIncome valueTypes.UnitValue `json:"total_income" PointId:"total_income" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` TotalIncome valueTypes.UnitValue `json:"total_income" PointId:"total_income" PointUpdateFreq:"UpdateFreqTotal"`
TreeReduce valueTypes.UnitValue `json:"tree_reduce"` TreeReduce valueTypes.UnitValue `json:"tree_reduce"`
TreeReduceTotal valueTypes.UnitValue `json:"tree_reduce_total" PointId:"tree_reduce_total" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` TreeReduceTotal valueTypes.UnitValue `json:"tree_reduce_total" PointId:"tree_reduce_total" PointUpdateFreq:"UpdateFreqTotal"`
TuvLevel string `json:"tuv_level"` TuvLevel string `json:"tuv_level"`
ValidFlag valueTypes.Bool `json:"valid_flag"` ValidFlag valueTypes.Bool `json:"valid_flag"`
WaitAssignOrderCount valueTypes.Integer `json:"wait_assign_order_count"` WaitAssignOrderCount valueTypes.Integer `json:"wait_assign_order_count"`
WaterReduce valueTypes.UnitValue `json:"water_reduce"` WaterReduce valueTypes.UnitValue `json:"water_reduce"`
WaterReduceTotal valueTypes.UnitValue `json:"water_reduce_total" PointId:"water_reduce_total" PointValueType:"" PointTimeSpan:"PointTimeSpanTotal"` WaterReduceTotal valueTypes.UnitValue `json:"water_reduce_total" PointId:"water_reduce_total" PointUpdateFreq:"UpdateFreqTotal"`
WgsLatitude valueTypes.Float `json:"wgs_latitude"` WgsLatitude valueTypes.Float `json:"wgs_latitude"`
WgsLongitude valueTypes.Float `json:"wgs_longitude"` WgsLongitude valueTypes.Float `json:"wgs_longitude"`
Year valueTypes.Integer `json:"year"` Year valueTypes.Integer `json:"year"`
@ -269,64 +269,24 @@ func (e *ResultData) IsValid() error {
return err return err
} }
// type DecodeResultData ResultData
//
// func (e *ResultData) UnmarshalJSON(data []byte) error {
// var err error
//
// for range Only.Once {
// if len(data) == 0 {
// break
// }
// var pd DecodeResultData
//
// // Store ResultData
// _ = json.Unmarshal(data, &pd)
// e.Dummy = pd.Dummy
// }
//
// return err
// }
func (e *EndPoint) GetData() api.DataMap { func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap() entries := api.NewDataMap()
for range Only.Once { for range Only.Once {
pkg := apiReflect.GetName("", *e) pkg := apiReflect.GetName("", *e)
name := fmt.Sprintf("%s.%s", pkg, e.Request.PsId.String()) dt := valueTypes.NewDateTime(valueTypes.Now)
entries.StructToPoints(e.Response.ResultData, name, e.Request.PsId.String(), valueTypes.NewDateTime("")) entries.StructToPoints(e.Response.ResultData, pkg + "." + e.Request.PsId.String(), "", dt)
for _, sid := range e.Response.ResultData.StorageInverterData { // pkg := apiReflect.GetName("", *e)
name = fmt.Sprintf("%s.%s", pkg, sid.PsKey.Value()) // name := api.JoinWithDots(0, valueTypes.DateTimeLayoutDay, pkg, e.Request.PsId)
entries.StructToPoints(sid, name, sid.PsKey.Value(), valueTypes.NewDateTime("")) // entries.StructToPoints(e.Response.ResultData, name, e.Request.PsId.String(), valueTypes.NewDateTime(""))
} //
} // for _, sid := range e.Response.ResultData.StorageInverterData {
// name = api.JoinWithDots(0, valueTypes.DateTimeLayoutDay, pkg, sid.PsKey)
// for range Only.Once { // entries.StructToPoints(sid, name, sid.PsKey.Value(), valueTypes.NewDateTime(""))
// // 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", "", "", valueTypes.NewDateTime(""), uv)
// //
// // uv = api.SetUnitValueFloat(e.Response.ResultData.P83013Value.Value(), e.Response.ResultData.P83013Unit.Value())
// // entries.AddUnitValue(name + ".p83013", e.Request.PsId.String(), "p83013", "", "", valueTypes.NewDateTime(""), uv)
// //
// // uv = api.SetUnitValueFloat(e.Response.ResultData.P83036Value.Value(), e.Response.ResultData.P83036Unit.Value())
// // entries.AddUnitValue(name + ".p83036", e.Request.PsId.String(), "p83036", "", "", valueTypes.NewDateTime(""), uv)
// //
// // uv = api.SetUnitValueFloat(e.Response.ResultData.P83016.Value(), e.Response.ResultData.P83016Unit.Value())
// // entries.AddUnitValue(name + ".p83016", e.Request.PsId.String(), "p83016", "", "", valueTypes.NewDateTime(""), uv)
// //
// // uv = api.SetUnitValueFloat(e.Response.ResultData.P83017.Value(), e.Response.ResultData.P83017Unit.Value())
// // entries.AddUnitValue(name + ".p83017", e.Request.PsId.String(), "p83017", "", "", valueTypes.NewDateTime(""), uv)
// //
// // entries.StructToPoints(e.Response.ResultData, name, e.Request.PsId.String(), valueTypes.NewDateTime(""))
// //
// // for _, sid := range e.Response.ResultData.StorageInverterData {
// // entries.StructToPoints(sid, name + ".StorageInverterData." + sid.PsKey.Value(), sid.PsKey.Value(), valueTypes.NewDateTime(""))
// // }
// } // }
}
return entries return entries
} }

View File

@ -26,116 +26,116 @@ func (rd RequestData) Help() string {
} }
type ResultData struct { type ResultData struct {
BatteryLevelPercent valueTypes.Integer `json:"battery_level_percent" PointId:"BatteryLevelPercent" PointUnit:"%" PointTimeSpan:"PointTimeSpanInstant"` BatteryLevelPercent valueTypes.Integer `json:"battery_level_percent" PointId:"battery_level_percent" PointUnit:"%" PointUpdateFreq:"UpdateFreqInstant"`
ChargingDischargingPowerMap valueTypes.UnitValue `json:"charging_discharging_power_map" PointId:"ChargingDischargingPowerMap" PointTimeSpan:"PointTimeSpanInstant"` ChargingDischargingPowerMap valueTypes.UnitValue `json:"charging_discharging_power_map" PointId:"charging_discharging_power_map" PointUpdateFreq:"UpdateFreqInstant"` // Holds the battery charge/discharge amount
Co2ReduceTotal valueTypes.UnitValue `json:"co2_reduce_total" PointId:"Co2ReduceTotal" PointTimeSpan:"PointTimeSpanTotal"` Co2ReduceTotal valueTypes.UnitValue `json:"co2_reduce_total" PointId:"co2_reduce_total" PointUpdateFreq:"UpdateFreqTotal"`
CoalReduceTotal valueTypes.UnitValue `json:"coal_reduce_total" PointId:"CoalReduceTotal" PointTimeSpan:"PointTimeSpanTotal"` CoalReduceTotal valueTypes.UnitValue `json:"coal_reduce_total" PointId:"coal_reduce_total" PointUpdateFreq:"UpdateFreqTotal"`
ConnectType string `json:"connect_type" PointId:"ConnectType" PointTimeSpan:"PointTimeSpanBoot"` ConnectType valueTypes.Integer `json:"connect_type" PointId:"connect_type" PointUpdateFreq:"UpdateFreqBoot"`
CurrPower valueTypes.UnitValue `json:"curr_power" PointId:"CurrPower" PointTimeSpan:"PointTimeSpanInstant"` CurrPower valueTypes.UnitValue `json:"curr_power" PointId:"curr_power" PointUpdateFreq:"UpdateFreqInstant"`
DesignCapacity valueTypes.UnitValue `json:"design_capacity" PointId:"DesignCapacity" PointTimeSpan:"PointTimeSpanBoot"` DesignCapacity valueTypes.UnitValue `json:"design_capacity" PointId:"design_capacity" PointUpdateFreq:"UpdateFreqBoot"`
EnergyScheme interface{} `json:"energy_scheme"` EnergyScheme interface{} `json:"energy_scheme" PointId:"energy_scheme"`
GcjLatitude valueTypes.Float `json:"gcj_latitude" PointId:"GcjLatitude" PointTimeSpan:"PointTimeSpanBoot"` GcjLatitude valueTypes.Float `json:"gcj_latitude" PointId:"gcj_latitude" PointUpdateFreq:"UpdateFreqBoot"`
GcjLongitude valueTypes.Float `json:"gcj_longitude" PointId:"GcjLongitude" PointTimeSpan:"PointTimeSpanBoot"` GcjLongitude valueTypes.Float `json:"gcj_longitude" PointId:"gcj_longitude" PointUpdateFreq:"UpdateFreqBoot"`
HasAmmeter valueTypes.Bool `json:"has_ammeter" PointId:"HasAmmeter" PointTimeSpan:"PointTimeSpanBoot"` HasAmmeter valueTypes.Bool `json:"has_ammeter" PointId:"has_ammeter" PointUpdateFreq:"UpdateFreqBoot"`
HouseholdInverterData interface{} `json:"household_inverter_data"` HouseholdInverterData interface{} `json:"household_inverter_data" PointId:"household_inverter_data"`
InstallerPsFaultStatus string `json:"installer_ps_fault_status" PointId:"InstallerPsFaultStatus" PointTimeSpan:"PointTimeSpanBoot"` InstallerPsFaultStatus valueTypes.Integer `json:"installer_ps_fault_status" PointId:"installer_ps_fault_status" PointUpdateFreq:"UpdateFreqInstant"`
IsHaveEsInverter valueTypes.Bool `json:"is_have_es_inverter" PointId:"IsHaveEsInverter" PointTimeSpan:"PointTimeSpanBoot"` IsHaveEsInverter valueTypes.Bool `json:"is_have_es_inverter" PointId:"is_have_es_inverter" PointUpdateFreq:"UpdateFreqBoot"`
IsSingleInverter valueTypes.Bool `json:"is_single_inverter" PointId:"IsSingleInverter" PointTimeSpan:"PointTimeSpanBoot"` IsSingleInverter valueTypes.Bool `json:"is_single_inverter" PointId:"is_single_inverter" PointUpdateFreq:"UpdateFreqBoot"`
IsTransformSystem valueTypes.Bool `json:"is_transform_system" PointId:"IsTransformSystem" PointTimeSpan:"PointTimeSpanBoot"` IsTransformSystem valueTypes.Bool `json:"is_transform_system" PointId:"is_transform_system" PointUpdateFreq:"UpdateFreqBoot"`
Latitude valueTypes.Float `json:"latitude" PointId:"Latitude" PointTimeSpan:"PointTimeSpanBoot"` Latitude valueTypes.Float `json:"latitude" PointId:"latitude" PointUpdateFreq:"UpdateFreqBoot"`
LoadPowerMap valueTypes.UnitValue `json:"load_power_map" PointId:"LoadPowerMap" PointTimeSpan:"PointTimeSpanInstant"` LoadPowerMap valueTypes.UnitValue `json:"load_power_map" PointId:"load_power_map" PointUpdateFreq:"UpdateFreqInstant"`
LoadPowerMapVirgin valueTypes.UnitValue `json:"load_power_map_virgin" PointIgnore:"true"` LoadPowerMapVirgin valueTypes.UnitValue `json:"load_power_map_virgin" PointIgnore:"true"`
Longitude valueTypes.Float `json:"longitude" PointId:"Longitude" PointTimeSpan:"PointTimeSpanBoot"` Longitude valueTypes.Float `json:"longitude" PointId:"longitude" PointUpdateFreq:"UpdateFreqBoot"`
MapLatitude valueTypes.Float `json:"map_latitude" PointId:"MapLatitude" PointTimeSpan:"PointTimeSpanBoot"` MapLatitude valueTypes.Float `json:"map_latitude" PointId:"map_latitude" PointUpdateFreq:"UpdateFreqBoot"`
MapLongitude valueTypes.Float `json:"map_longitude" PointId:"MapLongitude" PointTimeSpan:"PointTimeSpanBoot"` MapLongitude valueTypes.Float `json:"map_longitude" PointId:"map_longitude" PointUpdateFreq:"UpdateFreqBoot"`
MeterReduceTotal valueTypes.UnitValue `json:"meter_reduce_total" PointId:"MeterReduceTotal" PointTimeSpan:"PointTimeSpanTotal"` MeterReduceTotal valueTypes.UnitValue `json:"meter_reduce_total" PointId:"meter_reduce_total" PointUpdateFreq:"UpdateFreqTotal"`
MobileTel valueTypes.String `json:"moble_tel" PointId:"MobleTel" PointTimeSpan:"PointTimeSpanBoot"` MobileTel valueTypes.String `json:"moble_tel" PointId:"mobile_tel" PointUpdateFreq:"UpdateFreqBoot"`
MonthEnergy valueTypes.UnitValue `json:"month_energy" PointId:"MonthEnergy" PointTimeSpan:"PointTimeSpanMonthly"` MonthEnergy valueTypes.UnitValue `json:"month_energy" PointId:"month_energy" PointUpdateFreq:"UpdateFreqMonthly"`
MonthEnergyVirgin valueTypes.UnitValue `json:"month_energy_virgin" PointIgnore:"true"` MonthEnergyVirgin valueTypes.UnitValue `json:"month_energy_virgin" PointIgnore:"true"`
MonthIncome valueTypes.UnitValue `json:"month_income" PointId:"MonthIncome" PointTimeSpan:"PointTimeSpanMonthly"` MonthIncome valueTypes.UnitValue `json:"month_income" PointId:"month_income" PointUpdateFreq:"UpdateFreqMonthly"`
NegativeLoadMsg interface{} `json:"negative_load_msg"` NegativeLoadMsg interface{} `json:"negative_load_msg" PointId:"negative_load_msg"`
OwnerPsFaultStatus string `json:"owner_ps_fault_status" PointId:"OwnerPsFaultStatus" PointTimeSpan:"PointTimeSpanBoot"` OwnerPsFaultStatus valueTypes.Integer `json:"owner_ps_fault_status" PointId:"owner_ps_fault_status" PointUpdateFreq:"UpdateFreqInstant"`
P83081Map valueTypes.UnitValue `json:"p83081_map" PointId:"p83081" PointTimeSpan:"PointTimeSpanInstant"` P83081Map valueTypes.UnitValue `json:"p83081_map" PointId:"p83081" PointName:"Load Power" PointUpdateFreq:"UpdateFreq5Mins"`
P83081MapVirgin valueTypes.UnitValue `json:"p83081_map_virgin" PointIgnore:"true"` P83081MapVirgin valueTypes.UnitValue `json:"p83081_map_virgin" PointIgnore:"true"`
P83102Map valueTypes.UnitValue `json:"p83102_map" PointId:"p83102" PointTimeSpan:"PointTimeSpanInstant"` P83102Map valueTypes.UnitValue `json:"p83102_map" PointId:"p83102" PointName:"Energy Purchased" PointUpdateFreq:"UpdateFreq5Mins"`
P83102MapVirgin valueTypes.UnitValue `json:"p83102_map_virgin" PointIgnore:"true"` P83102MapVirgin valueTypes.UnitValue `json:"p83102_map_virgin" PointIgnore:"true"`
P83102Percent valueTypes.Float `json:"p83102_percent" PointId:"p83102" PointUnit:"%" PointTimeSpan:"PointTimeSpanInstant"` P83102Percent valueTypes.Float `json:"p83102_percent" PointId:"p83102_percent" PointName:"Energy Purchased Percent" PointUnit:"%" PointUpdateFreq:"UpdateFreq5Mins"`
P83118Map valueTypes.UnitValue `json:"p83118_map" PointId:"p83118" PointTimeSpan:"PointTimeSpanInstant"` P83118Map valueTypes.UnitValue `json:"p83118_map" PointId:"p83118" PointName:"Energy Used" PointUpdateFreq:"UpdateFreq5Mins"`
P83118MapVirgin valueTypes.UnitValue `json:"p83118_map_virgin" PointIgnore:"true"` P83118MapVirgin valueTypes.UnitValue `json:"p83118_map_virgin" PointIgnore:"true"`
P83119Map valueTypes.UnitValue `json:"p83119_map" PointId:"p83119" PointTimeSpan:"PointTimeSpanInstant"` P83119Map valueTypes.UnitValue `json:"p83119_map" PointId:"p83119" PointName:"Energy Feed-In" PointUpdateFreq:"UpdateFreq5Mins"`
P83119MapVirgin valueTypes.UnitValue `json:"p83119_map_virgin" PointIgnore:"true"` P83119MapVirgin valueTypes.UnitValue `json:"p83119_map_virgin" PointIgnore:"true"`
P83120Map valueTypes.UnitValue `json:"p83120_map" PointId:"p83120" PointTimeSpan:"PointTimeSpanInstant"` P83120Map valueTypes.UnitValue `json:"p83120_map" PointId:"p83120" PointName:"Energy Battery Charge" PointUpdateFreq:"UpdateFreq5Mins"`
P83120MapVirgin valueTypes.UnitValue `json:"p83120_map_virgin" PointIgnore:"true"` P83120MapVirgin valueTypes.UnitValue `json:"p83120_map_virgin" PointIgnore:"true"`
P83122 valueTypes.Float `json:"p83122" PointId:"p83122" PointTimeSpan:"PointTimeSpanInstant"` P83122 valueTypes.Float `json:"p83122" PointId:"p83122" PointName:"Self Sufficiency Percent" PointUnit:"%" PointUpdateFreq:"UpdateFreq5Mins"`
P83124Map valueTypes.UnitValue `json:"p83124_map" PointId:"p83124" PointTimeSpan:"PointTimeSpanInstant"` P83124Map valueTypes.UnitValue `json:"p83124_map" PointId:"p83124" PointUpdateFreq:"UpdateFreq5Mins"`
P83124MapVirgin valueTypes.UnitValue `json:"p83124_map_virgin" PointIgnore:"true"` P83124MapVirgin valueTypes.UnitValue `json:"p83124_map_virgin" PointIgnore:"true"`
P83202Map valueTypes.UnitValue `json:"p83202_map" PointId:"p83202" PointTimeSpan:"PointTimeSpanInstant"` P83202Map valueTypes.UnitValue `json:"p83202_map" PointId:"p83202" PointName:"Installed Power" PointUpdateFreq:"UpdateFreq5Mins"`
P83202MapVirgin valueTypes.UnitValue `json:"p83202_map_virgin" PointIgnore:"true"` P83202MapVirgin valueTypes.UnitValue `json:"p83202_map_virgin" PointIgnore:"true"`
P83532MapVirgin valueTypes.UnitValue `json:"p83532_map_virgin" PointIgnore:"true"` P83532MapVirgin valueTypes.UnitValue `json:"p83532_map_virgin" PointIgnore:"true"`
PowerChargeSetted valueTypes.Integer `json:"power_charge_setted" PointId:"PowerChargeSetted" PointTimeSpan:"PointTimeSpanBoot"` PowerChargeSetted valueTypes.Bool `json:"power_charge_setted" PointId:"power_charge_set" PointUpdateFreq:"UpdateFreqBoot"`
PowerGridPowerMap valueTypes.UnitValue `json:"power_grid_power_map" PointId:"PowerGridPowerMap" PointTimeSpan:"PointTimeSpanInstant"` PowerGridPowerMap valueTypes.UnitValue `json:"power_grid_power_map" PointId:"power_grid_power_map" PointUpdateFreq:"UpdateFreq5Mins"`
PowerGridPowerMapVirgin valueTypes.UnitValue `json:"power_grid_power_map_virgin" PointIgnore:"true"` PowerGridPowerMapVirgin valueTypes.UnitValue `json:"power_grid_power_map_virgin" PointIgnore:"true"`
PsCountryID valueTypes.Integer `json:"ps_country_id" PointId:"PsCountryID" PointTimeSpan:"PointTimeSpanBoot"` PsCountryID valueTypes.Integer `json:"ps_country_id" PointId:"ps_country_id" PointUpdateFreq:"UpdateFreqBoot"`
PsDeviceType valueTypes.Integer `json:"ps_device_type" PointId:"PsDeviceType" PointTimeSpan:"PointTimeSpanBoot"` PsDeviceType valueTypes.Integer `json:"ps_device_type" PointId:"ps_device_type" PointUpdateFreq:"UpdateFreqBoot"`
PsFaultStatus string `json:"ps_fault_status" PointId:"PsFaultStatus" PointTimeSpan:"PointTimeSpanBoot"` PsFaultStatus valueTypes.Integer `json:"ps_fault_status" PointId:"ps_fault_status" PointUpdateFreq:"UpdateFreqInstant"`
PsHealthStatus string `json:"ps_health_status" PointId:"PsHealthStatus" PointTimeSpan:"PointTimeSpanBoot"` PsHealthStatus valueTypes.Integer `json:"ps_health_status" PointId:"ps_health_status" PointUpdateFreq:"UpdateFreqInstant"`
PsLocation valueTypes.String `json:"ps_location" PointId:"PsLocation" PointTimeSpan:"PointTimeSpanBoot"` PsLocation valueTypes.String `json:"ps_location" PointId:"ps_location" PointUpdateFreq:"UpdateFreqBoot"`
PsName valueTypes.String `json:"ps_name" PointId:"PsName" PointTimeSpan:"PointTimeSpanBoot"` PsName valueTypes.String `json:"ps_name" PointId:"ps_name" PointUpdateFreq:"UpdateFreqBoot"`
PsPsKey valueTypes.PsKey `json:"ps_ps_key" PointId:"PsPsKey" PointTimeSpan:"PointTimeSpanBoot"` PsPsKey valueTypes.PsKey `json:"ps_ps_key" PointId:"ps_key" PointUpdateFreq:"UpdateFreqBoot"`
PsState string `json:"ps_state" PointId:"PsState" PointTimeSpan:"PointTimeSpanBoot"` PsState valueTypes.Bool `json:"ps_state" PointId:"ps_state" PointUpdateFreq:"UpdateFreqInstant"`
PsType valueTypes.Integer `json:"ps_type" PointId:"PsType" PointTimeSpan:"PointTimeSpanBoot"` PsType valueTypes.Integer `json:"ps_type" PointId:"ps_type" PointUpdateFreq:"UpdateFreqBoot"`
PvPowerMap valueTypes.UnitValue `json:"pv_power_map" PointId:"PvPowerMap" PointTimeSpan:"PointTimeSpanInstant"` PvPowerMap valueTypes.UnitValue `json:"pv_power_map" PointId:"pv_power_map" PointUpdateFreq:"UpdateFreq5Mins"`
PvPowerMapVirgin valueTypes.UnitValue `json:"pv_power_map_virgin" PointIgnore:"true"` PvPowerMapVirgin valueTypes.UnitValue `json:"pv_power_map_virgin" PointIgnore:"true"`
RobotNumSweepCapacity struct { RobotNumSweepCapacity struct {
Num valueTypes.Integer `json:"num" PointId:"Num" PointTimeSpan:"PointTimeSpanBoot"` Num valueTypes.Integer `json:"num" PointId:"num" PointUpdateFreq:"UpdateFreqBoot"`
SweepCapacity valueTypes.Float `json:"sweep_capacity" PointId:"SweepCapacity" PointTimeSpan:"PointTimeSpanBoot"` SweepCapacity valueTypes.Float `json:"sweep_capacity" PointId:"sweep_capacity" PointUpdateFreq:"UpdateFreqBoot"`
} `json:"robot_num_sweep_capacity"` } `json:"robot_num_sweep_capacity" PointId:"robot"`
SelfConsumptionOffsetReminder valueTypes.Integer `json:"self_consumption_offset_reminder" PointId:"SelfConsumptionOffsetReminder" PointTimeSpan:"PointTimeSpanBoot"` SelfConsumptionOffsetReminder valueTypes.Integer `json:"self_consumption_offset_reminder" PointId:"self_consumption_offset_reminder" PointUpdateFreq:"UpdateFreqBoot"`
So2ReduceTotal valueTypes.UnitValue `json:"so2_reduce_total" PointId:"So2ReduceTotal" PointTimeSpan:"PointTimeSpanTotal"` So2ReduceTotal valueTypes.UnitValue `json:"so2_reduce_total" PointId:"so2_reduce_total" PointUpdateFreq:"UpdateFreqTotal"`
StorageInverterData []struct { StorageInverterData []struct {
CommunicationDevSn valueTypes.String `json:"communication_dev_sn" PointId:"CommunicationDevSn" PointName:"Serial No" PointTimeSpan:"PointTimeSpanBoot"` CommunicationDevSn valueTypes.String `json:"communication_dev_sn" PointId:"communication_dev_sn" PointName:"Serial No" PointUpdateFreq:"UpdateFreqBoot"`
DevStatus valueTypes.Integer `json:"dev_status" PointId:"DevStatus" PointTimeSpan:"PointTimeSpanBoot"` DevStatus valueTypes.Integer `json:"dev_status" PointId:"dev_status" PointUpdateFreq:"UpdateFreqInstant"`
DeviceCode valueTypes.Integer `json:"device_code" PointId:"DeviceCode" PointTimeSpan:"PointTimeSpanBoot"` DeviceCode valueTypes.Integer `json:"device_code" PointId:"device_code" PointUpdateFreq:"UpdateFreqBoot"`
DeviceModelCode valueTypes.String `json:"device_model_code" PointId:"DeviceModelCode" PointTimeSpan:"PointTimeSpanBoot"` DeviceModelCode valueTypes.String `json:"device_model_code" PointId:"device_model_code" PointUpdateFreq:"UpdateFreqBoot"`
DeviceName valueTypes.String `json:"device_name" PointId:"DeviceName" PointTimeSpan:"PointTimeSpanBoot"` DeviceName valueTypes.String `json:"device_name" PointId:"device_name" PointUpdateFreq:"UpdateFreqBoot"`
DeviceState string `json:"device_state" PointId:"DeviceState" PointTimeSpan:"PointTimeSpanBoot"` DeviceState valueTypes.Integer `json:"device_state" PointId:"device_state" PointUpdateFreq:"UpdateFreqInstant"`
DeviceType valueTypes.Integer `json:"device_type" PointId:"DeviceType" PointTimeSpan:"PointTimeSpanBoot"` DeviceType valueTypes.Integer `json:"device_type" PointId:"device_type" PointUpdateFreq:"UpdateFreqBoot"`
DrmStatus valueTypes.Integer `json:"drm_status" PointId:"DrmStatus" PointTimeSpan:"PointTimeSpanBoot"` DrmStatus valueTypes.Integer `json:"drm_status" PointId:"drm_status" PointUpdateFreq:"UpdateFreqBoot"`
DrmStatusName valueTypes.String `json:"drm_status_name" PointId:"DrmStatusName" PointTimeSpan:"PointTimeSpanBoot"` DrmStatusName valueTypes.String `json:"drm_status_name" PointId:"drm_status_name" PointUpdateFreq:"UpdateFreqBoot"`
EnergyFlow []valueTypes.Integer `json:"energy_flow"` EnergyFlow []valueTypes.Integer `json:"energy_flow" PointId:"energy_flow" PointArrayFlatten:"true" PointUpdateFreq:"UpdateFreq5Mins"`
HasAmmeter valueTypes.Bool `json:"has_ammeter" PointId:"HasAmmeter" PointTimeSpan:"PointTimeSpanBoot"` HasAmmeter valueTypes.Bool `json:"has_ammeter" PointId:"has_ammeter" PointUpdateFreq:"UpdateFreqBoot"`
InstallerDevFaultStatus valueTypes.Integer `json:"installer_dev_fault_status" PointId:"InstallerDevFaultStatus" PointTimeSpan:"PointTimeSpanBoot"` InstallerDevFaultStatus valueTypes.Integer `json:"installer_dev_fault_status" PointId:"installer_dev_fault_status" PointUpdateFreq:"UpdateFreqInstant"`
InverterSn valueTypes.String `json:"inverter_sn" PointId:"InverterSn" PointTimeSpan:"PointTimeSpanBoot"` InverterSn valueTypes.String `json:"inverter_sn" PointId:"inverter_sn" PointUpdateFreq:"UpdateFreqBoot"`
OwnerDevFaultStatus valueTypes.Integer `json:"owner_dev_fault_status" PointId:"OwnerDevFaultStatus" PointTimeSpan:"PointTimeSpanBoot"` OwnerDevFaultStatus valueTypes.Integer `json:"owner_dev_fault_status" PointId:"owner_dev_fault_status" PointUpdateFreq:"UpdateFreqInstant"`
P13003Map valueTypes.UnitValue `json:"p13003_map" PointId:"p13003" PointTimeSpan:"PointTimeSpanInstant"` P13003Map valueTypes.UnitValue `json:"p13003_map" PointId:"p13003" PointName:"PV Power To Load" PointUpdateFreq:"UpdateFreq5Mins"`
P13003MapVirgin valueTypes.UnitValue `json:"p13003_map_virgin" PointIgnore:"true"` P13003MapVirgin valueTypes.UnitValue `json:"p13003_map_virgin" PointIgnore:"true"`
P13119Map valueTypes.UnitValue `json:"p13119_map" PointId:"p13119" PointTimeSpan:"PointTimeSpanInstant"` P13119Map valueTypes.UnitValue `json:"p13119_map" PointId:"p13119" PointName:"Load Power" PointUpdateFreq:"UpdateFreq5Mins"`
P13119MapVirgin valueTypes.UnitValue `json:"p13119_map_virgin" PointIgnore:"true"` P13119MapVirgin valueTypes.UnitValue `json:"p13119_map_virgin" PointIgnore:"true"`
P13121Map valueTypes.UnitValue `json:"p13121_map" PointId:"p13121" PointTimeSpan:"PointTimeSpanInstant"` P13121Map valueTypes.UnitValue `json:"p13121_map" PointId:"p13121" PointName:"PV Power To Grid" PointUpdateFreq:"UpdateFreq5Mins"`
P13121MapVirgin valueTypes.UnitValue `json:"p13121_map_virgin" PointIgnore:"true"` P13121MapVirgin valueTypes.UnitValue `json:"p13121_map_virgin" PointIgnore:"true"`
P13126Map valueTypes.UnitValue `json:"p13126_map" PointId:"p13126" PointTimeSpan:"PointTimeSpanInstant"` P13126Map valueTypes.UnitValue `json:"p13126_map" PointId:"p13126" PointName:"PV Power To Battery" PointUpdateFreq:"UpdateFreq5Mins"`
P13126MapVirgin valueTypes.UnitValue `json:"p13126_map_virgin" PointIgnore:"true"` P13126MapVirgin valueTypes.UnitValue `json:"p13126_map_virgin" PointIgnore:"true"`
P13141 valueTypes.Float `json:"p13141" PointId:"p13141" PointTimeSpan:"PointTimeSpanInstant"` P13141 valueTypes.Float `json:"p13141" PointId:"p13141" PointName:"Battery Charge Percent" PointUnit:"%" PointUpdateFreq:"UpdateFreq5Mins"`
P13149Map valueTypes.UnitValue `json:"p13149_map" PointId:"p13149" PointTimeSpan:"PointTimeSpanInstant"` P13149Map valueTypes.UnitValue `json:"p13149_map" PointId:"p13149" PointName:"Grid Power To Load" PointUpdateFreq:"UpdateFreq5Mins"`
P13149MapVirgin valueTypes.UnitValue `json:"p13149_map_virgin" PointIgnore:"true"` P13149MapVirgin valueTypes.UnitValue `json:"p13149_map_virgin" PointIgnore:"true"`
P13150Map valueTypes.UnitValue `json:"p13150_map" PointId:"p13150" PointTimeSpan:"PointTimeSpanInstant"` P13150Map valueTypes.UnitValue `json:"p13150_map" PointId:"p13150" PointUpdateFreq:"UpdateFreq5Mins"`
P13150MapVirgin valueTypes.UnitValue `json:"p13150_map_virgin" PointIgnore:"true"` P13150MapVirgin valueTypes.UnitValue `json:"p13150_map_virgin" PointIgnore:"true"`
PsKey valueTypes.PsKey `json:"ps_key" PointId:"PsKey" PointTimeSpan:"PointTimeSpanBoot"` PsKey valueTypes.PsKey `json:"ps_key" PointId:"ps_key" PointUpdateFreq:"UpdateFreqBoot"`
UUID valueTypes.Integer `json:"uuid" PointId:"UUID" PointTimeSpan:"PointTimeSpanBoot"` UUID valueTypes.Integer `json:"uuid" PointId:"uuid" PointUpdateFreq:"UpdateFreqBoot"`
} `json:"storage_inverter_data"` } `json:"storage_inverter_data" PointNameFromChild:"PsKey"`
TodayEnergy valueTypes.UnitValue `json:"today_energy" PointId:"TodayEnergy" PointTimeSpan:"PointTimeSpanDaily"` TodayEnergy valueTypes.UnitValue `json:"today_energy" PointId:"today_energy" PointUpdateFreq:"UpdateFreqDaily"`
TodayEnergyVirgin valueTypes.UnitValue `json:"today_energy_virgin" PointIgnore:"true"` TodayEnergyVirgin valueTypes.UnitValue `json:"today_energy_virgin" PointIgnore:"true"`
TodayIncome valueTypes.UnitValue `json:"today_income" PointId:"TodayIncome" PointTimeSpan:"PointTimeSpanDaily"` TodayIncome valueTypes.UnitValue `json:"today_income" PointId:"today_income" PointUpdateFreq:"UpdateFreqDaily"`
TotalEnergy valueTypes.UnitValue `json:"total_energy" PointId:"TotalEnergy" PointTimeSpan:"PointTimeSpanTotal"` TotalEnergy valueTypes.UnitValue `json:"total_energy" PointId:"total_energy" PointUpdateFreq:"UpdateFreqTotal"`
TotalEnergyVirgin valueTypes.UnitValue `json:"total_energy_virgin" PointIgnore:"true"` TotalEnergyVirgin valueTypes.UnitValue `json:"total_energy_virgin" PointIgnore:"true"`
TotalIncome valueTypes.UnitValue `json:"total_income" PointId:"TotalIncome" PointTimeSpan:"PointTimeSpanTotal"` TotalIncome valueTypes.UnitValue `json:"total_income" PointId:"total_income" PointUpdateFreq:"UpdateFreqTotal"`
TreeReduceTotal valueTypes.UnitValue `json:"tree_reduce_total" PointId:"TreeReduceTotal" PointTimeSpan:"PointTimeSpanTotal"` TreeReduceTotal valueTypes.UnitValue `json:"tree_reduce_total" PointId:"tree_reduce_total" PointUpdateFreq:"UpdateFreqTotal"`
ValidFlag valueTypes.Integer `json:"valid_flag" PointId:"ValidFlag" PointTimeSpan:"PointTimeSpanBoot"` ValidFlag valueTypes.Bool `json:"valid_flag" PointId:"valid_flag" PointUpdateFreq:"UpdateFreqBoot"`
WgsLatitude valueTypes.Float `json:"wgs_latitude" PointId:"WgsLatitude" PointTimeSpan:"PointTimeSpanBoot"` WgsLatitude valueTypes.Float `json:"wgs_latitude" PointId:"wgs_latitude" PointUpdateFreq:"UpdateFreqBoot"`
WgsLongitude valueTypes.Float `json:"wgs_longitude" PointId:"WgsLongitude" PointTimeSpan:"PointTimeSpanBoot"` WgsLongitude valueTypes.Float `json:"wgs_longitude" PointId:"wgs_longitude" PointUpdateFreq:"UpdateFreqBoot"`
ZfzyMap valueTypes.UnitValue `json:"zfzy_map" PointId:"ZfzyMap" PointTimeSpan:"PointTimeSpanInstant"` ZfzyMap valueTypes.UnitValue `json:"zfzy_map" PointId:"zfzy_map" PointName:"Self Consumption Of PV" PointUpdateFreq:"UpdateFreq5Mins"`
ZfzyMapVirgin valueTypes.UnitValue `json:"zfzy_map_virgin" PointIgnore:"true"` ZfzyMapVirgin valueTypes.UnitValue `json:"zfzy_map_virgin" PointIgnore:"true"`
ZjzzMap valueTypes.UnitValue `json:"zjzz_map" PointId:"ZjzzMap" PointTimeSpan:"PointTimeSpanInstant"` ZjzzMap valueTypes.UnitValue `json:"zjzz_map" PointId:"zjzz_map" PointName:"Self Sufficiency" PointUpdateFreq:"UpdateFreq5Mins"`
ZjzzMapVirgin valueTypes.UnitValue `json:"zjzz_map_virgin" PointIgnore:"true"` ZjzzMapVirgin valueTypes.UnitValue `json:"zjzz_map_virgin" PointIgnore:"true"`
} }
@ -150,41 +150,69 @@ func (e *ResultData) IsValid() error {
return err return err
} }
//type DecodeResultData ResultData
//
//func (e *ResultData) UnmarshalJSON(data []byte) error {
// var err error
//
// for range Only.Once {
// if len(data) == 0 {
// break
// }
// var pd DecodeResultData
//
// // Store ResultData
// _ = json.Unmarshal(data, &pd)
// e.Dummy = pd.Dummy
// }
//
// return err
//}
func (e *EndPoint) GetData() api.DataMap { func (e *EndPoint) GetData() api.DataMap {
return e.Response.ResultData.GetData()
}
func (e *ResultData) GetData() api.DataMap {
entries := api.NewDataMap() entries := api.NewDataMap()
for range Only.Once { for range Only.Once {
pkg := apiReflect.GetName("", *e) pkg := apiReflect.GetName("", *e)
name := fmt.Sprintf("%s.%s", pkg, e.PsPsKey.Value()) name := api.JoinWithDots(0, valueTypes.DateTimeLayoutDay, pkg, e.Response.ResultData.PsPsKey)
entries.StructToPoints(*e, name, e.PsPsKey.Value(), valueTypes.NewDateTime("")) entries.StructToPoints(e.Response.ResultData, name, e.Response.ResultData.PsPsKey.Value(), valueTypes.NewDateTime(""))
for _, sid := range e.StorageInverterData { dstEndpoint := "virtual." + e.Request.PsId.String()
name = fmt.Sprintf("%s.%s", pkg, sid.PsKey.Value()) srcEndpoint := fmt.Sprintf("%s.%s", pkg, e.Response.ResultData.PsPsKey.Value())
entries.StructToPoints(sid, name, sid.PsKey.Value(), valueTypes.NewDateTime(""))
var devices []string
for _, device := range e.Response.ResultData.StorageInverterData {
if !device.DeviceType.Match(api.DeviceNameEnergyStorageSystem) {
// Only looking for a Battery.
continue
} }
devices = append(devices, device.PsKey.String())
}
for pn, device := range e.Response.ResultData.StorageInverterData {
fmt.Println(pn)
fmt.Println(device.PsKey)
}
for _, device := range devices {
dstEndpoint = "virtual." + device
_ = entries.CopyPoint(api.JoinWithDots(0, "", srcEndpoint, device, "p13003"), dstEndpoint, "p13003", "") // PV Power To Load
_ = entries.CopyPoint(api.JoinWithDots(0, "", srcEndpoint, device, "p13119"), dstEndpoint, "p13119", "") // Load Power
_ = entries.CopyPoint(api.JoinWithDots(0, "", srcEndpoint, device, "p13121"), dstEndpoint, "p13121", "") // PV Power To Grid
_ = entries.CopyPoint(api.JoinWithDots(0, "", srcEndpoint, device, "p13126"), dstEndpoint, "p13126", "") // PV Power To Battery
_ = entries.CopyPoint(api.JoinWithDots(0, "", srcEndpoint, device, "p13141"), dstEndpoint, "p13141", "") // Battery Charge Percent
_ = entries.CopyPoint(api.JoinWithDots(0, "", srcEndpoint, device, "p13149"), dstEndpoint, "p13149", "") // ?? Grid Power To Load
_ = entries.CopyPoint(api.JoinWithDots(0, "", srcEndpoint, device, "p13150"), dstEndpoint, "p13150", "") //
}
dstEndpoint = "virtual." + e.Response.ResultData.PsPsKey.Value()
_ = entries.CopyPoint(srcEndpoint + ".p83081", dstEndpoint, "p83081", "") // ?? Load Power - also getPsDetailWithPsType.1171348_11_0_0.curr_power
_ = entries.CopyPoint(srcEndpoint + ".p83102", dstEndpoint, "p83102", "") // Energy Purchased
_ = entries.CopyPoint(srcEndpoint + ".p83102_percent", dstEndpoint + ".p83102", "percent", "") // Energy Purchased Percent
_ = entries.CopyPoint(srcEndpoint + ".p83118", dstEndpoint, "p83118", "") // Energy Used
_ = entries.CopyPoint(srcEndpoint + ".p83119", dstEndpoint, "p83119", "") // Energy Feed-In
_ = entries.CopyPoint(srcEndpoint + ".p83120", dstEndpoint, "p83120", "") // Energy Battery Charge
_ = entries.CopyPoint(srcEndpoint + ".p83122", dstEndpoint, "p83122", "") // Self Sufficiency Percent
_ = entries.CopyPoint(srcEndpoint + ".p83124", dstEndpoint, "p83124", "")
_ = entries.CopyPoint(srcEndpoint + ".p83202", dstEndpoint, "p83202", "") // Installed Power
_ = entries.CopyPoint(srcEndpoint + ".zjzz_map", dstEndpoint, "zjzz", "") // Self Sufficiency
_ = entries.CopyPoint(srcEndpoint + ".zfzy_map", dstEndpoint, "zfzy", "") // Self Consumption Of PV
// for _, sid := range e.Response.ResultData.StorageInverterData {
// name = api.JoinWithDots(0, valueTypes.DateTimeLayoutDay, pkg, sid.PsKey)
// entries.StructToPoints(sid, name, sid.PsKey.Value(), valueTypes.NewDateTime(""))
//
// // EnergyFlow
// for _, ef := range sid.EnergyFlow {
// name = api.JoinWithDots(0, valueTypes.DateTimeLayoutDay, pkg, sid.PsKey)
// entries.StructToPoints(ef, name, sid.PsKey.Value(), valueTypes.NewDateTime(""))
//
// // EnergyFlow
// }
// }
} }
// api.Points.Print() // api.Points.Print()
@ -204,7 +232,7 @@ func (e *EndPoint) GetPsName() string {
} }
func (e *EndPoint) GetPsState() string { func (e *EndPoint) GetPsState() string {
return e.Response.ResultData.PsState return e.Response.ResultData.PsState.String()
} }
func (e *EndPoint) GetPsKey() string { func (e *EndPoint) GetPsKey() string {

View File

@ -26,27 +26,27 @@ func (rd RequestData) Help() string {
type ResultData struct { type ResultData struct {
PageList []struct { PageList []struct {
AlarmCount valueTypes.Integer `json:"alarm_count" PointId:"alarm_count" PointTimeSpan:"PointTimeSpanBoot"` AlarmCount valueTypes.Integer `json:"alarm_count" PointId:"alarm_count" PointUpdateFreq:"UpdateFreqBoot"`
AlarmDevCount valueTypes.Integer `json:"alarm_dev_count" PointId:"alarm_dev_count" PointTimeSpan:"PointTimeSpanBoot"` AlarmDevCount valueTypes.Integer `json:"alarm_dev_count" PointId:"alarm_dev_count" PointUpdateFreq:"UpdateFreqBoot"`
AreaID interface{} `json:"area_id" PointId:"area_id"` AreaID interface{} `json:"area_id" PointId:"area_id"`
AreaType interface{} `json:"area_type" PointId:"area_type"` AreaType interface{} `json:"area_type" PointId:"area_type"`
ArrearsStatus valueTypes.Integer `json:"arrears_status" PointId:"arrears_status"` ArrearsStatus valueTypes.Integer `json:"arrears_status" PointId:"arrears_status"`
BuildDate valueTypes.DateTime `json:"build_date" PointId:"build_date" PointTimeSpan:"PointTimeSpanBoot"` BuildDate valueTypes.DateTime `json:"build_date" PointId:"build_date" PointUpdateFreq:"UpdateFreqBoot"`
BuildStatus valueTypes.Integer `json:"build_status" PointId:"build_status" PointTimeSpan:"PointTimeSpanBoot"` BuildStatus valueTypes.Integer `json:"build_status" PointId:"build_status" PointUpdateFreq:"UpdateFreqBoot"`
Co2Reduce valueTypes.UnitValue `json:"co2_reduce" PointId:"co2_reduce"` Co2Reduce valueTypes.UnitValue `json:"co2_reduce" PointId:"co2_reduce"`
Co2ReduceTotal valueTypes.UnitValue `json:"co2_reduce_total" PointId:"co2_reduce_total" PointTimeSpan:"PointTimeSpanTotal"` Co2ReduceTotal valueTypes.UnitValue `json:"co2_reduce_total" PointId:"co2_reduce_total" PointUpdateFreq:"UpdateFreqTotal"`
CurrPower valueTypes.UnitValue `json:"curr_power" PointId:"curr_power"` CurrPower valueTypes.UnitValue `json:"curr_power" PointId:"curr_power"`
DailyIrradiation valueTypes.UnitValue `json:"daily_irradiation" PointId:"daily_irradiation" PointTimeSpan:"PointTimeSpanDaily"` DailyIrradiation valueTypes.UnitValue `json:"daily_irradiation" PointId:"daily_irradiation" PointUpdateFreq:"UpdateFreqDaily"`
DailyIrradiationVirgin valueTypes.Float `json:"daily_irradiation_virgin" PointIgnore:"true"` DailyIrradiationVirgin valueTypes.Float `json:"daily_irradiation_virgin" PointIgnore:"true"`
DesignCapacity valueTypes.Float `json:"design_capacity" PointId:"design_capacity" PointUnitFrom:"design_capacity_unit"` DesignCapacity valueTypes.Float `json:"design_capacity" PointId:"design_capacity" PointUnitFrom:"design_capacity_unit"`
DesignCapacityUnit valueTypes.String `json:"design_capacity_unit" PointId:"design_capacity_unit"` DesignCapacityUnit valueTypes.String `json:"design_capacity_unit" PointId:"design_capacity_unit"`
DesignCapacityVirgin valueTypes.Float `json:"design_capacity_virgin" PointIgnore:"true"` DesignCapacityVirgin valueTypes.Float `json:"design_capacity_virgin" PointIgnore:"true"`
EquivalentHour valueTypes.UnitValue `json:"equivalent_hour" PointId:"equivalent_hour" PointTimeSpan:"PointTimeSpanDaily"` EquivalentHour valueTypes.UnitValue `json:"equivalent_hour" PointId:"equivalent_hour" PointUpdateFreq:"UpdateFreqDaily"`
EsDischargeEnergy valueTypes.UnitValue `json:"es_disenergy" PointId:"p83089" PointName:"Es Discharge Energy"` EsDischargeEnergy valueTypes.UnitValue `json:"es_disenergy" PointId:"p83089" PointName:"ES Discharge Energy" PointUpdateFreq:"UpdateFreq5Mins"`
EsEnergy valueTypes.UnitValue `json:"es_energy" PointId:"p83120" PointName:"Es Energy"` EsEnergy valueTypes.UnitValue `json:"es_energy" PointId:"p83120" PointName:"ES Energy" PointUpdateFreq:"UpdateFreq5Mins"`
EsPower valueTypes.UnitValue `json:"es_power" PointId:"p83081" PointName:"Es Power"` EsPower valueTypes.UnitValue `json:"es_power" PointId:"p83081" PointName:"ES Power" PointUpdateFreq:"UpdateFreq5Mins"`
EsTotalDischargeEnergy valueTypes.UnitValue `json:"es_total_disenergy" PointId:"p83095" PointAlias:"p83095" PointTimeSpan:"PointTimeSpanTotal"` EsTotalDischargeEnergy valueTypes.UnitValue `json:"es_total_disenergy" PointId:"p83095" PointName:"ES Total Discharge Energy" PointUpdateFreq:"UpdateFreqTotal"`
EsTotalEnergy valueTypes.UnitValue `json:"es_total_energy" PointId:"p83127" PointAlias:"p83127" PointTimeSpan:"PointTimeSpanTotal"` EsTotalEnergy valueTypes.UnitValue `json:"es_total_energy" PointId:"p83127" PointName:"ES Total Energy" PointUpdateFreq:"UpdateFreqTotal"`
ExpectInstallDate valueTypes.DateTime `json:"expect_install_date" PointId:"expect_install_date"` ExpectInstallDate valueTypes.DateTime `json:"expect_install_date" PointId:"expect_install_date"`
FaultAlarmOfflineDevCount valueTypes.Integer `json:"fault_alarm_offline_dev_count" PointId:"fault_alarm_offline_dev_count"` FaultAlarmOfflineDevCount valueTypes.Integer `json:"fault_alarm_offline_dev_count" PointId:"fault_alarm_offline_dev_count"`
FaultCount valueTypes.Integer `json:"fault_count" PointId:"fault_count"` FaultCount valueTypes.Integer `json:"fault_count" PointId:"fault_count"`
@ -64,7 +64,7 @@ type ResultData struct {
PictureURL valueTypes.String `json:"picture_url"` PictureURL valueTypes.String `json:"picture_url"`
PsID valueTypes.Integer `json:"ps_id"` PsID valueTypes.Integer `json:"ps_id"`
PsUnitUUID interface{} `json:"ps_unit_uuid"` PsUnitUUID interface{} `json:"ps_unit_uuid"`
} `json:"images"` } `json:"images" PointName:"Images"`
InstallDate valueTypes.DateTime `json:"install_date" PointId:"install_date"` InstallDate valueTypes.DateTime `json:"install_date" PointId:"install_date"`
InstalledPowerMap valueTypes.UnitValue `json:"installed_power_map" PointId:"installed_power_map"` InstalledPowerMap valueTypes.UnitValue `json:"installed_power_map" PointId:"installed_power_map"`
InstalledPowerVirgin valueTypes.Float `json:"installed_power_virgin" PointIgnore:"true"` InstalledPowerVirgin valueTypes.Float `json:"installed_power_virgin" PointIgnore:"true"`
@ -87,24 +87,24 @@ type ResultData struct {
OwnerAlarmCount valueTypes.Integer `json:"owner_alarm_count" PointId:"owner_alarm_count"` OwnerAlarmCount valueTypes.Integer `json:"owner_alarm_count" PointId:"owner_alarm_count"`
OwnerFaultCount valueTypes.Integer `json:"owner_fault_count" PointId:"owner_fault_count"` OwnerFaultCount valueTypes.Integer `json:"owner_fault_count" PointId:"owner_fault_count"`
OwnerPsFaultStatus valueTypes.Integer `json:"owner_ps_fault_status" PointId:"owner_ps_fault_status"` OwnerPsFaultStatus valueTypes.Integer `json:"owner_ps_fault_status" PointId:"owner_ps_fault_status"`
P83022y valueTypes.String `json:"p83022y" PointId:"p83022"` P83022y valueTypes.String `json:"p83022y" PointId:"p83022" PointUpdateFreq:"UpdateFreq5Mins"`
P83046 valueTypes.Float `json:"p83046" PointId:"p83046"` P83046 valueTypes.Float `json:"p83046" PointId:"p83046" PointUpdateFreq:"UpdateFreq5Mins"`
P83048 valueTypes.Float `json:"p83048" PointId:"p83048"` P83048 valueTypes.Float `json:"p83048" PointId:"p83048" PointUpdateFreq:"UpdateFreq5Mins"`
P83049 valueTypes.Float `json:"p83049" PointId:"p83049"` P83049 valueTypes.Float `json:"p83049" PointId:"p83049" PointUpdateFreq:"UpdateFreq5Mins"`
P83050 valueTypes.Float `json:"p83050" PointId:"p83050"` P83050 valueTypes.Float `json:"p83050" PointId:"p83050" PointUpdateFreq:"UpdateFreq5Mins"`
P83051 valueTypes.Float `json:"p83051" PointId:"p83051"` P83051 valueTypes.Float `json:"p83051" PointId:"p83051" PointUpdateFreq:"UpdateFreq5Mins"`
P83054 valueTypes.Float `json:"p83054" PointId:"p83054"` P83054 valueTypes.Float `json:"p83054" PointId:"p83054" PointUpdateFreq:"UpdateFreq5Mins"`
P83055 valueTypes.Float `json:"p83055" PointId:"p83055"` P83055 valueTypes.Float `json:"p83055" PointId:"p83055" PointUpdateFreq:"UpdateFreq5Mins"`
P83067 valueTypes.Float `json:"p83067" PointId:"p83067"` P83067 valueTypes.Float `json:"p83067" PointId:"p83067" PointUpdateFreq:"UpdateFreq5Mins"`
P83070 valueTypes.Float `json:"p83070" PointId:"p83070"` P83070 valueTypes.Float `json:"p83070" PointId:"p83070" PointUpdateFreq:"UpdateFreq5Mins"`
P83076 valueTypes.Float `json:"p83076" PointId:"p83076" PointIgnore:"true"` // Dupe of PvPower P83076 valueTypes.Float `json:"p83076" PointId:"_p83076" PointName:"Pv Power" PointIgnore:"true"` // Dupe of PvPower
P83077 valueTypes.Float `json:"p83077" PointId:"p83077" PointIgnore:"true"` // Dupe of PvEnergy P83077 valueTypes.Float `json:"p83077" PointId:"_p83077" PointName:"Pv Energy" PointIgnore:"true"` // Dupe of PvEnergy
P83081 valueTypes.Float `json:"p83081" PointId:"p83081" PointIgnore:"true"` // Dupe of EsPower P83081 valueTypes.Float `json:"p83081" PointId:"_p83081" PointName:"Es Power" PointIgnore:"true"` // Dupe of EsPower
P83089 valueTypes.Float `json:"p83089" PointId:"p83089" PointIgnore:"true"` // Dupe of EsDischargeEnergy P83089 valueTypes.Float `json:"p83089" PointId:"_p83089" PointName:"Es Discharge Energy" PointIgnore:"true"` // Dupe of EsDischargeEnergy
P83095 valueTypes.Float `json:"p83095" PointId:"p83095" PointIgnore:"true"` // Dupe of EsTotalDischargeEnergy P83095 valueTypes.Float `json:"p83095" PointId:"_p83095" PointName:"Es Total Discharge Energy" PointIgnore:"true"` // Dupe of EsTotalDischargeEnergy
P83118 valueTypes.Float `json:"p83118" PointId:"p83118" PointIgnore:"true"` // Dupe of UseEnergy P83118 valueTypes.Float `json:"p83118" PointId:"_p83118" PointName:"Use Energy" PointIgnore:"true"` // Dupe of UseEnergy
P83120 valueTypes.Float `json:"p83120" PointId:"p83120" PointIgnore:"true"` // Dupe of EsEnergy P83120 valueTypes.Float `json:"p83120" PointId:"_p83120" PointName:"Es Energy" PointIgnore:"true"` // Dupe of EsEnergy
P83127 valueTypes.Float `json:"p83127" PointId:"p83127" PointIgnore:"true"` // Dupe of EsTotalEnergy P83127 valueTypes.Float `json:"p83127" PointId:"_p83127" PointName:"Es Total Energy" PointIgnore:"true"` // Dupe of EsTotalEnergy
ParamCo2 valueTypes.Float `json:"param_co2" PointId:"param_co2"` ParamCo2 valueTypes.Float `json:"param_co2" PointId:"param_co2"`
ParamCoal valueTypes.Float `json:"param_coal" PointId:"param_coal"` ParamCoal valueTypes.Float `json:"param_coal" PointId:"param_coal"`
ParamIncome valueTypes.Float `json:"param_income" PointId:"param_income"` ParamIncome valueTypes.Float `json:"param_income" PointId:"param_income"`
@ -118,39 +118,39 @@ type ResultData struct {
Producer interface{} `json:"producer" PointId:"producer"` Producer interface{} `json:"producer" PointId:"producer"`
PsCountryID valueTypes.Integer `json:"ps_country_id" PointId:"ps_country_id"` PsCountryID valueTypes.Integer `json:"ps_country_id" PointId:"ps_country_id"`
PsFaultStatus valueTypes.Integer `json:"ps_fault_status" PointId:"ps_fault_status"` PsFaultStatus valueTypes.Integer `json:"ps_fault_status" PointId:"ps_fault_status"`
PsHealthStatus string `json:"ps_health_status" PointId:"ps_health_status"` PsHealthStatus valueTypes.Integer `json:"ps_health_status" PointId:"ps_health_status"`
PsHolder valueTypes.String `json:"ps_holder" PointId:"ps_holder"` PsHolder valueTypes.String `json:"ps_holder" PointId:"ps_holder"`
PsID valueTypes.Integer `json:"ps_id" PointId:"ps_id"` PsId valueTypes.Integer `json:"ps_id" PointId:"ps_id"`
PsIsNotInit valueTypes.Bool `json:"ps_is_not_init" PointId:"ps_is_not_init"` PsIsNotInit valueTypes.Bool `json:"ps_is_not_init" PointId:"ps_is_not_init"`
PsName valueTypes.String `json:"ps_name" PointId:"ps_name"` PsName valueTypes.String `json:"ps_name" PointId:"ps_name"`
PsShortName valueTypes.String `json:"ps_short_name" PointId:"ps_short_name"` PsShortName valueTypes.String `json:"ps_short_name" PointId:"ps_short_name"`
PsStatus valueTypes.Bool `json:"ps_status" PointId:"ps_status"` PsStatus valueTypes.Integer `json:"ps_status" PointId:"ps_status"`
PsTimezone valueTypes.String `json:"ps_timezone" PointId:"ps_timezone"` PsTimezone valueTypes.String `json:"ps_timezone" PointId:"ps_timezone"`
PsType valueTypes.Integer `json:"ps_type" PointId:"ps_type"` PsType valueTypes.Integer `json:"ps_type" PointId:"ps_type"`
PvEnergy valueTypes.UnitValue `json:"pv_energy" PointId:"p83077" PointName:"Pv Energy"` PvEnergy valueTypes.UnitValue `json:"pv_energy" PointId:"p83077" PointName:"Pv Energy" PointUpdateFreq:"UpdateFreq5Mins"`
PvPower valueTypes.UnitValue `json:"pv_power" PointId:"p83076" PointName:"Pv Power"` PvPower valueTypes.UnitValue `json:"pv_power" PointId:"p83076" PointName:"Pv Power" PointUpdateFreq:"UpdateFreq5Mins"`
Radiation valueTypes.UnitValue `json:"radiation" PointId:"radiation"` Radiation valueTypes.UnitValue `json:"radiation" PointId:"radiation"`
RadiationVirgin valueTypes.Float `json:"radiation_virgin" PointIgnore:"true"` RadiationVirgin valueTypes.Float `json:"radiation_virgin" PointIgnore:"true"`
RecordCreateTime valueTypes.DateTime `json:"recore_create_time" PointId:"record_create_time"` RecordCreateTime valueTypes.DateTime `json:"recore_create_time" PointId:"record_create_time"`
SafeStartDate valueTypes.DateTime `json:"safe_start_date" PointId:"safe_start_date"` SafeStartDate valueTypes.DateTime `json:"safe_start_date" PointId:"safe_start_date"`
ShareType string `json:"share_type" PointId:"share_type"` ShareType valueTypes.Integer `json:"share_type" PointId:"share_type"`
ShippingAddress valueTypes.String `json:"shipping_address" PointId:"shipping_address"` ShippingAddress valueTypes.String `json:"shipping_address" PointId:"shipping_address"`
ShippingZipCode valueTypes.String `json:"shipping_zip_code" PointId:"shipping_zip_code"` ShippingZipCode valueTypes.String `json:"shipping_zip_code" PointId:"shipping_zip_code"`
TodayEnergy valueTypes.UnitValue `json:"today_energy" PointId:"today_energy" PointTimeSpan:"PointTimeSpanDaily"` TodayEnergy valueTypes.UnitValue `json:"today_energy" PointId:"today_energy" PointUpdateFreq:"UpdateFreqDaily"`
TodayIncome valueTypes.UnitValue `json:"today_income" PointId:"today_income" PointTimeSpan:"PointTimeSpanDaily"` TodayIncome valueTypes.UnitValue `json:"today_income" PointId:"today_income" PointUpdateFreq:"UpdateFreqDaily"`
TotalCapacity valueTypes.UnitValue `json:"total_capcity" PointId:"total_capacity" PointTimeSpan:"PointTimeSpanTotal"` TotalCapacity valueTypes.UnitValue `json:"total_capcity" PointId:"total_capacity" PointUpdateFreq:"UpdateFreqTotal"`
TotalEnergy valueTypes.UnitValue `json:"total_energy" PointId:"total_energy" PointTimeSpan:"PointTimeSpanTotal"` TotalEnergy valueTypes.UnitValue `json:"total_energy" PointId:"total_energy" PointUpdateFreq:"UpdateFreqTotal"`
TotalIncome valueTypes.UnitValue `json:"total_income" PointId:"total_income" PointTimeSpan:"PointTimeSpanTotal"` TotalIncome valueTypes.UnitValue `json:"total_income" PointId:"total_income" PointUpdateFreq:"UpdateFreqTotal"`
TotalInitCo2Accelerate valueTypes.Float `json:"total_init_co2_accelerate" PointId:"total_init_co2_accelerate" PointTimeSpan:"PointTimeSpanTotal"` TotalInitCo2Accelerate valueTypes.Float `json:"total_init_co2_accelerate" PointId:"total_init_co2_accelerate" PointUpdateFreq:"UpdateFreqTotal"`
TotalInitElec valueTypes.Float `json:"total_init_elec" PointId:"total_init_elec" PointTimeSpan:"PointTimeSpanTotal"` TotalInitElec valueTypes.Float `json:"total_init_elec" PointId:"total_init_elec" PointUpdateFreq:"UpdateFreqTotal"`
TotalInitProfit valueTypes.Float `json:"total_init_profit" PointId:"total_init_profit" PointTimeSpan:"PointTimeSpanTotal"` TotalInitProfit valueTypes.Float `json:"total_init_profit" PointId:"total_init_profit" PointUpdateFreq:"UpdateFreqTotal"`
UseEnergy valueTypes.UnitValue `json:"use_energy" PointId:"p83118" PointName:"Use Energy"` UseEnergy valueTypes.UnitValue `json:"use_energy" PointId:"p83118" PointName:"Use Energy" PointUpdateFreq:"UpdateFreq5Mins"`
ValidFlag valueTypes.Bool `json:"valid_flag" PointId:"valid_flag"` ValidFlag valueTypes.Bool `json:"valid_flag" PointId:"valid_flag"`
WgsLatitude valueTypes.Float `json:"wgs_latitude" PointId:"wgs_latitude"` WgsLatitude valueTypes.Float `json:"wgs_latitude" PointId:"wgs_latitude"`
WgsLongitude valueTypes.Float `json:"wgs_longitude" PointId:"wgs_longitude"` WgsLongitude valueTypes.Float `json:"wgs_longitude" PointId:"wgs_longitude"`
ZipCode valueTypes.String `json:"zip_code" PointId:"zip_code"` ZipCode valueTypes.String `json:"zip_code" PointId:"zip_code"`
} `json:"pageList"` } `json:"pageList" PointNameFromChild:"PsId"`
RowCount valueTypes.Integer `json:"rowCount"` RowCount valueTypes.Integer `json:"rowCount" PointIgnore:"true"`
} }
func (e *ResultData) IsValid() error { func (e *ResultData) IsValid() error {
@ -164,14 +164,26 @@ func (e *ResultData) IsValid() error {
return err return err
} }
func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()
for range Only.Once {
pkg := apiReflect.GetName("", *e)
dt := valueTypes.NewDateTime(valueTypes.Now)
entries.StructToPoints(e.Response.ResultData, pkg, "", dt)
}
return entries
}
type Device struct { type Device struct {
PsFaultStatus valueTypes.Integer PsFaultStatus valueTypes.Integer
PsHealthStatus string PsHealthStatus valueTypes.Integer
PsHolder valueTypes.String PsHolder valueTypes.String
PsID valueTypes.Integer PsID valueTypes.Integer
PsName valueTypes.String PsName valueTypes.String
PsShortName valueTypes.String PsShortName valueTypes.String
PsStatus valueTypes.Bool PsStatus valueTypes.Integer
PsType valueTypes.Integer PsType valueTypes.Integer
} }
type Devices []Device type Devices []Device
@ -183,7 +195,7 @@ func (e *ResultData) GetPsDevices() Devices {
PsFaultStatus: d.PsFaultStatus, PsFaultStatus: d.PsFaultStatus,
PsHealthStatus: d.PsHealthStatus, PsHealthStatus: d.PsHealthStatus,
PsHolder: d.PsHolder, PsHolder: d.PsHolder,
PsID: d.PsID, PsID: d.PsId,
PsName: d.PsName, PsName: d.PsName,
PsShortName: d.PsShortName, PsShortName: d.PsShortName,
PsStatus: d.PsStatus, PsStatus: d.PsStatus,
@ -201,8 +213,8 @@ func (e *ResultData) GetPsIds() []valueTypes.Integer {
break break
} }
for _, p := range e.PageList { for _, p := range e.PageList {
if p.PsID.Value() != 0 { if p.PsId.Value() != 0 {
ret = append(ret, p.PsID) ret = append(ret, p.PsId)
} }
} }
} }
@ -217,7 +229,7 @@ func (e *ResultData) GetPsName() []string {
break break
} }
for _, p := range e.PageList { for _, p := range e.PageList {
if p.PsID.Value() != 0 { if p.PsId.Value() != 0 {
ret = append(ret, p.PsName.Value()) ret = append(ret, p.PsName.Value())
} }
} }
@ -233,7 +245,7 @@ func (e *ResultData) GetPsSerial() []string {
break break
} }
for _, p := range e.PageList { for _, p := range e.PageList {
if p.PsID.Value() != 0 { if p.PsId.Value() != 0 {
ret = append(ret, p.PsShortName.Value()) ret = append(ret, p.PsShortName.Value())
} }
} }
@ -244,28 +256,3 @@ func (e *ResultData) GetPsSerial() []string {
func (e *EndPoint) GetPsIds() []valueTypes.Integer { func (e *EndPoint) GetPsIds() []valueTypes.Integer {
return e.Response.ResultData.GetPsIds() return e.Response.ResultData.GetPsIds()
} }
func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()
for range Only.Once {
if len(e.Response.ResultData.PageList) == 0 {
break
}
// now := valueTypes.NewDateTime(time.Now().Round(5 * time.Minute).Format(api.DtLayoutZeroSeconds))
pkg := apiReflect.GetName("", *e)
for _, p := range e.Response.ResultData.PageList {
// psId := p.PsID.String() // psId := strconv.FormatInt(p.PsID.Value(), 10)
name := api.JoinWithDots(0, "", pkg, p.PsID)
entries.StructToPoints(p, name, p.PsID.String(), valueTypes.NewDateTime(""))
for i, v := range p.Images {
name2 := api.JoinWithDots(0, "", pkg, p.PsID, "images", i)
entries.StructToPoints(v, name2, p.PsID.String(), valueTypes.NewDateTime(""))
}
}
}
return entries
}

View File

@ -27,17 +27,17 @@ func (rd RequestData) Help() string {
type ResultData struct { type ResultData struct {
DevCountByStatusMap struct { DevCountByStatusMap struct {
FaultCount valueTypes.Count `json:"fault_count" PointId:"fault_count"` FaultCount valueTypes.Count `json:"fault_count" PointId:"fault_count" PointUpdateFreq:"UpdateFreqTotal"`
OfflineCount valueTypes.Count `json:"offline_count" PointId:"offline_count"` OfflineCount valueTypes.Count `json:"offline_count" PointId:"offline_count" PointUpdateFreq:"UpdateFreqTotal"`
RunCount valueTypes.Count `json:"run_count" PointId:"run_count"` RunCount valueTypes.Count `json:"run_count" PointId:"run_count" PointUpdateFreq:"UpdateFreqTotal"`
WarningCount valueTypes.Count `json:"warning_count" PointId:"warning_count"` WarningCount valueTypes.Count `json:"warning_count" PointId:"warning_count" PointUpdateFreq:"UpdateFreqTotal"`
} `json:"dev_count_by_status_map"` } `json:"dev_count_by_status_map" PointId:"device_status_count"`
DevCountByTypeMap map[string]valueTypes.Integer `json:"dev_count_by_type_map"` DevCountByTypeMap map[string]valueTypes.Integer `json:"dev_count_by_type_map" PointId:"device_type_count" PointUpdateFreq:"UpdateFreqBoot"`
// DevCountByTypeMap struct { // DevCountByTypeMap struct {
// One4 valueTypes.Integer `json:"14"` // One4 valueTypes.Integer `json:"14"`
// Two2 valueTypes.Integer `json:"22"` // Two2 valueTypes.Integer `json:"22"`
// } `json:"dev_count_by_type_map"` // } `json:"dev_count_by_type_map"`
DevTypeDefinition map[string]valueTypes.String `json:"dev_type_definition"` DevTypeDefinition map[string]valueTypes.String `json:"dev_type_definition" PointId:"device_types" PointUpdateFreq:"UpdateFreqBoot"`
// DevTypeDefinition struct { // DevTypeDefinition struct {
// One string `json:"1"` // One string `json:"1"`
// One0 string `json:"10"` // One0 string `json:"10"`
@ -89,79 +89,79 @@ type ResultData struct {
// Nine9 string `json:"99"` // Nine9 string `json:"99"`
// } `json:"dev_type_definition"` // } `json:"dev_type_definition"`
PageList []struct { PageList []struct {
AlarmCount valueTypes.Count `json:"alarm_count" PointId:"alarm_count"` AlarmCount valueTypes.Count `json:"alarm_count" PointId:"alarm_count" PointUpdateFreq:"UpdateFreqTotal"`
ChannelId valueTypes.Integer `json:"chnnl_id" PointId:"channel_id"` ChannelId valueTypes.Integer `json:"chnnl_id" PointId:"channel_id" PointUpdateFreq:"UpdateFreqBoot"`
CommandStatus valueTypes.Integer `json:"command_status" PointId:"command_status"` CommandStatus valueTypes.Integer `json:"command_status" PointId:"command_status" PointUpdateFreq:"UpdateFreqInstant"`
ComponentAmount valueTypes.Integer `json:"component_amount" PointId:"component_amount"` ComponentAmount valueTypes.Integer `json:"component_amount" PointId:"component_amount"`
DataFlag valueTypes.Integer `json:"data_flag" PointId:"data_flag"` DataFlag valueTypes.Integer `json:"data_flag" PointId:"data_flag" PointUpdateFreq:"UpdateFreqBoot"`
DataFlagDetail valueTypes.Integer `json:"data_flag_detail" PointId:"data_flag_detail"` DataFlagDetail valueTypes.Integer `json:"data_flag_detail" PointId:"data_flag_detail"`
DeviceArea valueTypes.Integer `json:"device_area" PointId:"device_area"` DeviceArea valueTypes.Integer `json:"device_area" PointId:"device_area" PointUpdateFreq:"UpdateFreqBoot"` // References UUID and referenced by UUIDIndexCode
DeviceAreaName valueTypes.String `json:"device_area_name" PointId:"device_area_name"` DeviceAreaName valueTypes.String `json:"device_area_name" PointId:"device_area_name" PointUpdateFreq:"UpdateFreqBoot"`
DeviceCode valueTypes.Integer `json:"device_code" PointId:"device_code"` DeviceCode valueTypes.Integer `json:"device_code" PointId:"device_code" PointUpdateFreq:"UpdateFreqBoot"`
DeviceID valueTypes.Integer `json:"device_id" PointId:"device_id"` DeviceID valueTypes.Integer `json:"device_id" PointId:"device_id" PointUpdateFreq:"UpdateFreqBoot"`
DeviceModelCode valueTypes.String `json:"device_model_code" PointId:"device_model_code"` DeviceModelCode valueTypes.String `json:"device_model_code" PointId:"device_model_code" PointUpdateFreq:"UpdateFreqBoot"`
DeviceModelID valueTypes.Integer `json:"device_model_id" PointId:"device_model_id"` DeviceModelID valueTypes.Integer `json:"device_model_id" PointId:"device_model_id" PointUpdateFreq:"UpdateFreqBoot"`
DeviceName valueTypes.String `json:"device_name" PointId:"device_name"` DeviceName valueTypes.String `json:"device_name" PointId:"device_name" PointUpdateFreq:"UpdateFreqBoot"`
DeviceStatus valueTypes.Bool `json:"device_status" PointId:"device_status"` DeviceStatus valueTypes.Bool `json:"device_status" PointId:"device_status" PointUpdateFreq:"UpdateFreqInstant"`
DeviceType valueTypes.Integer `json:"device_type" PointId:"device_type"` DeviceType valueTypes.Integer `json:"device_type" PointId:"device_type" PointUpdateFreq:"UpdateFreqBoot"`
FaultCount valueTypes.Count `json:"fault_count" PointId:"fault_count"` FaultCount valueTypes.Count `json:"fault_count" PointId:"fault_count" PointUpdateFreq:"UpdateFreqTotal"`
FaultStatus string `json:"fault_status" PointId:"fault_status"` FaultStatus string `json:"fault_status" PointId:"fault_status" PointUpdateFreq:"UpdateFreqInstant"`
FunctionEnum valueTypes.String `json:"function_enum" PointId:"function_enum"` FunctionEnum valueTypes.String `json:"function_enum" PointId:"function_enum" PointUpdateFreq:"UpdateFreqInstant"`
InstallerAlarmCount valueTypes.Count `json:"installer_alarm_count" PointId:"installer_alarm_count"` InstallerAlarmCount valueTypes.Count `json:"installer_alarm_count" PointId:"installer_alarm_count" PointUpdateFreq:"UpdateFreqTotal"`
InstallerDevFaultStatus valueTypes.Integer `json:"installer_dev_fault_status" PointId:"installer_dev_fault_status"` InstallerDevFaultStatus valueTypes.Integer `json:"installer_dev_fault_status" PointId:"installer_dev_fault_status" PointUpdateFreq:"UpdateFreqInstant"`
InstallerFaultCount valueTypes.Count `json:"installer_fault_count" PointId:"installer_fault_count"` InstallerFaultCount valueTypes.Count `json:"installer_fault_count" PointId:"installer_fault_count" PointUpdateFreq:"UpdateFreqTotal"`
InverterModelType valueTypes.Integer `json:"inverter_model_type" PointId:"inverter_model_type"` InverterModelType valueTypes.Integer `json:"inverter_model_type" PointId:"inverter_model_type" PointUpdateFreq:"UpdateFreqBoot"`
IsDeveloper valueTypes.Bool `json:"is_developer" PointId:"is_developer"` IsDeveloper valueTypes.Bool `json:"is_developer" PointId:"is_developer" PointUpdateFreq:"UpdateFreqBoot"`
IsG2point5Module valueTypes.Bool `json:"is_g2point5_module" PointId:"is_g2point5_module"` IsG2point5Module valueTypes.Bool `json:"is_g2point5_module" PointId:"is_g2point5_module" PointUpdateFreq:"UpdateFreqBoot"`
IsInit valueTypes.Bool `json:"is_init" PointId:"is_init"` IsInit valueTypes.Bool `json:"is_init" PointId:"is_init" PointUpdateFreq:"UpdateFreqBoot"`
IsSecond valueTypes.Bool `json:"is_second" PointId:"is_second"` IsSecond valueTypes.Bool `json:"is_second" PointId:"is_second" PointUpdateFreq:"UpdateFreqBoot"`
IsSupportParamset valueTypes.Bool `json:"is_support_paramset" PointId:"is_support_paramset"` IsSupportParamset valueTypes.Bool `json:"is_support_paramset" PointId:"is_support_paramset" PointUpdateFreq:"UpdateFreqBoot"`
NodeTimestamps interface{} `json:"node_timestamps" PointId:"node_timestamps"` NodeTimestamps interface{} `json:"node_timestamps" PointId:"node_timestamps"`
OwnerAlarmCount valueTypes.Count `json:"owner_alarm_count" PointId:"owner_alarm_count"` OwnerAlarmCount valueTypes.Count `json:"owner_alarm_count" PointId:"owner_alarm_count" PointUpdateFreq:"UpdateFreqTotal"`
OwnerDevFaultStatus valueTypes.Integer `json:"owner_dev_fault_status" PointId:"owner_dev_fault_status"` OwnerDevFaultStatus valueTypes.Integer `json:"owner_dev_fault_status" PointId:"owner_dev_fault_status" PointUpdateFreq:"UpdateFreqInstant"`
OwnerFaultCount valueTypes.Count `json:"owner_fault_count" PointId:"owner_fault_count"` OwnerFaultCount valueTypes.Count `json:"owner_fault_count" PointId:"owner_fault_count" PointUpdateFreq:"UpdateFreqTotal"`
PointData PointData `json:"point_data"` PointData []PointStruct `json:"point_data" PointNameFromChild:"PointID"`
Points interface{} `json:"points" PointId:"points"` Points interface{} `json:"points" PointId:"points"`
PsTimezoneInfo struct { PsTimezoneInfo struct {
IsDst valueTypes.Bool `json:"is_dst"` IsDst valueTypes.Bool `json:"is_dst" PointUpdateFreq:"UpdateFreqInstant"`
TimeZone valueTypes.String `json:"time_zone"` TimeZone valueTypes.String `json:"time_zone" PointUpdateFreq:"UpdateFreqInstant"`
} `json:"psTimezoneInfo"` } `json:"psTimezoneInfo"`
PsID valueTypes.Integer `json:"ps_id" PointId:"ps_id"` PsID valueTypes.Integer `json:"ps_id" PointId:"ps_id" PointUpdateFreq:"UpdateFreqBoot"`
PsKey valueTypes.PsKey `json:"ps_key" PointId:"ps_key"` PsKey valueTypes.PsKey `json:"ps_key" PointId:"ps_key" PointUpdateFreq:"UpdateFreqBoot"`
RelState valueTypes.Integer `json:"rel_state" PointId:"rel_state"` RelState valueTypes.Integer `json:"rel_state" PointId:"rel_state" PointUpdateFreq:"UpdateFreqInstant"`
Sn valueTypes.String `json:"sn" PointId:"sn"` Sn valueTypes.String `json:"sn" PointId:"sn" PointName:"Serial Number" PointUpdateFreq:"UpdateFreqBoot"`
StringAmount valueTypes.Integer `json:"string_amount" PointId:"string_amount"` StringAmount valueTypes.Integer `json:"string_amount" PointId:"string_amount"`
TypeName valueTypes.String `json:"type_name" PointId:"type_name"` TypeName valueTypes.String `json:"type_name" PointId:"type_name" PointUpdateFreq:"UpdateFreqBoot"`
UnitName valueTypes.String `json:"unit_name" PointId:"unit_name"` UnitName valueTypes.String `json:"unit_name" PointId:"unit_name" PointUpdateFreq:"UpdateFreqBoot"`
UUID valueTypes.Integer `json:"uuid" PointId:"uuid"` UUID valueTypes.Integer `json:"uuid" PointId:"uuid" PointUpdateFreq:"UpdateFreqBoot"` // Referenced by DeviceArea
UUIDIndexCode valueTypes.String `json:"uuid_index_code" PointId:"uuid_index_code"` UUIDIndexCode valueTypes.String `json:"uuid_index_code" PointId:"uuid_index_code" PointUpdateFreq:"UpdateFreqBoot"` // Referenced by DeviceArea
} `json:"pageList"` } `json:"pageList" PointNameFromChild:"PsKey" PointSliceDateFormat:""`
RowCount valueTypes.Integer `json:"rowCount" PointIgnore:"true"` RowCount valueTypes.Integer `json:"rowCount" PointIgnore:"true"`
} }
type PointData []PointStruct
type PointStruct struct { type PointStruct struct {
CodeID valueTypes.Integer `json:"code_id"` CodeID valueTypes.Integer `json:"code_id" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUpdateFreq:"UpdateFreqBoot"`
CodeIDOrderID valueTypes.String `json:"code_id_order_id"` CodeIDOrderID valueTypes.String `json:"code_id_order_id" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUpdateFreq:"UpdateFreqBoot"`
CodeName valueTypes.String `json:"code_name"` CodeName valueTypes.String `json:"code_name" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUpdateFreq:"UpdateFreqBoot"`
DevPointLastUpdateTime valueTypes.DateTime `json:"dev_point_last_update_time"` DevPointLastUpdateTime valueTypes.DateTime `json:"dev_point_last_update_time" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUpdateFreq:"UpdateFreq5Mins"`
IsPlatformDefaultUnit valueTypes.Bool `json:"is_platform_default_unit"` IsPlatformDefaultUnit valueTypes.Bool `json:"is_platform_default_unit" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUpdateFreq:"UpdateFreqBoot"`
IsShow valueTypes.Bool `json:"is_show"` IsShow valueTypes.Bool `json:"is_show" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUpdateFreq:"UpdateFreqBoot"`
OrderID valueTypes.Integer `json:"order_id"` OrderID valueTypes.Integer `json:"order_id" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUpdateFreq:"UpdateFreqBoot"`
OrderNum valueTypes.Integer `json:"order_num"` OrderNum valueTypes.Integer `json:"order_num" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUpdateFreq:"UpdateFreqBoot"`
PointGroupID valueTypes.Integer `json:"point_group_id"` PointGroupID valueTypes.Integer `json:"point_group_id" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUpdateFreq:"UpdateFreqBoot"`
PointGroupIDOrderID valueTypes.Integer `json:"point_group_id_order_id"` PointGroupIDOrderID valueTypes.Integer `json:"point_group_id_order_id" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUpdateFreq:"UpdateFreqBoot"`
PointGroupName valueTypes.String `json:"point_group_name"` PointName valueTypes.String `json:"point_name" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUpdateFreq:"UpdateFreqBoot"`
PointID valueTypes.Integer `json:"point_id"` PointSign valueTypes.String `json:"point_sign" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUpdateFreq:"UpdateFreqBoot"`
PointName valueTypes.String `json:"point_name"` Relate valueTypes.Integer `json:"relate" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUpdateFreq:"UpdateFreqBoot"`
PointSign valueTypes.String `json:"point_sign"` ValIsFixd valueTypes.Bool `json:"val_is_fixd" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUpdateFreq:"UpdateFreqBoot"`
Relate valueTypes.Integer `json:"relate"` ValidSize valueTypes.Integer `json:"valid_size" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUpdateFreq:"UpdateFreqBoot"`
TimeStamp valueTypes.DateTime `json:"time_stamp"` Value valueTypes.Float `json:"value" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUnitFrom:"Unit" PointUpdateFreq:"UpdateFreq5Mins"`
Unit valueTypes.String `json:"unit"` ValueDescription valueTypes.String `json:"value_description" PointGroupNameFrom:"PointGroupName" PointTimestampFrom:"TimeStamp" PointUpdateFreq:"UpdateFreqBoot"`
ValIsFixd valueTypes.Bool `json:"val_is_fixd"`
ValidSize valueTypes.Integer `json:"valid_size"` PointID valueTypes.PointId `json:"point_id" PointIgnore:"true" PointUpdateFreq:"UpdateFreqBoot"`
Value valueTypes.Float `json:"value"` PointGroupName valueTypes.String `json:"point_group_name" PointIgnore:"true" PointUpdateFreq:"UpdateFreqBoot"`
ValueDescription valueTypes.String `json:"value_description"` TimeStamp valueTypes.DateTime `json:"time_stamp" PointIgnore:"true" PointUpdateFreq:"UpdateFreq5Mins"`
Unit valueTypes.String `json:"unit" PointIgnore:"true" PointUpdateFreq:"UpdateFreqBoot"`
} }
func (e *ResultData) IsValid() error { func (e *ResultData) IsValid() error {
@ -175,8 +175,8 @@ func (e *ResultData) IsValid() error {
return err return err
} }
func (e *ResultData) GetDataByName(name string) PointData { func (e *ResultData) GetDataByName(name string) []PointStruct {
var ret PointData var ret []PointStruct
for range Only.Once { for range Only.Once {
i := len(e.PageList) i := len(e.PageList)
if i == 0 { if i == 0 {
@ -236,128 +236,66 @@ func (e *EndPoint) GetData() api.DataMap {
// var TotalEnergyConsumption VirtualPointStruct // var TotalEnergyConsumption VirtualPointStruct
pkg := apiReflect.GetName("", *e) pkg := apiReflect.GetName("", *e)
name := api.JoinWithDots(0, "", pkg, e.Request.PsId) // name := api.JoinWithDots(0, "", pkg) // , e.Request.PsId)
dt := valueTypes.NewDateTime(valueTypes.Now)
entries.StructToPoints(e.Response.ResultData, pkg, e.Request.PsId.String(), dt)
entries.StructToPoints(e.Response.ResultData, name, e.Request.PsId.String(), valueTypes.NewDateTime("")) if len(entries.Map) == 0 {
for _, d := range e.Response.ResultData.PageList {
name2 := api.JoinWithDots(0, "", pkg, d.PsKey)
entries.StructToPoints(d, name2, d.PsKey.Value(), valueTypes.NewDateTime(""))
for _, p := range d.PointData {
pid := valueTypes.SetPointIdValue(p.PointID.Value())
uv := valueTypes.SetUnitValueFloat(p.Value.Value(), p.Unit.Value(), "")
// name2 := fmt.Sprintf("%s.PointData.%s", name, pid)
// name3 := fmt.Sprintf("%s.PointData", name2)
entries.AddUnitValue(name2, d.PsKey.Value(), pid, p.PointName.Value(), p.PointGroupName.Value(), p.TimeStamp, uv)
// Handle virtual results.
// switch pid {
// case "13126":
// // BatteryChargingPower
// entries["PVPowerToBattery"] = entries[pid]
// case "13150":
// // BatteryDischargingPower
// entries["BatteryPowerToLoad"] = entries[pid]
// case "13121":
// // TotalExportActivePower
// entries["PVPowerToGrid"] = entries[pid]
// case "13149":
// // PurchasedPower
// entries["GridPowerToLoad"] = entries[pid]
// case "13003":
// // TotalDcPower
// entries["PVPower"] = addVirtualAlias(entries[pid], "pv_power", "PV Power")
// case "13119":
// // TotalLoadActivePower
// entries["LoadPower"] = addVirtualAlias(entries[pid], "load_power", "Load Power")
//
// // addVirtualAlias(entries[pid], "FOO", "FOO")
//
// case "13112":
// // Daily PV Yield
// entries["DailyPvEnergy"] = addVirtualAlias(entries["DailyPvEnergy"], "daily_pv_energy", "Daily PV Energy")
// case "13174":
// // DailyBatteryChargingEnergyFromPv
// entries["YieldBatteryCharge"] = addVirtualAlias(entries[pid], "pv_battery_charge", "PV Battery Charge")
// case "13029":
// // DailyBatteryDischargingEnergy
// entries["DailyBatteryDischargingEnergy"] = entries[pid]
// case "13122":
// // entries["DailyFeedInEnergy"] = addVirtualAlias(entries[pid], "pv_feed_in", "PV Feed In")
// // @TODO - This may differ from DailyFeedInEnergyPv
// case "13173":
// // DailyFeedInEnergyPv
// entries["YieldFeedIn"] = addVirtualAlias(entries[pid], "pv_feed_in", "PV Feed In")
// case "13147":
// // DailyPurchasedEnergy
// entries["DailyPurchasedEnergy"] = addVirtualAlias(entries[pid], "daily_purchased_energy", "Daily Purchased Energy")
//
// case "13116":
// // DailyLoadEnergyConsumptionFromPv
// entries["YieldSelfConsumption"] = addVirtualAlias(entries[pid], "pv_self_consumption", "PV Self Consumption")
// case "13134":
// // TotalPvYield
// entries["TotalPvYield"] = addVirtualAlias(entries[pid], "pv_total_yield", "PV Total Yield")
//
// case "13199":
// // Daily Load Energy Consumption
// entries["DailyTotalLoad"] = addVirtualAlias(entries[pid], "daily_total_energy", "Daily Total Energy")
//
// case "13130":
// // Total Load Energy Consumption
// entries["TotalEnergyConsumption"] = addVirtualAlias(entries[pid], "total_energy_consumption", "Total Energy Consumption"
// }
}
}
if len(entries.DataPoints) == 0 {
break break
} }
// TotalDcPower e.GetEnergyStorageSystem(entries)
entries.FromRefAddAlias("p13003", api.VirtualPsId, "power_pv", "") e.GetCommunicationModule(entries)
// BatteryChargingPower e.GetBattery(entries)
entries.FromRefAddAlias("p13126", api.VirtualPsId, "battery_charge_power", "") }
// BatteryDischargingPower
entries.FromRefAddAlias("p13150", api.VirtualPsId, "battery_discharge_power", "")
// TotalExportActivePower
entries.FromRefAddAlias("p13121", api.VirtualPsId, "power_pv_to_grid", "")
// TotalLoadActivePower return entries
entries.FromRefAddAlias("p13119", api.VirtualPsId, "power_load", "") }
// PurchasedPower func (e *EndPoint) GetEnergyStorageSystem(entries api.DataMap) {
entries.FromRefAddAlias("p13149", api.VirtualPsId, "power_grid_to_load", "")
// Daily PV Yield for range Only.Once {
entries.FromRefAddAlias("p13112", api.VirtualPsId, "daily_pv_energy", "") // // Used for virtual entries.
// DailyPvEnergy := entries.getFloatValue("DailyTotalLoad") - entries.getFloatValue("DailyPurchasedEnergy") // // 0 - sungrow_battery_charging_power
// DailyBatteryChargingEnergyFromPv // var PVPowerToBattery VirtualPointStruct
entries.FromRefAddAlias("p13174", api.VirtualPsId, "pv_battery_charge_energy", "") //
// DailyBatteryDischargingEnergy // // sensor.sungrow_battery_discharging_power
entries.FromRefAddAlias("p13029", api.VirtualPsId, "battery_discharge", "") // var BatteryPowerToLoad VirtualPointStruct
//
// // 0 - sensor.sungrow_total_export_active_power
// var PVPowerToGrid VirtualPointStruct
//
// // sensor.sungrow_purchased_power
// var GridPowerToLoad VirtualPointStruct
//
// // 0 - sensor.sungrow_daily_battery_charging_energy_from_pv
// var YieldBatteryCharge VirtualPointStruct
// // var DailyBatteryChargingEnergy VirtualPointStruct
//
// // sensor.sungrow_daily_battery_discharging_energy
// var DailyBatteryDischargingEnergy VirtualPointStruct
//
// // 0 - sensor.sungrow_daily_feed_in_energy_pv
// var YieldFeedIn VirtualPointStruct
//
// // sensor.sungrow_daily_purchased_energy
// var DailyPurchasedEnergy VirtualPointStruct
//
// var PVPower VirtualPointStruct
//
// var LoadPower VirtualPointStruct
//
// var YieldSelfConsumption VirtualPointStruct
// // var DailyFeedInEnergy VirtualPointStruct
// var TotalPvYield VirtualPointStruct
//
// var DailyTotalLoad VirtualPointStruct
//
// var TotalEnergyConsumption VirtualPointStruct
// @TODO - This may differ from DailyFeedInEnergyPv pkg := apiReflect.GetName("", *e)
// entries["DailyFeedInEnergy"] = entries.AddVirtualAliasFromRef("13122", "pv_feed_in", "PV Feed In")
// DailyFeedInEnergyPv
entries.FromRefAddAlias("p13173", api.VirtualPsId, "pv_feed_in", "")
// DailyPurchasedEnergy
entries.FromRefAddAlias("p13147", api.VirtualPsId, "daily_purchased_energy", "")
// DailyLoadEnergyConsumptionFromPv
entries.FromRefAddAlias("p13116", api.VirtualPsId, "pv_self_consumption", "")
// TotalPvYield
entries.FromRefAddAlias("p13134", api.VirtualPsId, "pv_total_yield", "")
// Daily Load Energy Consumption
entries.FromRefAddAlias("p13199", api.VirtualPsId, "daily_total_energy", "")
// Total Load Energy Consumption
entries.FromRefAddAlias("p13130", api.VirtualPsId, "total_energy_consumption", "")
// entries.AddPointFromRef(api.Point{ Id:"queryDeviceList.p13130" }, api.Point{ PsKey:api.VirtualPsId, Id:"total_energy_consumption" })
// entries.CopyEntry("p13130").CreateAlias()
// entries.GetEntry(api.Point{PsKey:psId, Id:"total_income", Unit:p.TotalIncome.Unit, Type:api.PointTypeTotal}, now, p.TotalIncome.Value)
var devices []string
/* /*
PVPower - TotalDcPower PVPower - TotalDcPower
PVPowerToBattery - BatteryChargingPower PVPowerToBattery - BatteryChargingPower
@ -376,86 +314,392 @@ func (e *EndPoint) GetData() api.DataMap {
YieldBatteryCharge - DailyBatteryChargingEnergyFromPv YieldBatteryCharge - DailyBatteryChargingEnergyFromPv
YieldFeedIn - DailyFeedInEnergyPv YieldFeedIn - DailyFeedInEnergyPv
*/ */
for _, device := range e.Response.ResultData.PageList {
// Add virtual entries. if !device.DeviceType.Match(api.DeviceNameEnergyStorageSystem) {
// ts := ret.Entries[0].Date // Only looking for a Solar Storage System.
// var value valueTypes.Float continue
}
entries.FromRefAddFloat("pv_self_consumption", devices = append(devices, device.PsKey.String())
api.VirtualPsId,"pv_daily_yield", "", // if p.PointID.Match(13003) {
entries.GetFloatValue("pv_self_consumption", api.LastEntry) + entries.GetFloatValue("pv_battery_charge_energy", api.LastEntry) + entries.GetFloatValue("pv_feed_in", api.LastEntry)) // }
entries.FromRefAddFloat("daily_pv_energy",
api.VirtualPsId,"pv_self_consumption_percent", "",
entries.GetPercent("pv_self_consumption", "daily_pv_energy", api.LastEntry))
entries.FromRefAddFloat("daily_pv_energy",
api.VirtualPsId,"pv_battery_charge_percent", "",
entries.GetPercent("pv_battery_charge_energy", "daily_pv_energy", api.LastEntry))
entries.FromRefAddFloat("daily_pv_energy",
api.VirtualPsId,"pv_feed_in_percent", "",
entries.GetPercent("pv_feed_in", "daily_pv_energy", api.LastEntry))
// @TODO - Add this calculation.
DailyPvEnergy := entries.GetFloatValue("daily_total_energy", api.LastEntry) - entries.GetFloatValue("daily_purchased_energy", api.LastEntry)
// fmt.Sprintf("%f", DailyPvEnergy)
entries.FromRefAddFloat("daily_total_energy",
api.VirtualPsId,"daily_pv_energy_percent", "",
api.GetPercent(DailyPvEnergy, entries.GetValue("daily_total_energy", api.LastEntry)))
entries.FromRefAddFloat("daily_total_energy",
api.VirtualPsId,"daily_purchased_energy_percent", "",
entries.GetPercent("daily_purchased_energy", "daily_total_energy", api.LastEntry))
entries.FromRefAddFloat("power_pv",
api.VirtualPsId,"power_pv_to_load", "",
entries.GetFloatValue("power_pv", api.LastEntry) - entries.GetFloatValue("battery_charge_power", api.LastEntry) - entries.GetFloatValue("power_pv_to_grid", api.LastEntry))
// Battery
entries.FromRefAddFloat("battery_charge_power",
api.VirtualPsId,"power_battery", "",
entries.LowerUpper("battery_discharge_power", "battery_charge_power", api.LastEntry))
entries.FromRefAddFloat("battery_charge_power",
api.VirtualPsId,"power_pv_to_battery", "",
entries.GetFloatValue("battery_charge_power", api.LastEntry))
entries.FromRefAddFloat("battery_discharge_power",
api.VirtualPsId,"power_battery_to_load", "",
entries.GetFloatValue("battery_charge_power", api.LastEntry))
entries.FromRefAddFloat("battery_charge_power",
api.VirtualPsId,"power_battery_to_grid", "",
0.0)
// Grid
entries.FromRefAddFloat("power_grid_to_load",
api.VirtualPsId,"power_grid", "",
entries.LowerUpper("power_pv_to_grid", "power_grid_to_load", api.LastEntry))
entries.FromRefAddFloat("power_grid_to_load",
api.VirtualPsId,"power_grid_to_battery", "",
0.0)
entries.FromRefAddState("power_pv", api.VirtualPsId,"power_pv_active", "")
entries.FromRefAddState("power_battery", api.VirtualPsId,"power_battery_active", "")
entries.FromRefAddState("power_grid", api.VirtualPsId,"power_grid_active", "")
entries.FromRefAddState("power_load", api.VirtualPsId,"power_load_active", "")
entries.FromRefAddState("power_pv_to_battery", api.VirtualPsId,"power_pv_to_battery_active", "")
entries.FromRefAddState("power_pv_to_load", api.VirtualPsId,"power_pv_to_load_active", "")
entries.FromRefAddState("power_pv_to_grid", api.VirtualPsId,"power_pv_to_grid_active", "")
entries.FromRefAddState("power_battery_to_load", api.VirtualPsId,"power_battery_to_load_active", "")
entries.FromRefAddState("power_battery_to_grid", api.VirtualPsId,"power_battery_to_grid_active", "")
entries.FromRefAddState("power_grid_to_load", api.VirtualPsId,"power_grid_to_load_active", "")
entries.FromRefAddState("power_grid_to_battery", api.VirtualPsId,"power_grid_to_battery_active", "")
entries.FromRefAddFloat("pv_battery_charge_energy",
api.VirtualPsId, "battery_energy", "",
entries.LowerUpper("pv_battery_charge_energy", "battery_discharge", api.LastEntry))
entries.FromRefAddFloat("pv_feed_in",
api.VirtualPsId,"grid_energy", "",
entries.LowerUpper("pv_feed_in", "daily_purchased_energy", api.LastEntry))
} }
return entries // Points are in an array. So manually add virtuals instead of using the structure.
for _, device := range devices {
// fmt.Printf("endpoint: %s\n", device)
dstEndpoint := "virtual." + device
srcEndpoint := fmt.Sprintf("%s.%s", pkg, device)
// BatteryChargingPower
battery_charge_power := entries.CopyPoint(srcEndpoint + ".p13126.value", dstEndpoint, "battery_charge_power", "")
// BatteryDischargingPower
battery_discharge_power := entries.CopyPoint(srcEndpoint + ".p13150.value", dstEndpoint, "battery_discharge_power", "")
// Daily PV Yield
daily_pv_energy := entries.CopyPoint(srcEndpoint + ".p13112.value", dstEndpoint, "daily_pv_energy", "")
// DailyBatteryChargingEnergyFromPv
pv_battery_charge_energy := entries.CopyPoint(srcEndpoint + ".p13174.value", dstEndpoint, "pv_battery_charge_energy", "")
// DailyBatteryDischargingEnergy
battery_discharge := entries.CopyPoint(srcEndpoint + ".p13029.value", dstEndpoint, "battery_discharge", "")
// DailyFeedInEnergy - @TODO - This may differ from DailyFeedInEnergyPv
_ = entries.CopyPoint(srcEndpoint + ".p13122.value", dstEndpoint, "pv_feed_in2", "")
// fmt.Println(pv_feed_in2)
// DailyFeedInEnergyPv
pv_feed_in := entries.CopyPoint(srcEndpoint + ".p13173.value", dstEndpoint, "pv_feed_in", "")
// DailyPurchasedEnergy
daily_purchased_energy := entries.CopyPoint(srcEndpoint + ".p13147.value", dstEndpoint, "daily_purchased_energy", "")
// DailyLoadEnergyConsumptionFromPv
pv_self_consumption := entries.CopyPoint(srcEndpoint + ".p13116.value", dstEndpoint, "pv_self_consumption", "")
// TotalPvYield
_ = entries.CopyPoint(srcEndpoint + ".p13134.value", dstEndpoint, "pv_total_yield", "")
// fmt.Println(pv_total_yield)
// Daily Load Energy Consumption
daily_total_energy := entries.CopyPoint(srcEndpoint + ".p13199.value", dstEndpoint, "daily_total_energy", "")
// Total Load Energy Consumption
_ = entries.CopyPoint(srcEndpoint + ".p13130.value", dstEndpoint, "total_energy_consumption", "")
// fmt.Println(total_energy_consumption)
pv_daily_yield := entries.CopyDataEntries(*pv_self_consumption, dstEndpoint, "pv_daily_yield", "")
pv_daily_yield.SetFloat(pv_self_consumption.GetFloat() + pv_battery_charge_energy.GetFloat() + pv_feed_in.GetFloat(), "", "")
pv_self_consumption_percent := entries.CopyDataEntries(*daily_pv_energy, dstEndpoint, "pv_self_consumption_percent", "")
pv_self_consumption_percent.SetFloat(entries.GetPercent(*pv_self_consumption, *daily_pv_energy), "", "")
battery_energy := entries.CopyDataEntries(*pv_battery_charge_energy, dstEndpoint, "battery_energy", "")
battery_energy.SetFloat(entries.LowerUpper(*pv_battery_charge_energy, *battery_discharge), "", "")
pv_battery_charge_percent := entries.CopyDataEntries(*daily_pv_energy, dstEndpoint, "pv_battery_charge_percent", "")
pv_battery_charge_percent.SetFloat(entries.LowerUpper(*pv_battery_charge_energy, *daily_pv_energy), "", "")
pv_feed_in_percent := entries.CopyDataEntries(*daily_pv_energy, dstEndpoint, "pv_feed_in_percent", "")
pv_feed_in_percent.SetFloat(entries.LowerUpper(*pv_feed_in, *daily_pv_energy), "", "")
daily_pv_energy_percent := entries.CopyDataEntries(*daily_total_energy, dstEndpoint, "daily_pv_energy_percent", "")
DailyPvEnergy := daily_total_energy.GetFloat() - daily_purchased_energy.GetFloat()
daily_pv_energy_percent.SetFloat(api.GetPercent(DailyPvEnergy, daily_total_energy.GetFloat()), "", "")
daily_purchased_energy_percent := entries.CopyDataEntries(*daily_total_energy, dstEndpoint, "daily_purchased_energy_percent", "")
daily_purchased_energy_percent.SetFloat(entries.LowerUpper(*daily_purchased_energy, *daily_total_energy), "", "")
// PV src
power_pv := entries.CopyPoint(srcEndpoint + ".p13003.value", dstEndpoint, "power_pv", "") // TotalDcPower
power_pv_active := entries.CopyDataEntries(*power_pv, dstEndpoint, "power_pv_active", "")
power_pv_active.FloatToState(power_pv_active.GetFloat())
power_pv_to_battery := entries.CopyDataEntries(*battery_charge_power, dstEndpoint, "power_pv_to_battery", "")
power_pv_to_battery.SetFloat(battery_charge_power.GetFloat(), "", "")
power_pv_to_battery_active := entries.CopyDataEntries(*power_pv_to_battery, dstEndpoint, "power_pv_to_battery_active", "")
power_pv_to_battery_active.FloatToState(power_pv_to_battery_active.GetFloat())
power_pv_to_grid := entries.CopyPoint(srcEndpoint + ".p13121.value", dstEndpoint, "power_pv_to_grid", "") // TotalExportActivePower
power_pv_to_grid_active := entries.CopyDataEntries(*power_pv_to_grid, dstEndpoint, "power_pv_to_grid_active", "")
power_pv_to_grid_active.FloatToState(power_pv_to_grid_active.GetFloat())
power_pv_to_load := entries.CopyDataEntries(*power_pv, dstEndpoint, "power_pv_to_load", "")
power_pv_to_load.SetFloat(power_pv.GetFloat() - battery_charge_power.GetFloat() - power_pv_to_grid.GetFloat(), "", "")
power_pv_to_load_active := entries.CopyDataEntries(*power_pv_to_load, dstEndpoint, "power_pv_to_load_active", "")
power_pv_to_load_active.FloatToState(power_pv_to_load_active.GetFloat())
// Battery src
power_battery := entries.CopyDataEntries(*battery_charge_power, dstEndpoint, "power_battery", "")
power_battery.SetFloat(entries.LowerUpper(*battery_discharge_power, *battery_charge_power), "", "")
power_battery_active := entries.CopyDataEntries(*power_battery, dstEndpoint, "power_battery_active", "")
power_battery_active.FloatToState(power_battery_active.GetFloat())
power_battery_to_load := entries.CopyDataEntries(*battery_discharge_power, dstEndpoint, "power_battery_to_load", "")
power_battery_to_load.SetFloat(battery_discharge_power.GetFloat(), "", "")
power_battery_to_load_active := entries.CopyDataEntries(*power_battery_to_load, dstEndpoint, "power_battery_to_load_active", "")
power_battery_to_load_active.FloatToState(power_battery_to_load_active.GetFloat())
power_battery_to_grid := entries.CopyDataEntries(*battery_charge_power, dstEndpoint, "power_battery_to_grid", "")
power_battery_to_grid.SetFloat(0.0, "", "")
power_battery_to_grid_active := entries.CopyDataEntries(*power_battery_to_grid, dstEndpoint, "power_battery_to_grid_active", "")
power_battery_to_grid_active.FloatToState(power_battery_to_grid_active.GetFloat())
// Grid src
power_grid_to_load := entries.CopyPoint(srcEndpoint + ".p13149.value", dstEndpoint, "power_grid_to_load", "") // PurchasedPower
power_grid_to_load_active := entries.CopyDataEntries(*power_grid_to_load, dstEndpoint, "power_grid_to_load_active", "")
power_grid_to_load_active.FloatToState(power_grid_to_load_active.GetFloat())
power_grid := entries.CopyDataEntries(*power_grid_to_load, dstEndpoint, "power_grid", "")
power_grid.SetFloat(entries.LowerUpper(*power_pv_to_grid, *power_grid_to_load), "", "")
power_grid_active := entries.CopyDataEntries(*power_grid, dstEndpoint, "power_grid_active", "")
power_grid_active.FloatToState(power_grid_active.GetFloat())
power_grid_to_battery := entries.CopyDataEntries(*power_grid_to_load, dstEndpoint, "power_grid_to_battery", "")
power_grid_to_battery.SetFloat(0.0, "", "")
power_grid_to_battery_active := entries.CopyDataEntries(*power_grid_to_battery, dstEndpoint, "power_grid_to_battery_active", "")
power_grid_to_battery_active.FloatToState(power_grid_to_battery_active.GetFloat())
grid_energy := entries.CopyDataEntries(*pv_feed_in, dstEndpoint, "grid_energy", "")
grid_energy.SetFloat(entries.LowerUpper(*pv_feed_in, *daily_purchased_energy), "", "")
// Load src
power_load := entries.CopyPoint(srcEndpoint + ".p13119.value", dstEndpoint, "power_load", "") // TotalLoadActivePower
power_load_active := entries.CopyDataEntries(*power_load, dstEndpoint, "power_load_active", "")
power_load_active.FloatToState(power_load_active.GetFloat())
}
// for _, d := range e.Response.ResultData.PageList {
// name2 := api.JoinWithDots(0, "", pkg, d.PsKey)
// entries.StructToPoints(d, name2, d.PsKey.Value(), valueTypes.NewDateTime(""))
//
// for _, p := range d.PointData {
// pid := valueTypes.SetPointIdValue(p.PointID.Value())
// uv := valueTypes.SetUnitValueFloat(p.Value.Value(), p.Unit.Value(), "")
// // name2 := fmt.Sprintf("%s.PointData.%s", name, pid)
// // name3 := fmt.Sprintf("%s.PointData", name2)
// entries.AddUnitValue(name2, d.PsKey.Value(), pid, p.PointName.Value(), p.PointGroupName.Value(), p.TimeStamp, uv)
//
// // Handle virtual results.
// // switch pid {
// // case "13126":
// // // BatteryChargingPower
// // entries["PVPowerToBattery"] = entries[pid]
// // case "13150":
// // // BatteryDischargingPower
// // entries["BatteryPowerToLoad"] = entries[pid]
// // case "13121":
// // // TotalExportActivePower
// // entries["PVPowerToGrid"] = entries[pid]
// // case "13149":
// // // PurchasedPower
// // entries["GridPowerToLoad"] = entries[pid]
// // case "13003":
// // // TotalDcPower
// // entries["PVPower"] = addVirtualAlias(entries[pid], "pv_power", "PV Power")
// // case "13119":
// // // TotalLoadActivePower
// // entries["LoadPower"] = addVirtualAlias(entries[pid], "load_power", "Load Power")
// //
// // // addVirtualAlias(entries[pid], "FOO", "FOO")
// //
// // case "13112":
// // // Daily PV Yield
// // entries["DailyPvEnergy"] = addVirtualAlias(entries["DailyPvEnergy"], "daily_pv_energy", "Daily PV Energy")
// // case "13174":
// // // DailyBatteryChargingEnergyFromPv
// // entries["YieldBatteryCharge"] = addVirtualAlias(entries[pid], "pv_battery_charge", "PV Battery Charge")
// // case "13029":
// // // DailyBatteryDischargingEnergy
// // entries["DailyBatteryDischargingEnergy"] = entries[pid]
// // case "13122":
// // // entries["DailyFeedInEnergy"] = addVirtualAlias(entries[pid], "pv_feed_in", "PV Feed In")
// // // @TODO - This may differ from DailyFeedInEnergyPv
// // case "13173":
// // // DailyFeedInEnergyPv
// // entries["YieldFeedIn"] = addVirtualAlias(entries[pid], "pv_feed_in", "PV Feed In")
// // case "13147":
// // // DailyPurchasedEnergy
// // entries["DailyPurchasedEnergy"] = addVirtualAlias(entries[pid], "daily_purchased_energy", "Daily Purchased Energy")
// //
// // case "13116":
// // // DailyLoadEnergyConsumptionFromPv
// // entries["YieldSelfConsumption"] = addVirtualAlias(entries[pid], "pv_self_consumption", "PV Self Consumption")
// // case "13134":
// // // TotalPvYield
// // entries["TotalPvYield"] = addVirtualAlias(entries[pid], "pv_total_yield", "PV Total Yield")
// //
// // case "13199":
// // // Daily Load Energy Consumption
// // entries["DailyTotalLoad"] = addVirtualAlias(entries[pid], "daily_total_energy", "Daily Total Energy")
// //
// // case "13130":
// // // Total Load Energy Consumption
// // entries["TotalEnergyConsumption"] = addVirtualAlias(entries[pid], "total_energy_consumption", "Total Energy Consumption"
// // }
// }
// }
//
// // TotalDcPower
// entries.FromRefAddAlias(pkg + ".1171348_14_1_2.p13003.value", api.VirtualPsId, "power_pv", "")
// // BatteryChargingPower
// entries.FromRefAddAlias("p13126", api.VirtualPsId, "battery_charge_power", "")
// // BatteryDischargingPower
// entries.FromRefAddAlias("13150", api.VirtualPsId, "battery_discharge_power", "")
// // TotalExportActivePower
// entries.FromRefAddAlias("13121", api.VirtualPsId, "power_pv_to_grid", "")
// // TotalLoadActivePower
// entries.FromRefAddAlias("13119", api.VirtualPsId, "power_load", "")
// // PurchasedPower
// entries.FromRefAddAlias("13149", api.VirtualPsId, "power_grid_to_load", "")
// // Daily PV Yield
// entries.FromRefAddAlias("13112", api.VirtualPsId, "daily_pv_energy", "")
// DailyPvEnergy := entries.getFloatValue("DailyTotalLoad") - entries.getFloatValue("DailyPurchasedEnergy")
// // DailyBatteryChargingEnergyFromPv
// entries.FromRefAddAlias("13174", api.VirtualPsId, "pv_battery_charge_energy", "")
// // DailyBatteryDischargingEnergy
// entries.FromRefAddAlias("13029", api.VirtualPsId, "battery_discharge", "")
//
// @TODO - This may differ from DailyFeedInEnergyPv
// entries["DailyFeedInEnergy"] = entries.AddVirtualAliasFromRef("13122", "pv_feed_in", "PV Feed In")
//
// // DailyFeedInEnergyPv
// entries.FromRefAddAlias("13173", api.VirtualPsId, "pv_feed_in", "")
// // DailyPurchasedEnergy
// entries.FromRefAddAlias("13147", api.VirtualPsId, "daily_purchased_energy", "")
// // DailyLoadEnergyConsumptionFromPv
// entries.FromRefAddAlias("13116", api.VirtualPsId, "pv_self_consumption", "")
// // TotalPvYield
// entries.FromRefAddAlias("13134", api.VirtualPsId, "pv_total_yield", "")
// // Daily Load Energy Consumption
// entries.FromRefAddAlias("13199", api.VirtualPsId, "daily_total_energy", "")
// // Total Load Energy Consumption
// entries.FromRefAddAlias("13130", api.VirtualPsId, "total_energy_consumption", "")
// // entries.AddPointFromRef(api.Point{ Id:"queryDeviceList.p13130" }, api.Point{ PsKey:api.VirtualPsId, Id:"total_energy_consumption" })
//
// entries.CopyEntry("p13130").CreateAlias()
// entries.GetEntry(api.Point{PsKey:psId, Id:"total_income", Unit:p.TotalIncome.Unit, Type:api.PointTypeTotal}, now, p.TotalIncome.Value)
//
// entries.FromRefAddFloat("pv_self_consumption",
// api.VirtualPsId,"pv_daily_yield", "",
// entries.GetFloatValue("pv_self_consumption", api.LastEntry) + entries.GetFloatValue("pv_battery_charge_energy", api.LastEntry) + entries.GetFloatValue("pv_feed_in", api.LastEntry))
//
// entries.FromRefAddFloat("daily_pv_energy",
// api.VirtualPsId,"pv_self_consumption_percent", "",
// entries.GetPercent("pv_self_consumption", "daily_pv_energy", api.LastEntry))
// entries.FromRefAddFloat("daily_pv_energy",
// api.VirtualPsId,"pv_battery_charge_percent", "",
// entries.GetPercent("pv_battery_charge_energy", "daily_pv_energy", api.LastEntry))
// entries.FromRefAddFloat("daily_pv_energy",
// api.VirtualPsId,"pv_feed_in_percent", "",
// entries.GetPercent("pv_feed_in", "daily_pv_energy", api.LastEntry))
//
// // // @TODO - Add this calculation.
// DailyPvEnergy := entries.GetFloatValue("daily_total_energy", api.LastEntry) - entries.GetFloatValue("daily_purchased_energy", api.LastEntry)
// // fmt.Sprintf("%f", DailyPvEnergy)
// entries.FromRefAddFloat("daily_total_energy",
// api.VirtualPsId,"daily_pv_energy_percent", "",
// api.GetPercent(DailyPvEnergy, entries.GetValue("daily_total_energy", api.LastEntry)))
// entries.FromRefAddFloat("daily_total_energy",
// api.VirtualPsId,"daily_purchased_energy_percent", "",
// entries.GetPercent("daily_purchased_energy", "daily_total_energy", api.LastEntry))
//
// entries.FromRefAddFloat("power_pv",
// api.VirtualPsId,"power_pv_to_load", "",
// entries.GetFloatValue("power_pv", api.LastEntry) - entries.GetFloatValue("battery_charge_power", api.LastEntry) - entries.GetFloatValue("power_pv_to_grid", api.LastEntry))
//
// // Battery
// entries.FromRefAddFloat("battery_charge_power",
// api.VirtualPsId,"power_battery", "",
// entries.LowerUpper("battery_discharge_power", "battery_charge_power", api.LastEntry))
// entries.FromRefAddFloat("battery_charge_power",
// api.VirtualPsId,"power_pv_to_battery", "",
// entries.GetFloatValue("battery_charge_power", api.LastEntry))
// entries.FromRefAddFloat("battery_discharge_power",
// api.VirtualPsId,"power_battery_to_load", "",
// entries.GetFloatValue("battery_charge_power", api.LastEntry))
// entries.FromRefAddFloat("battery_charge_power",
// api.VirtualPsId,"power_battery_to_grid", "",
// 0.0)
//
// // Grid
// entries.FromRefAddFloat("power_grid_to_load",
// api.VirtualPsId,"power_grid", "",
// entries.LowerUpper("power_pv_to_grid", "power_grid_to_load", api.LastEntry))
// entries.FromRefAddFloat("power_grid_to_load",
// api.VirtualPsId,"power_grid_to_battery", "",
// 0.0)
//
// entries.FromRefAddFloat("pv_battery_charge_energy",
// api.VirtualPsId, "battery_energy", "",
// entries.LowerUpper("pv_battery_charge_energy", "battery_discharge", api.LastEntry))
//
// entries.FromRefAddFloat("pv_feed_in",
// api.VirtualPsId,"grid_energy", "",
// entries.LowerUpper("pv_feed_in", "daily_purchased_energy", api.LastEntry))
//
// entries.FromRefAddState("power_pv", api.VirtualPsId,"power_pv_active", "")
// entries.FromRefAddState("power_battery", api.VirtualPsId,"power_battery_active", "")
// entries.FromRefAddState("power_grid", api.VirtualPsId,"power_grid_active", "")
// entries.FromRefAddState("power_load", api.VirtualPsId,"power_load_active", "")
//
// entries.FromRefAddState("power_pv_to_battery", api.VirtualPsId,"power_pv_to_battery_active", "")
// entries.FromRefAddState("power_pv_to_load", api.VirtualPsId,"power_pv_to_load_active", "")
// entries.FromRefAddState("power_pv_to_grid", api.VirtualPsId,"power_pv_to_grid_active", "")
//
// entries.FromRefAddState("power_battery_to_load", api.VirtualPsId,"power_battery_to_load_active", "")
// entries.FromRefAddState("power_battery_to_grid", api.VirtualPsId,"power_battery_to_grid_active", "")
//
// entries.FromRefAddState("power_grid_to_load", api.VirtualPsId,"power_grid_to_load_active", "")
// entries.FromRefAddState("power_grid_to_battery", api.VirtualPsId,"power_grid_to_battery_active", "")
}
}
func (e *EndPoint) GetCommunicationModule(entries api.DataMap) {
for range Only.Once {
pkg := apiReflect.GetName("", *e)
var devices []string
for _, device := range e.Response.ResultData.PageList {
if !device.DeviceType.Match(api.DeviceNameCommunicationModule) {
// Only looking for a Communication Module.
continue
}
devices = append(devices, device.PsKey.String())
}
// Points are in an array. So manually add virtuals instead of using the structure.
for _, device := range devices {
// fmt.Printf("endpoint: %s\n", device)
dstEndpoint := "virtual." + device
srcEndpoint := fmt.Sprintf("%s.%s", pkg, device)
// WLAN Signal Strength
_ = entries.CopyPoint(srcEndpoint + ".p23014.value", dstEndpoint, "wlan_signal_strength", "")
}
}
}
func (e *EndPoint) GetBattery(entries api.DataMap) {
for range Only.Once {
pkg := apiReflect.GetName("", *e)
var devices []string
for _, device := range e.Response.ResultData.PageList {
if !device.DeviceType.Match(api.DeviceNameBattery) {
// Only looking for a Battery.
continue
}
devices = append(devices, device.PsKey.String())
}
// Points are in an array. So manually add virtuals instead of using the structure.
for _, device := range devices {
// fmt.Printf("endpoint: %s\n", device)
dstEndpoint := "virtual." + device
srcEndpoint := fmt.Sprintf("%s.%s", pkg, device)
// Battery Voltage
_ = entries.CopyPoint(srcEndpoint + ".p58601.value", dstEndpoint, "battery_voltage", "")
// Battery Current
_ = entries.CopyPoint(srcEndpoint + ".p58602.value", dstEndpoint, "battery_current", "")
// Battery Temperature
_ = entries.CopyPoint(srcEndpoint + ".p58603.value", dstEndpoint, "battery_temperature", "")
// Battery Level
_ = entries.CopyPoint(srcEndpoint + ".p58604.value", dstEndpoint, "battery_level", "")
// Battery Health (SOH)
_ = entries.CopyPoint(srcEndpoint + ".p58605.value", dstEndpoint, "battery_health", "")
// Total Battery Charging Energy
_ = entries.CopyPoint(srcEndpoint + ".p58606.value", dstEndpoint, "total_battery_charging_energy", "")
// Total Battery Discharging Energy
_ = entries.CopyPoint(srcEndpoint + ".p58607.value", dstEndpoint, "total_battery_discharging_energy", "")
}
}
} }

View File

@ -6,7 +6,6 @@ import (
"GoSungrow/iSolarCloud/api/valueTypes" "GoSungrow/iSolarCloud/api/valueTypes"
"fmt" "fmt"
"github.com/MickMake/GoUnify/Only" "github.com/MickMake/GoUnify/Only"
"strings"
) )
const Url = "/v1/devService/queryDeviceListForApp" const Url = "/v1/devService/queryDeviceListForApp"
@ -33,8 +32,8 @@ type ResultData struct {
ConnectState valueTypes.Integer `json:"connect_state"` ConnectState valueTypes.Integer `json:"connect_state"`
DataFlag valueTypes.Integer `json:"data_flag"` DataFlag valueTypes.Integer `json:"data_flag"`
DataFlagDetail valueTypes.Integer `json:"data_flag_detail"` DataFlagDetail valueTypes.Integer `json:"data_flag_detail"`
DevFaultStatus string `json:"dev_fault_status"` DevFaultStatus valueTypes.Integer `json:"dev_fault_status"`
DevStatus string `json:"dev_status"` DevStatus valueTypes.Integer `json:"dev_status"`
DeviceArea valueTypes.String `json:"device_area"` DeviceArea valueTypes.String `json:"device_area"`
DeviceCode valueTypes.Integer `json:"device_code"` DeviceCode valueTypes.Integer `json:"device_code"`
DeviceFactoryDate valueTypes.DateTime `json:"device_factory_date"` DeviceFactoryDate valueTypes.DateTime `json:"device_factory_date"`
@ -44,12 +43,12 @@ type ResultData struct {
DeviceModelID valueTypes.Integer `json:"device_model_id"` DeviceModelID valueTypes.Integer `json:"device_model_id"`
DeviceName valueTypes.String `json:"device_name"` DeviceName valueTypes.String `json:"device_name"`
DeviceProSn valueTypes.String `json:"device_pro_sn"` DeviceProSn valueTypes.String `json:"device_pro_sn"`
DeviceState string `json:"device_state"` DeviceState valueTypes.Integer `json:"device_state"`
DeviceSubType interface{} `json:"device_sub_type"` DeviceSubType interface{} `json:"device_sub_type"`
DeviceSubTypeName interface{} `json:"device_sub_type_name"` DeviceSubTypeName interface{} `json:"device_sub_type_name"`
DeviceType valueTypes.Integer `json:"device_type"` DeviceType valueTypes.Integer `json:"device_type"`
FactoryName valueTypes.String `json:"factory_name"` FactoryName valueTypes.String `json:"factory_name"`
InstallerDevFaultStatus string `json:"installer_dev_fault_status"` InstallerDevFaultStatus valueTypes.Integer `json:"installer_dev_fault_status"`
InverterModelType valueTypes.Integer `json:"inverter_model_type"` InverterModelType valueTypes.Integer `json:"inverter_model_type"`
IsCountryCheck valueTypes.Bool `json:"is_country_check"` IsCountryCheck valueTypes.Bool `json:"is_country_check"`
IsHasFunctionEnum valueTypes.Bool `json:"is_has_function_enum"` IsHasFunctionEnum valueTypes.Bool `json:"is_has_function_enum"`
@ -61,18 +60,18 @@ type ResultData struct {
IsSecond valueTypes.Bool `json:"is_second"` IsSecond valueTypes.Bool `json:"is_second"`
IsThirdParty valueTypes.Bool `json:"is_third_party"` IsThirdParty valueTypes.Bool `json:"is_third_party"`
ModuleUUID valueTypes.Integer `json:"module_uuid"` ModuleUUID valueTypes.Integer `json:"module_uuid"`
OwnerDevFaultStatus string `json:"owner_dev_fault_status"` OwnerDevFaultStatus valueTypes.Integer `json:"owner_dev_fault_status"`
P24 interface{} `json:"p24"` P24 interface{} `json:"p24"`
Posx interface{} `json:"posx"` Posx interface{} `json:"posx"`
Posy interface{} `json:"posy"` Posy interface{} `json:"posy"`
PsID valueTypes.Integer `json:"ps_id"` PsId valueTypes.Integer `json:"ps_id"`
PsKey valueTypes.PsKey `json:"ps_key"` PsKey valueTypes.PsKey `json:"ps_key"`
RelState valueTypes.Integer `json:"rel_state"` RelState valueTypes.Integer `json:"rel_state"`
Sn valueTypes.String `json:"sn" PointName:"Serial Number"` Sn valueTypes.String `json:"sn" PointName:"Serial Number"`
TypeName valueTypes.String `json:"type_name"` TypeName valueTypes.String `json:"type_name"`
UUID valueTypes.Integer `json:"uuid"` UUID valueTypes.Integer `json:"uuid"`
} `json:"pageList"` } `json:"pageList" PointNameFromChild:"PsKey"`
RowCount valueTypes.Integer `json:"rowCount"` RowCount valueTypes.Integer `json:"rowCount" PointIgnore:"true"`
} }
func (e *ResultData) IsValid() error { func (e *ResultData) IsValid() error {
@ -86,34 +85,13 @@ func (e *ResultData) IsValid() error {
return err return err
} }
//type DecodeResultData ResultData
//
//func (e *ResultData) UnmarshalJSON(data []byte) error {
// var err error
//
// for range Only.Once {
// if len(data) == 0 {
// break
// }
// var pd DecodeResultData
//
// // Store ResultData
// _ = json.Unmarshal(data, &pd)
// e.Dummy = pd.Dummy
// }
//
// return err
//}
func (e *EndPoint) GetData() api.DataMap { func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap() entries := api.NewDataMap()
for range Only.Once { for range Only.Once {
pkg := apiReflect.GetName("", *e) pkg := apiReflect.GetName("", *e)
for _, d := range e.Response.ResultData.PageList { dt := valueTypes.NewDateTime(valueTypes.Now)
name := strings.Join([]string{pkg, d.PsKey.Value()}, ".") entries.StructToPoints(e.Response.ResultData, pkg, "", dt)
entries.StructToPoints(d, name, d.PsKey.Value(), valueTypes.NewDateTime(""))
}
} }
return entries return entries

View File

@ -197,7 +197,7 @@ func (e *EndPoint) GetPointDataTable(points api.TemplatePoints) output.Table {
_ = table.AddRow( _ = table.AddRow(
tim.Key.PrintFull(), tim.Key.PrintFull(),
fmt.Sprintf("%s.%s", deviceName, pointId), fmt.Sprintf("%s.%s", deviceName, pointId),
gp.Description, gp.Name,
tim.Value, tim.Value,
gp.Unit, gp.Unit,
) )

View File

@ -8,29 +8,34 @@ import (
"errors" "errors"
"fmt" "fmt"
"hash/fnv" "hash/fnv"
"runtime"
"strconv"
"path/filepath" "path/filepath"
"reflect" "reflect"
"runtime"
"strconv"
"strings" "strings"
"time"
) )
type DataStructureMap map[string]DataStructure type DataStructures struct {
Map map[string]DataStructure
}
type DataStructure struct { type DataStructure struct {
// PointType string
Json string Json string
PointId string PointId string
// PointType string PointParentId string
PointUnit string PointUnit string
PointUnitFrom string PointUnitFrom string
PointDevice string PointTimestamp time.Time
PointName string PointName string
PointTimeSpan string PointUpdateFreq string
PointValueType string PointValueType string
PointAlias string PointAliasTo string
PointIgnore bool PointIgnore bool
PointGroupName string PointGroupName string
PointGroupNameFrom string
PointTimestampFrom string
Value interface{} Value interface{}
ValueType string ValueType string
@ -40,20 +45,65 @@ type DataStructure struct {
const ( const (
PointId = "PointId" // Point id in the form p\d+ or \d+ PointId = "PointId" // Point id in the form p\d+ or \d+
// PointType = "PointType" // Type of point: energy, date, battery, temperature.
PointUnit = "PointUnit" // Units: Wh, kWh, C, h. PointUnit = "PointUnit" // Units: Wh, kWh, C, h.
PointUnitFrom = "PointUnitFrom" // Get units from another point. PointUnitFrom = "PointUnitFrom" // Get PointUnit from another field structure.
PointDevice = "PointDevice" // Associated device to point. PointParentId = "PointParentId" // Associated parent of point.
PointName = "PointName" // Human name of point. PointName = "PointName" // Human-readable name of point.
PointTimeSpan = "PointTimeSpan" // Timespan Total, Yearly, Monthly, Day. PointUpdateFreq = "PointUpdateFreq" // Point update frequency - Total, Yearly, Monthly, Day.
PointValueType = "PointValueType" // PointValueType = "PointValueType" // Value type of point: energy, date, battery, temperature.
PointAlias = "PointAlias" // Alias this point to another entry. PointAliasTo = "PointAliasTo" // Alias this point to another point.
PointAliasFrom = "PointAliasFrom" // Alias this point from another point.
PointIgnore = "PointIgnore" // Ignore this point. PointIgnore = "PointIgnore" // Ignore this point.
PointGroupName = "PointGroupName" // Point group name. PointGroupName = "PointGroupName" // Point group name.
PointGroupNameFrom = "PointGroupNameFrom" // Get PointGroupName from another field structure.
PointNameFromChild = "PointNameFromChild" // Searches child for field value to use for naming when hitting a slice, (as opposed to using an index).
PointNameFromParent = "PointNameFromParent" // Searches child for field value to use for naming when hitting a slice, (as opposed to using an index).
PointNameDateFormat = "PointNameDateFormat" // Date format when using PointNameFrom, (if the field is a time.Time type).
PointArrayFlatten = "PointArrayFlatten" // Flatten an array into a string. EG: ["one", "two", "three"]
PointTimestampFrom = "PointTimestampFrom" // Pull timestamp from another field structure.
) )
func GetPointTags(ref interface{}, name ...string) DataStructureMap { func (dss *DataStructures) Add(name string, ds DataStructure) {
ret := make(DataStructureMap) for range Only.Once {
if dss.Map == nil {
dss.Map = make(map[string]DataStructure)
}
// fmt.Printf("DEBUG DataStructures.Add() %s - Kind:'%s' Type:'%s'\n", name, ds.ValueKind, ds.ValueType)
dss.Map[name] = ds
}
}
func (dss *DataStructures) Exists(name string) bool {
var yes bool
for range Only.Once {
if dss.Map == nil {
break
}
if _, ok := dss.Map[name]; ok {
yes = ok
break
}
}
return yes
}
func (dss *DataStructures) Append(dsm DataStructures) {
for range Only.Once {
if dss.Map == nil {
dss.Map = make(map[string]DataStructure)
}
// fmt.Printf("Map BEFORE:[%d] (adding %d)\n", len(dss.Map), len(dsm.Map))
for name, ds := range dsm.Map {
dss.Map[name] = ds
}
// fmt.Printf("Map AFTER:[%d]\n", len(dss.Map))
}
}
func (dss *DataStructures) GetPointTags(parentRef interface{}, ref interface{}, name ...string) DataStructures {
// var ret DataStructures
// ret.Map = make(map[string]DataStructure)
for range Only.Once { for range Only.Once {
vo := reflect.ValueOf(ref) vo := reflect.ValueOf(ref)
@ -64,22 +114,9 @@ func GetPointTags(ref interface{}, name ...string) DataStructureMap {
fieldTo := to.Field(i) fieldTo := to.Field(i)
fieldVo := vo.Field(i) fieldVo := vo.Field(i)
pointValueType := fieldTo.Tag.Get(PointValueType) if !fieldTo.IsExported() {
if valueTypes.IsNil(ref) { fmt.Printf("DEBUG: NOTEXPORTED(%s): Type %s\n", name, fieldTo.Name)
pointValueType = "NIL" continue
}
// fmt.Printf("DEBUG: Key[%s]:\tVT:'%s' Kind:'%s' => '%s'\n",
// fieldTo.Name,
// pointValueType,
// fieldVo.Kind(),
// fieldTo.Type.String(),
// )
ignore := false
ig := fieldTo.Tag.Get(PointIgnore)
if ig != "" {
ignore = true
} }
pointJson := fieldTo.Tag.Get("json") pointJson := fieldTo.Tag.Get("json")
@ -88,111 +125,435 @@ func GetPointTags(ref interface{}, name ...string) DataStructureMap {
pointId = pointJson pointId = pointJson
} }
// fmt.Printf("DEBUG[%d]: %s.%s: Key[%s]:\tKind:'%s' Type:'%s'\n",
// len(dss.Map),
// strings.Join(name, "."), pointId,
// fieldTo.Name,
// fieldVo.Kind(),
// fieldTo.Type.String(),
// )
// if strings.Contains(pointId, "actual_energy") || strings.Contains(pointJson, "actual_energy") {
// fmt.Printf("F:%v\n", pointId)
// fmt.Println("")
// }
switch fieldVo.Kind() { switch fieldVo.Kind() {
case reflect.Struct: case reflect.Uintptr:
if valueTypes.IsUnknownStruct(fieldTo, fieldVo) { fallthrough
n2 := name case reflect.Complex64:
n2 = append(n2, pointId) fallthrough
t2 := GetPointTags(fieldVo.Interface(), n2...) case reflect.Complex128:
for k, v := range t2 { fallthrough
ret[k] = v case reflect.Chan:
} fallthrough
case reflect.Func:
fallthrough
case reflect.Pointer:
fallthrough
case reflect.UnsafePointer:
fmt.Printf("Unsupported type: '%s.%s' (%s)\n", name, pointId, fieldVo.Type().String())
continue continue
}
case reflect.Slice: case reflect.Slice:
// @TODO - Handle slicing here. // Handle slices here.
// Will have to add more Point* tags. // Adds more Point* tags - PointNameFromChild, PointNameDateFormat
// Replicate the JoinWithDots 1st and 2nd arguments. // Replicates the JoinWithDots 1st and 2nd arguments.
// intSize int, dateFormat string // intSize int, dateFormat string
// EG: PointSliceIntSize, PointSliceDateFormat // fmt.Printf("Kind: %s ##########################################\n", fieldVo.Kind().String())
if pointValueType == "" { pointNameFromChild := fieldTo.Tag.Get(PointNameFromChild)
pointValueType = reflect.Slice.String() pointNameFromParent := fieldTo.Tag.Get(PointNameFromParent)
} pointNameDateFormat := fieldTo.Tag.Get(PointNameDateFormat)
intSize := valueTypes.SizeOfInt(fieldVo.Len())
pointArrayFlatten := fieldTo.Tag.Get(PointArrayFlatten)
n2 := append(name, pointId)
case reflect.Invalid: if pointArrayFlatten != "" {
fallthrough // We want to flatten a slice down to EG "[1, 2, 3]"
case reflect.Bool: endPointName, ds := makeDataStructure(parentRef, fieldTo, fieldVo, name)
fallthrough ds.Value = valueTypes.AnyToValueString(fieldVo.Interface(), 0, "")
case reflect.String: dss.Add(endPointName + "." + ds.PointId, ds)
fallthrough
case reflect.Float32:
fallthrough
case reflect.Float64:
fallthrough
case reflect.Int:
fallthrough
case reflect.Int8:
fallthrough
case reflect.Int16:
fallthrough
case reflect.Int32:
fallthrough
case reflect.Int64:
fallthrough
case reflect.Uint:
fallthrough
case reflect.Uint8:
fallthrough
case reflect.Uint16:
fallthrough
case reflect.Uint32:
fallthrough
case reflect.Uint64:
fallthrough
case reflect.Interface:
// Pick up the unassigned types.
if pointValueType == "" {
pointValueType = reflect.Interface.String()
}
}
if !fieldTo.IsExported() {
fmt.Printf("DEBUG: NOTEXPORTED(%s): %s\n", fieldTo.Name, fieldTo.Tag.Get("json"))
continue continue
} }
endPointName := strings.Join(name, ".") if valueTypes.IsUnknownStruct(fieldVo.Interface()) {
pointName := strings.TrimPrefix(endPointName + "." + pointId, ".") for si := 0; si < fieldVo.Len(); si++ {
ds := DataStructure { // Are we using an index number for name or field key value?
Json: pointJson, pn := strconv.Itoa(si)
PointId: pointId, n3 := append(n2, pn)
// PointType: fieldTo.Tag.Get(PointType), if pointNameFromChild != "" {
PointUnit: fieldTo.Tag.Get(PointUnit), // PointNameFromChild - In this case points to a field within a CHILD struct.
PointUnitFrom: fieldTo.Tag.Get(PointUnitFrom), pn = GetPointNameFrom(fieldVo.Index(si).Interface(), pointNameFromChild, intSize, pointNameDateFormat)
PointDevice: fieldTo.Tag.Get(PointDevice), n3 = append(n2[:len(n2) - 1], pn)
PointName: fieldTo.Tag.Get(PointName),
PointTimeSpan: fieldTo.Tag.Get(PointTimeSpan),
PointValueType: pointValueType,
PointAlias: fieldTo.Tag.Get(PointAlias),
PointGroupName: fieldTo.Tag.Get(PointGroupName),
PointIgnore: ignore,
Value: fieldVo.Interface(),
ValueType: fieldTo.Type.String(),
ValueKind: fieldVo.Kind().String(),
Endpoint: endPointName,
} }
ret[pointName] = ds if pointNameFromParent != "" {
// PointNameFromChild - In this case points to a field within a CHILD struct.
pn = GetPointNameFrom(fieldVo.Interface(), pointNameFromParent, intSize, pointNameDateFormat)
n3 = append(n2[:len(n2) - 1], pn)
}
dss.GetPointTags(fieldVo.Index(si).Interface(), fieldVo.Index(si).Interface(), n3...)
}
continue
}
// Flatten slice for []Integer / []Float objects.
endPointName, ds := makeDataStructure(parentRef, fieldTo, fieldVo, name)
ds.Value = valueTypes.AnyToValueString(fieldVo.Interface(), 0, "")
dss.Add(endPointName + "." + ds.PointId, ds)
// This commented-out section can handle []Integer fields.
// for si := 0; si < fieldVo.Len(); si++ {
// // Are we using an index number for name or field key value?
// pn := strconv.Itoa(si)
// n3 := append(n2, pn)
// if pointNameFromChild != "" {
// // PointNameFromChild - In this case points to a field within a CHILD struct.
// pn = GetPointNameFrom(fieldVo.Index(si).Interface(), pointNameFromChild, intSize, pointNameDateFormat)
// n3 = append(n2[:len(n2) - 1], pn)
// }
// if pointNameFromParent != "" {
// // PointNameFromChild - In this case points to a field within a CHILD struct.
// pn = GetPointNameFrom(fieldVo.Interface(), pointNameFromParent, intSize, pointNameDateFormat)
// n3 = append(n2[:len(n2) - 1], pn)
// }
//
// if valueTypes.IsUnknownStruct(fieldVo.Index(si).Interface()) {
// dss.GetPointTags(fieldVo.Index(si).Interface(), fieldVo.Index(si).Interface(), n3...)
// continue
// }
//
// // // We want to flatten a slice down to EG "[1, 2, 3]"
// // endPointName, ds := makeDataStructure(parentRef, fieldTo, fieldVo, n2)
// // ds.Value = valueTypes.AnyToValueString(fieldVo.Interface(), 0, "")
// // dss.Add(endPointName + "." + pn, ds)
// endPointName, ds := makeDataStructure(parentRef, fieldTo, fieldVo, n3)
// // ds.Json = pointId + pn
// ds.PointId = pn
// val := fieldVo.Index(si)
// ds.Value = val.Interface()
// dss.Add(endPointName, ds)
// }
continue
case reflect.Array:
// @TODO - Handle arrays here.
// Adds more Point* tags - PointNameFromChild, PointNameDateFormat
// Replicates the JoinWithDots 1st and 2nd arguments.
// intSize int, dateFormat string
// fmt.Printf("Kind: %s ##########################################\n", fieldVo.Kind().String())
pointNameFromChild := fieldTo.Tag.Get(PointNameFromChild)
pointNameFromParent := fieldTo.Tag.Get(PointNameFromParent)
pointNameDateFormat := fieldTo.Tag.Get(PointNameDateFormat)
intSize := valueTypes.SizeOfInt(fieldVo.Len())
pointArrayFlatten := fieldTo.Tag.Get(PointArrayFlatten)
n2 := append(name, pointId)
if pointArrayFlatten != "" {
// We want to flatten a slice down to EG "[1, 2, 3]"
endPointName, ds := makeDataStructure(parentRef, fieldTo, fieldVo, name)
ds.Value = valueTypes.AnyToValueString(fieldVo.Interface(), 0, "")
dss.Add(endPointName + "." + ds.PointId, ds)
continue
}
for si := 0; si < fieldVo.Len(); si++ {
// Are we using an index number for name or field key value?
pn := strconv.Itoa(si)
n3 := append(n2, pn)
if pointNameFromChild != "" {
// PointNameFromChild - In this case points to a field within a CHILD struct.
pn = GetPointNameFrom(fieldVo.Index(si).Interface(), pointNameFromChild, intSize, pointNameDateFormat)
n3 = append(n2[:len(n2) - 1], pn)
}
if pointNameFromParent != "" {
// PointNameFromChild - In this case points to a field within a CHILD struct.
pn = GetPointNameFrom(fieldVo.Interface(), pointNameFromParent, intSize, pointNameDateFormat)
n3 = append(n2[:len(n2) - 1], pn)
}
if valueTypes.IsUnknownStruct(fieldVo.Index(si).Interface()) {
dss.GetPointTags(fieldVo.Index(si).Interface(), fieldVo.Index(si).Interface(), n3...)
continue
}
// // We want to flatten a slice down to EG "[1, 2, 3]"
// endPointName, ds := makeDataStructure(parentRef, fieldTo, fieldVo, n2)
// ds.Value = valueTypes.AnyToValueString(fieldVo.Interface(), 0, "")
// dss.Add(endPointName + "." + pn, ds)
endPointName, ds := makeDataStructure(parentRef, fieldTo, fieldVo, n3)
// ds.Json = pointId + pn
ds.PointId = pointId + pn
val := fieldVo.Index(si)
ds.Value = val.Interface()
dss.Add(endPointName, ds)
}
// @TODO - Can't quite figure out what to do here. So will just flatten the array.
// for si := 0; si < fieldVo.Len(); si++ {
// // Are we using an index number for name or field key value?
// pn := strconv.Itoa(si)
// n3 := append(name) // , pointId + pn)
// if pointNameFrom != "" {
// pn = GetPointNameFromChild(parentRef, pointNameFrom, intSize, pointNameDateFormat)
// n3 = append(n2[:len(n2) - 1], pn)
// }
//
// endPointName, ds := makeDataStructure(parentRef, fieldTo, fieldVo, n3)
// // ds.Json = pointId + pn
// ds.PointId = pointId + pn
// val := fieldVo.Index(si)
// ds.Value = val.Interface()
// dss.Add(endPointName, ds)
// }
continue
case reflect.Map:
// fmt.Printf("Kind: %s ##########################################\n", fieldVo.Kind().String())
n2 := append(name, pointId)
// pointNameFromChild := fieldTo.Tag.Get(PointNameFromChild)
// pointNameFromParent := fieldTo.Tag.Get(PointNameFromParent)
for _, key := range fieldVo.MapKeys() {
// @TODO - Implement this.
// if pointNameFromChild != "" {
// // PointNameFromChild - In this case points to a field within a CHILD struct.
// pn = GetPointNameFrom(fieldVo.Index(si).Interface(), pointNameFromChild, intSize, pointNameDateFormat)
// n3 = append(n2[:len(n2) - 1], pn)
// }
// if pointNameFromParent != "" {
// // PointNameFromChild - In this case points to a field within a CHILD struct.
// pn = GetPointNameFrom(fieldVo.Interface(), pointNameFromParent, intSize, pointNameDateFormat)
// n3 = append(n2[:len(n2) - 1], pn)
// }
endPointName, ds := makeDataStructure(fieldVo.Interface(), fieldTo, fieldVo, n2)
ds.Json = key.String()
ds.PointId = key.String()
val := fieldVo.MapIndex(key)
ds.Value = val.Interface()
dss.Add(endPointName + "." + ds.PointId, ds)
}
continue
case reflect.Struct:
// fmt.Printf("Kind: %s ##########################################\n", fieldVo.Kind().String())
if valueTypes.IsUnknownStruct(fieldVo.Interface()) {
n2 := append(name, pointId)
dss.GetPointTags(parentRef, fieldVo.Interface(), n2...)
continue
}
// fmt.Printf("[%s.%s] => %v\n", strings.Join(name, "."), pointId, fieldVo.Interface())
endPointName, ds := makeDataStructure(parentRef, fieldTo, fieldVo, name)
ds.Value = fieldVo.Interface()
dss.Add(endPointName + "." + ds.PointId, ds)
continue
}
endPointName, ds := makeDataStructure(parentRef, fieldTo, fieldVo, name)
ds.Value = fieldVo.Interface()
dss.Add(endPointName + "." + ds.PointId, ds)
} }
} }
return ret return *dss
} }
func (dsm *DataStructureMap) GetUnitFrom(ref ...string) string { func GetUnitFrom(ref interface{}, pointUnitFrom string) string {
var ret string var ret string
for range Only.Once { for range Only.Once {
r := strings.Join(ref, ".") vo := reflect.ValueOf(ref)
if s, ok := (*dsm)[r]; ok { if vo.Kind() != reflect.Struct {
ret = s.PointUnit break
} }
// // Iterate over all available fields, looking for the field name.
for i := 0; i < vo.NumField(); i++ {
if vo.Type().Field(i).Name != pointUnitFrom {
continue
} }
// fmt.Printf("GetUnitFrom: %v\n", fieldVo.Interface())
ret = valueTypes.AnyToValueString(vo.Field(i).Interface(), 0, "")
break
}
}
return ret return ret
} }
func GetGroupNameFrom(ref interface{}, pointGroupNameFrom string) string {
var ret string
for range Only.Once {
vo := reflect.ValueOf(ref)
if vo.Kind() != reflect.Struct {
break
}
// Iterate over all available fields, looking for the field name.
for i := 0; i < vo.NumField(); i++ {
if vo.Type().Field(i).Name != pointGroupNameFrom {
continue
}
// fmt.Printf("GetGroupNameFrom: %v\n", fieldVo.Interface())
ret = valueTypes.AnyToValueString(vo.Field(i).Interface(), 0, "")
break
}
}
return ret
}
func GetTimestampFrom(ref interface{}, pointTimestampFrom string, dateFormat string) time.Time {
var ret time.Time
for range Only.Once {
vo := reflect.ValueOf(ref)
if vo.Kind() != reflect.Struct {
break
}
// Iterate over all available fields, looking for the field name.
for i := 0; i < vo.NumField(); i++ {
if vo.Type().Field(i).Name != pointTimestampFrom {
continue
}
// fmt.Printf("GetTimestampFrom: %v\n", fieldVo.Interface())
foo2 := fmt.Sprintf("%v", vo.Field(i).Interface())
ret = valueTypes.SetDateTimeString(foo2).Time
break
}
}
return ret
}
func GetPointNameFrom(ref interface{}, pointNameFrom string, intSize int, dateFormat string) string {
var ret string
for range Only.Once {
vo := reflect.ValueOf(ref)
if vo.Kind() != reflect.Struct {
break
}
// Iterate over all available fields, looking for the field name.
for i := 0; i < vo.NumField(); i++ {
if vo.Type().Field(i).Name != pointNameFrom {
continue
}
// fmt.Printf("GetPointNameFrom: %v\n", fieldVo.Interface())
ret = valueTypes.AnyToValueString(vo.Field(i).Interface(), intSize, dateFormat)
break
}
}
return ret
}
func makeDataStructure(parentRef interface{}, fieldTo reflect.StructField, fieldVo reflect.Value, name []string) (string, DataStructure) {
var endpoint string
var ds DataStructure
for range Only.Once {
if !fieldTo.IsExported() {
fmt.Printf("DEBUG: NOTEXPORTED(%s): %s\n", fieldTo.Name, fieldTo.Tag.Get("json"))
break
}
ignore := false
if fieldTo.Tag.Get(PointIgnore) != "" {
ignore = true
}
// if valueTypes.IsNil(ref) {
// pointValueType = "NIL"
// }
pointJson := fieldTo.Tag.Get("json")
pointId := fieldTo.Tag.Get(PointId)
if pointId == "" {
pointId = pointJson
}
pointValueType := fieldTo.Tag.Get(PointValueType)
if pointValueType == "" {
// pointValueType = fieldVo.Kind().String()
}
pointUnit := fieldTo.Tag.Get(PointUnit)
pointUnitFrom := fieldTo.Tag.Get(PointUnitFrom)
if pointUnitFrom != "" {
pointUnit = GetUnitFrom(parentRef, pointUnitFrom)
}
pointGroupName := fieldTo.Tag.Get(PointGroupName)
pointGroupNameFrom := fieldTo.Tag.Get(PointGroupNameFrom)
if pointGroupNameFrom != "" {
pointGroupName = GetGroupNameFrom(parentRef, pointGroupNameFrom)
}
pointTimestamp := time.Now()
pointTimestampFrom := fieldTo.Tag.Get(PointTimestampFrom)
if pointTimestampFrom != "" {
pointTimestamp = GetTimestampFrom(parentRef, pointTimestampFrom, valueTypes.DateTimeLayout)
}
endpoint = strings.TrimPrefix(strings.Join(name, "."), ".")
ds = DataStructure {
// PointType: fieldTo.Tag.Get(PointType),
Json: pointJson,
PointId: pointId,
PointParentId: fieldTo.Tag.Get(PointParentId),
PointUnit: pointUnit,
PointUnitFrom: pointUnitFrom,
PointTimestamp: pointTimestamp,
PointTimestampFrom: pointTimestampFrom,
PointGroupName: pointGroupName,
PointGroupNameFrom: pointGroupNameFrom,
PointName: fieldTo.Tag.Get(PointName),
PointUpdateFreq: fieldTo.Tag.Get(PointUpdateFreq),
PointValueType: pointValueType,
PointAliasTo: fieldTo.Tag.Get(PointAliasTo),
PointIgnore: ignore,
Value: nil,
ValueType: fieldTo.Type.String(),
ValueKind: fieldVo.Kind().String(),
Endpoint: endpoint,
}
}
return endpoint, ds
}
// func (dss *DataStructures) GetUnitFrom(ref ...string) string {
// var ret string
// for range Only.Once {
// r := strings.Join(ref, ".")
// if s, ok := dss.Map[r]; ok {
// ret = s.PointUnit
// }
// }
// return ret
// }
//
// func (dss *DataStructures) GetPointGroupNameFrom(ref ...string) string {
// var ret string
// for range Only.Once {
// r := strings.Join(ref, ".")
// if s, ok := dss.Map[r]; ok {
// ret = s.PointUnit
// }
// }
// return ret
// }
// GetArea Return an Area name if we are given an Area or EndPoint struct. // GetArea Return an Area name if we are given an Area or EndPoint struct.
func GetArea(trim string, v interface{}) string { func GetArea(trim string, v interface{}) string {
@ -861,7 +1222,7 @@ func GetStructKeys(ref interface{}, keys ...string) StructKeys {
case "int64": case "int64":
value = strconv.FormatInt(k.Value().(int64), 10) value = strconv.FormatInt(k.Value().(int64), 10)
case "float64": case "float64":
value = strconv.FormatFloat(k.Value().(float64), 'f', 6, 64) value = strconv.FormatFloat(k.Value().(float64), 'f', -1, 64)
default: default:
j, e := json.Marshal(k.Value()) j, e := json.Marshal(k.Value())
if e == nil { if e == nil {

View File

@ -7,3 +7,105 @@ const (
NullEndPointName = "NullEndpoint" NullEndPointName = "NullEndpoint"
DefaultTimeout = time.Second * 60 DefaultTimeout = time.Second * 60
) )
const (
DeviceType1 = "Inverter"
DeviceType10 = "String"
DeviceType11 = "Plant"
DeviceType12 = "Circuit Protection"
DeviceType13 = "Splitting Device"
DeviceType14 = "Energy Storage System"
DeviceType15 = "Sampling Device"
DeviceType16 = "EMU"
DeviceType17 = "Unit"
DeviceType18 = "Temperature and Humidity Sensor"
DeviceType19 = "Intelligent Power Distribution Cabinet"
DeviceType20 = "Display Device"
DeviceType21 = "AC Power Distributed Cabinet"
DeviceType22 = "Communication Module"
DeviceType23 = "System-BMS"
DeviceType24 = "RackBMS"
DeviceType25 = "DC-DC"
DeviceType26 = "Energy Management System"
DeviceType28 = "Wind Energy Converter"
DeviceType29 = "SVG"
DeviceType3 = "Grid-connection Point"
DeviceType30 = "PT Cabinet"
DeviceType31 = "Bus Protection"
DeviceType32 = "Cleaning Robot"
DeviceType33 = "Direct Current Cabinet"
DeviceType34 = "Public Measurement and Control"
DeviceType35 = "Anti-islanding Protection Device"
DeviceType36 = "Frequency and Voltage Emergency Control Device"
DeviceType37 = "PCS"
DeviceType38 = "Cell BMS"
DeviceType39 = "Power Quality"
DeviceType4 = "Combiner Box"
DeviceType40 = "Shuttle"
DeviceType41 = "Optimizer"
DeviceType42 = "Tracking axis communication box"
DeviceType43 = "Battery"
DeviceType44 = "Battery Cluster Management Unit"
DeviceType45 = "Local Controller"
DeviceType46 = "Networking Devices"
DeviceType47 = "Energy Storage Unit"
DeviceType48 = "DC Container"
DeviceType5 = "Meteo Station"
DeviceType50 = "IO Module"
DeviceType6 = "Transformer"
DeviceType7 = "Meter"
DeviceType8 = "UPS"
DeviceType9 = "Data Logger"
DeviceType99 = "Others"
)
const (
DeviceNameInverter=1
DeviceNameString=10
DeviceNamePlant=11
DeviceNameCircuitProtection=12
DeviceNameSplittingDevice=13
DeviceNameEnergyStorageSystem=14
DeviceNameSamplingDevice=15
DeviceNameEMU=16
DeviceNameUnit=17
DeviceNameTemperatureAndHumiditySensor=18
DeviceNameIntelligentPowerDistributionCabinet=19
DeviceNameDisplayDevice=20
DeviceNameACPowerDistributedCabinet=21
DeviceNameCommunicationModule=22
DeviceNameSystemBMS=23
DeviceNameRackBMS=24
DeviceNameDCToDC=25
DeviceNameEnergyManagementSystem=26
DeviceNameWindEnergyConverter=28
DeviceNameSVG=29
DeviceNameGridConnectionPoint=3
DeviceNamePTCabinet=30
DeviceNameBusProtection=31
DeviceNameCleaningRobot=32
DeviceNameDirectCurrentCabinet=33
DeviceNamePublicMeasurementandControl=34
DeviceNameAntiIslandingProtectionDevice=35
DeviceNameFrequencyAndVoltageEmergencyControlDevice=36
DeviceNamePCS=37
DeviceNameCellBMS=38
DeviceNamePowerQuality=39
DeviceNameCombinerBox=4
DeviceNameShuttle=40
DeviceNameOptimizer=41
DeviceNameTrackingAxisCommunicationBox=42
DeviceNameBattery=43
DeviceNameBatteryClusterManagementUnit=44
DeviceNameLocalController=45
DeviceNameNetworkingDevices=46
DeviceNameEnergyStorageUnit=47
DeviceNameDCContainer=48
DeviceNameMeteoStation=5
DeviceNameIOModule=50
DeviceNameTransformer=6
DeviceNameMeter=7
DeviceNameUPS=8
DeviceNameDataLogger=9
DeviceNameOthers=99
)

662
iSolarCloud/api/legacy.go Normal file
View File

@ -0,0 +1,662 @@
package api
// From struct_data.go
// func (dm *DataMap) GetEntry(entry string, index int) *DataEntry {
// var ret *DataEntry
// for range Only.Once {
// pe := dm.Map[entry]
// if pe.Entries != nil {
// ret = pe.GetEntry(index)
// break
// }
//
// for k, v := range dm.Map {
// if strings.HasSuffix(k, "." + entry) {
// ret = v.GetEntry(index)
// break
// }
// }
// }
// return ret
// }
//
// func (dm *DataMap) GetFloatValue(entry string, index int) float64 {
// var ret float64
// for range Only.Once {
// pe := dm.GetEntry(entry, index)
// if pe.IsNotValid() {
// fmt.Printf("ERROR: GetFloatValue('%s', '%d')\n", entry, index)
// break
// }
// ret = pe.Value.ValueFloat()
// }
// return ret
// }
//
// func (dm *DataMap) GetValue(entry string, index int) float64 {
// var ret float64
// for range Only.Once {
// v := dm.GetEntry(entry, index)
// if v.IsNotValid() {
// fmt.Printf("ERROR: GetValue('%s', %d)\n", entry, index)
// break
// }
//
// ret = v.Value.ValueFloat()
// }
// return ret
// }
//
// func (dm *DataMap) GetEntryFromPointId(pointId string) *DataEntries {
// var ret *DataEntries
// for range Only.Once {
// for i, v := range dm.Map {
// if v.MatchPointId(pointId) {
// ret = dm.Map[i]
// break
// }
// }
// }
// return ret
// }
//
// func (dm *DataMap) SetEntryUnits(pointId string, unit string) {
// for range Only.Once {
// for i, v := range dm.Map {
// if v.MatchPointId(pointId) {
// // e := dm.Map[i]
// // dm.Map[i] = e.SetUnits(unit)
// dm.Map[i].SetUnits(unit)
// break
// }
// }
// }
// }
//
// func (dm *DataMap) SetEntryGroupName(pointId string, groupName string) {
// for range Only.Once {
// for i, v := range dm.Map {
// if v.MatchPointId(pointId) {
// // e := dm.Map[i]
// // dm.Map[i] = e.SetGroupName(groupName)
// dm.Map[i].SetGroupName(groupName)
// break
// }
// }
// }
// }
//
// func (dm *DataMap) SetEntryTimestamp(pointId string, timeStamp valueTypes.DateTime) {
// for range Only.Once {
// for i, v := range dm.Map {
// if v.MatchPointId(pointId) {
// // e := dm.Map[i]
// // dm.Map[i] = e.SetTimestamp(timeStamp)
// dm.Map[i].SetTimestamp(timeStamp)
// break
// }
// }
// }
// }
//
// func (dm *DataMap) FromRefAddAlias(ref string, parentId string, pid string, name string) {
// for range Only.Once {
// pe := dm.GetEntry(ref, 0)
// if pe.IsNotValid() {
// fmt.Printf("ERROR: FromRefAddAlias('%s', '%s', '%s', '%s')\n", ref, parentId, pid, name)
// break
// }
//
// de := CopyDataEntry(*pe, pe.EndPoint, parentId, valueTypes.SetPointIdString(pid), name, pe.Point.GroupName, pe.Point.Unit, pe.Point.ValueType)
// dm.Add(de)
// }
// }
//
// func (dm *DataMap) FromRefAddState(ref string, parentId string, pid string, name string) {
// for range Only.Once {
// pe := dm.GetEntry(ref, 0)
// if pe.IsNotValid() {
// fmt.Printf("ERROR: FromRefAddState('%s', '%s', '%s', '%s')\n", ref, parentId, pid, name)
// break
// }
//
// de := CopyDataEntry(*pe, pe.EndPoint, parentId, valueTypes.SetPointIdString(pid), name, pe.Point.GroupName, pe.Point.Unit, pe.Point.ValueType)
// de.MakeState(pe.Value.ValueBool())
// // de := pe.CreateState(pe.EndPoint, parentId, valueTypes.SetPointIdString(pid), name)
// dm.Add(de)
// }
// }
//
// func (dm *DataMap) FromRefAddFloat(ref string, parentId string, pid string, name string, value float64) {
// for range Only.Once {
// pe := dm.GetEntry(ref, 0)
// if pe.IsNotValid() {
// fmt.Printf("ERROR: FromRefAddFloat('%s', '%s', '%s', '%s')\n", ref, parentId, pid, name)
// break
// }
//
// de := CopyDataEntry(*pe, pe.EndPoint, parentId, valueTypes.SetPointIdString(pid), name, pe.Point.GroupName, pe.Point.Unit, pe.Point.ValueType)
// de.MakeFloat(value, "", "")
// // de := pe.CreateFloat(pe.EndPoint, parentId, valueTypes.SetPointIdString(pid), name, value)
// dm.Add(de)
// }
// }
//
// func CopyDataEntry(ref DataEntry, endpoint string, parentId string, pid valueTypes.PointId, name string, groupName string, unit string, Type string) DataEntry {
// var ret DataEntry
// for range Only.Once {
// if name == "" {
// name = pid.PointToName()
// }
//
// point := CopyPoint(*ref.Point, parentId, pid, name, groupName, unit, Type)
// // point = &Point {
// // Parents: de.Point.Parents,
// // Id: pid,
// // GroupName: "alias",
// // Name: name,
// // Unit: de.Point.Unit,
// // UpdateFreq: de.Point.UpdateFreq,
// // ValueType: de.Point.ValueType,
// // Valid: true,
// // States: de.Point.States,
// // }
// // var parent ParentDevice
// // parent.Set(parentId)
// // point.Parents.Add(parent)
// // point.Unit = "binary"
// // if point.Unit == "" {
// // point.Unit = ref.Unit()
// // }
// // point.Name = name
// // if point.Name == "" {
// // point.Name = pid.PointToName()
// // }
// // // if de2.Point.GroupName == "" {
// // // de2.Point.GroupName = groupName
// // // }
// // point.FixUnitType()
// // point.Valid = true
//
// ret.Point = point
// ret.EndPoint = endpoint
// ret.Parent.Set(parentId)
// ret.Valid = true
// ret.Hide = false
// }
//
// return ret
// }
//
// func CopyPoint(ref Point, parentId string, pid valueTypes.PointId, name string, groupName string, unit string, Type string) *Point {
// for range Only.Once {
// if name == "" {
// name = pid.PointToName()
// }
//
// var parent ParentDevice
// parent.Set(parentId)
// ref.Parents.Add(parent)
// ref.Id = pid
// ref.Unit = unit
// ref.Name = name
// ref.UpdateFreq = ""
// ref.GroupName = groupName
// ref.ValueType = Type
// ref.Valid = true
// ref.States = nil
//
// ref.FixUnitType()
// }
//
// return &ref
// }
//
// func (dm *DataMap) HideEntry(pointId valueTypes.PointId) {
// for range Only.Once {
// de := dm.GetEntryFromPointId(pointId)
// de.Hide()
// }
// }
//
// func (dm *DataMap) AddEntry(endpoint string, parentId string, point Point, date valueTypes.DateTime, value string) {
// for range Only.Once {
// unit := point.Unit // Save unit.
// vType := point.ValueType // Save type.
//
// // Match to a previously defined point.
// p := GetPoint(point.Id.String())
// if p != nil {
// // No point found. Create one.
// p = CreatePoint(parentId, pid, name, groupName, unit, Type)
// }
// point = *p
//
// // var parents ParentDevices
// // parents.Add(ParentDevice{Key: device})
// var parent ParentDevice
// parent.Set(parentId)
// point.Parents.Add(parent)
//
// if point.Name == "" {
// point.Name = point.Id.PointToName()
// }
// // fid := JoinDevicePoint(parent.Key, point.Id)
// ref := valueTypes.SetUnitValueString(value, unit, vType)
// point.Unit = ref.Unit()
// point.Valid = true
//
// if _, ok := dm.DataPoints[point.Id.String()]; ok {
// fmt.Printf("BARF: %s\n", point.Id)
// }
//
// // dm.Add(JoinDevicePoint(endpoint, point.Id), DataEntry {
// dm.Add(DataEntry {
// EndPoint: endpoint,
// // FullId: valueTypes.JoinDataPoint(endpoint, point.Id.String()),
// // FullId: JoinDevicePoint(parent.Key, point.Id),
// Parent: parent,
//
// Point: &point,
// Date: date,
// Value: ref.String(),
// ValueFloat: ref.Value(),
// ValueBool: ref.ValueBool(),
// Index: 0,
// Valid: true,
// Hide: false,
// })
// }
// }
//
// func (dm *DataMap) AddUnitValue(endpoint string, parentId string, pid valueTypes.PointId, name string, groupName string, date valueTypes.DateTime, ref valueTypes.UnitValue) {
// for range Only.Once {
// if endpoint == "" {
// endpoint = apiReflect.GetCallerPackage(2)
// }
//
// ref = ref.UnitValueFix()
//
// if name == "" {
// name = pid.PointToName()
// }
//
// point := GetPoint(pid.String())
// if point == nil {
// // No point found. Create one.
// point = CreatePoint(parentId, pid, name, groupName, ref.Unit(), ref.Type())
// // de := CreateDataEntry(endpoint, parentId, pid, name, groupName, date, ref)
// // dm.Add(de)
// // break
// }
//
// var parent ParentDevice
// parent.Set(parentId)
// point.Parents.Add(parent)
// if point.Unit == "" {
// point.Unit = ref.Unit()
// }
// if point.Name == "" {
// point.Name = name
// }
// if point.Name == "" {
// point.Name = pid.PointToName()
// }
// if point.GroupName == "" {
// point.GroupName = groupName
// }
// point.FixUnitType()
// point.Valid = true
//
// dm.Add(DataEntry {
// EndPoint: endpoint,
// // FullId: valueTypes.JoinDataPoint(endpoint, point.Id.String()),
// // FullId: JoinDevicePoint(parent.Key, point.Id),
// Parent: parent,
//
// Point: point,
// Date: date,
// Value: ref.String(),
// ValueFloat: ref.Value(),
// ValueBool: ref.ValueBool(),
// Index: 0,
// Valid: true,
// Hide: false,
// })
// }
// }
//
// func (dm *DataMap) AddFloat(endpoint string, parentId string, pid PointId, name string, date valueTypes.DateTime, value float64) {
// for range Only.Once {
// // fvs := Float64ToString(value)
// point := GetPoint(parentId, pid)
// if point == nil {
// // No UV found. Create one.
// dm.Add(pid, CreateDataEntryUnitValue(date, endpoint, parentId, pid, name, valueTypes.SetUnitValueFloat(value, point.Unit, point.ValueType)))
// break
// }
//
// ref := valueTypes.SetUnitValueFloat(value, point.Unit, point.ValueType)
// if ref.Unit() != point.Unit {
// fmt.Printf("OOOPS: Unit mismatch - %f %s != %f %s\n", value, point.Unit, ref.ValueFloat(), ref.Unit())
// point.Unit = ref.Unit()
// }
//
// var parent ParentDevice
// parent.Set(parentId)
// point.Parents.Add(parent)
//
// dm.Add(pid, DataEntry {
// EndPoint: endpoint,
// FullId: JoinDevicePoint(endpoint, point.Id),
// // FullId: JoinDevicePoint(parent.Key, point.Id),
// Parent: parent,
//
// Date: date,
// Point: point,
// Value: ref.String(),
// ValueFloat: ref.Value(),
// })
// }
//
// uv := valueTypes.SetUnitValueFloat(value, "", "float")
// de := CreateDataEntryUnitValue(date, endpoint, parentId, pid, name, uv)
// // de := CreateDataEntryUnitValue(date, endpoint, parentId, pid, name, UnitValue {
// // Unit: "float",
// // Value: fmt.Sprintf("%f", value),
// // ValueFloat: 0,
// // })
// dm.Add(pid, de)
// }
//
// func (dm *DataMap) AddString(endpoint string, parentId string, pid PointId, name string, date valueTypes.DateTime, value string) {
// dm.Add(pid, CreateDataEntryString(date, endpoint, parentId, pid, name, value))
// }
//
// func (dm *DataMap) AddInt(endpoint string, parentId string, pid PointId, name string, date valueTypes.DateTime, value int64) {
//
// for range Only.Once {
// uvs, ok := valueTypes.AnyToUnitValue(value, "", "")
// if !ok {
// fmt.Printf("ERROR: AddInt(endpoint '%s', parentId '%s', pid '%s', name '%s', date '%s', value %d)",
// endpoint, parentId, pid, name, date, value)
// break
// }
// for _, uv := range uvs {
// de := CreateDataEntryUnitValue(date, endpoint, parentId, pid, name, uv)
// dm.Add(pid, de)
// }
//
// // uv := valueTypes.SetUnitValueInteger(value, "", "int")
// // de := CreateDataEntryUnitValue(date, endpoint, parentId, pid, name, uv)
// // // de := CreateDataEntryUnitValue(date, endpoint, parentId, pid, name, UnitValue {
// // // Unit: "int",
// // // Value: fmt.Sprintf("%d", value),
// // // ValueFloat: float64(value),
// // // })
// // dm.Add(pid, de)
// }
// }
//
// func (dm *DataMap) AddAny(endpoint string, parentId string, pid valueTypes.PointId, name string, date valueTypes.DateTime, value interface{}) {
//
// for range Only.Once {
// uvs, isNil, ok := valueTypes.AnyToUnitValue(value, "", "")
// if !ok {
// fmt.Printf("ERROR: AddAny(endpoint '%s', parentId '%s', pid '%s', name '%s', date '%s', value '%v')",
// endpoint, parentId, pid, name, date, value)
// break
// }
//
// point := GetPoint(parentId + "." + pid.String())
// if point == nil {
// // No UV found. Create one.
// for _, uv := range uvs {
// de := CreateDataEntryUnitValue(date, endpoint, parentId, pid, name, uv)
// if isNil {
// de.Point.ValueType += "(NIL)"
// }
// dm.Add(de)
// }
// // dm.Add(pid, CreateDataEntryUnitValue(date, endpoint, parentId, pid, name,
// // valueTypes.SetUnitValueFloat(value, point.Unit, point.ValueType)))
// break
// }
//
// // ref := valueTypes.SetUnitValueFloat(value, point.Unit, point.ValueType)
// // if ref.Unit() != point.Unit {
// // fmt.Printf("OOOPS: Unit mismatch - %f %s != %f %s\n", value, point.Unit, ref.ValueFloat(), ref.Unit())
// // point.Unit = ref.Unit()
// // }
//
// if isNil {
// point.ValueType += "(NIL)"
// }
//
// for _, uv := range uvs {
// if uv.Unit() != point.Unit {
// fmt.Printf("OOOPS: Unit mismatch - %f %s != %f %s\n", value, point.Unit, uv.ValueFloat(), uv.Unit())
// point.Unit = uv.Unit()
// }
//
// var parent ParentDevice
// parent.Set(parentId)
// point.Parents.Add(parent)
//
// // CreateDataEntry
// de := DataEntry {
// EndPoint: endpoint,
// // FullId: valueTypes.JoinDataPoint(endpoint, point.Id.String()),
// Parent: parent,
//
// Date: date,
// Point: point,
// Value: uv.String(),
// ValueFloat: uv.Value(),
// ValueBool: uv.ValueBool(),
// Index: 0,
// Valid: true,
// Hide: false,
// }
// dm.Add(de)
// }
//
// for _, uv := range uvs {
// de := CreateDataEntryUnitValue(date, endpoint, parentId, pid, name, uv)
// dm.Add(de)
// }
// }
// }
//
// func (de *DataEntry) CreateFloat(endpoint string, parentId string, pid valueTypes.PointId, name string, groupName string, unit string, Type string, value float64) DataEntry {
// var ret DataEntry
// for range Only.Once {
// if name == "" {
// name = pid.PointToName()
// }
//
// ret = de.CreateDataEntry(endpoint, parentId, pid, name, groupName, unit, Type)
// uv := valueTypes.SetUnitValueFloat(value, ret.Point.Unit, ret.Point.ValueType)
// ret.Value = uv.String()
// ret.ValueFloat = uv.Value()
// ret.Valid = true
// ret.Hide = false
// }
// return ret
// }
//
// func (de *DataEntry) CreateState(endpoint string, parentId string, pid valueTypes.PointId, name string) DataEntry {
// var ret DataEntry
// for range Only.Once {
// if name == "" {
// name = pid.PointToName()
// }
//
// de2 := de.CreateDataEntry(endpoint, parentId, pid, name)
// if de2.ValueFloat == 0 {
// de2.Value = "false"
// de2.ValueBool = false
// de2.ValueFloat = 0
// } else {
// de2.Value = "true"
// de2.ValueBool = true
// de2.ValueFloat = 1
// }
// de2.Valid = true
// de2.Hide = false
//
// var parent ParentDevice
// parent.Set(parentId)
// de2.Point.Parents.Add(parent)
// de2.Point.Unit = "binary"
// if de2.Point.Unit == "" {
// de2.Point.Unit = ref.Unit()
// }
// de2.Point.Name = name
// if de2.Point.Name == "" {
// de2.Point.Name = pid.PointToName()
// }
// // if de2.Point.GroupName == "" {
// // de2.Point.GroupName = groupName
// // }
// de2.Point.FixUnitType()
// de2.Point.Valid = true
// }
//
// return ret
// }
//
// func CreateDataEntryActive(date valueTypes.DateTime, endpoint string, parentId string, pid valueTypes.PointId, name string, value float64) DataEntry {
// point := GetPoint(parentId, pid)
// if point == nil {
// if name == "" {
// name = pid.PointToName()
// }
// point = CreatePoint(parentId, pid, name, "state")
// }
//
// var parent ParentDevice
// parent.Set(parentId)
// point.Parents.Add(parent)
//
// return DataEntry {
// EndPoint: endpoint,
// FullId: valueTypes.JoinDataPoint(endpoint, point.Id.String()),
// // FullId: JoinDevicePoint(parent.Key, point.Id),
// Parent: parent,
//
// Point: point,
// Date: date,
// Value: fmt.Sprintf("%v", IsActive(value)),
// ValueFloat: 0,
// Index: 0,
// }
// }
//
// func CreateDataEntryString(date valueTypes.DateTime, endpoint string, parentId string, pid valueTypes.PointId, name string, value string) DataEntry {
// point := GetPoint(parentId, pid)
// if point == nil {
// if name == "" {
// name = pid.PointToName()
// }
// point = CreatePoint(parentId, pid, name, "string")
// }
//
// var parent ParentDevice
// parent.Set(parentId)
// point.Parents.Add(parent)
//
// return DataEntry {
// EndPoint: endpoint,
// FullId: valueTypes.JoinDataPoint(endpoint, pid.String()),
// // FullId: JoinDevicePoint(parent.Key, pid),
// Parent: parent,
//
// Point: point,
// Date: date,
// Value: value,
// ValueFloat: 0,
// Index: 0,
// }
// }
//
// func CreateDataEntryUnitValue(date valueTypes.DateTime, endpoint string, parentId string, pid valueTypes.PointId, name string, value valueTypes.UnitValue) DataEntry {
// value = value.UnitValueFix()
//
// point := GetPoint(parentId + "." + pid.String())
// if point == nil {
// if name == "" {
// name = pid.PointToName()
// }
// point = CreatePoint(parentId, pid, name, value.Unit())
// }
//
// var parent ParentDevice
// parent.Set(parentId)
// point.Parents.Add(parent)
// point.Valid = true
//
// return DataEntry {
// EndPoint: endpoint,
// // FullId: valueTypes.JoinDataPoint(endpoint, pid.String()),
// // FullId: JoinDevicePoint(parent.Key, pid),
// Parent: parent,
//
// Point: point,
// Date: date,
// Value: value.String(),
// ValueFloat: value.Value(),
// ValueBool: value.ValueBool(),
// Index: 0,
// Valid: true,
// Hide: false,
// }
// }
//
// func CreatePoint(parentId string, pid valueTypes.PointId, name string, unit string) *Point {
// if name == "" {
// name = pid.PointToName()
// }
//
// var parents ParentDevices
// parents.Add(ParentDevice{Key: parentId})
//
// ret := &Point {
// Parents: parents,
// Id: pid,
// GroupName: parentId,
// Name: name,
// Unit: unit,
// UpdateFreq: "",
// ValueType: "",
// Valid: true,
// States: nil,
// }
// ret.FixUnitType()
//
// return ret
// }
//
// func IsActive(value float64) bool {
// if (value > 0.01) || (value < -0.01) {
// return true
// }
// return false
// }
//
// func JoinDevicePoint(endpoint string, pid valueTypes.PointId) valueTypes.PointId {
// var ret valueTypes.PointId
// for range Only.Once {
// if endpoint == "" {
// endpoint = "virtual"
// }
// ret = valueTypes.PointId(JoinWithDots(0, "", endpoint, pid))
// }
// return ret
// }
//
// func JoinStringsWithDots(args ...string) string {
// return strings.Join(args, ".")
// }

View File

@ -374,21 +374,21 @@ func (e EndPoint) GetDataTable() output.Table {
_ = table.SetHeader( _ = table.SetHeader(
"Date", "Date",
"Point Id", "Point Id",
"Group Name",
"Description",
"Value", "Value",
"Unit", "Unit",
"Group Name",
"Description",
) )
data := e.GetData() data := e.GetData()
var sorted []string var sorted []string
for p := range data.DataPoints { for p := range data.Map {
sorted = append(sorted, string(p)) sorted = append(sorted, string(p))
} }
sort.Strings(sorted) sort.Strings(sorted)
for _, p := range sorted { for _, p := range sorted {
entries := data.DataPoints[api.PointId(p)] entries := data.Map[api.PointId(p)]
for _, de := range entries { for _, de := range entries {
if de.Hide { if de.Hide {
continue continue
@ -400,10 +400,10 @@ func (e EndPoint) GetDataTable() output.Table {
// de.Point.Id, // de.Point.Id,
p, p,
// de.Point.Parents.String(), // de.Point.Parents.String(),
de.Point.GroupName,
de.Point.Name,
de.Value, de.Value,
de.Point.Unit, de.Point.Unit,
de.Point.GroupName,
de.Point.Name,
) )
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,102 @@
package api
import (
"GoSungrow/iSolarCloud/api/valueTypes"
"github.com/MickMake/GoUnify/Only"
)
type DataEntry struct {
EndPoint string `json:"endpoint"`
Point *Point `json:"point"`
Parent ParentDevice `json:"parent"`
Date valueTypes.DateTime `json:"date"`
Value valueTypes.UnitValue `json:"value"`
Valid bool `json:"valid"`
Hide bool `json:"hide"`
Index int `json:"index"`
}
func (de *DataEntry) IsValid() bool {
var ok bool
for range Only.Once {
if de == nil {
break
}
if de.Point == nil {
break
}
if de.Point.Valid == false {
break
}
ok = true
}
return ok
}
func (de *DataEntry) IsNotValid() bool {
return !de.IsValid()
}
func (de *DataEntry) FullId() string {
return de.EndPoint + "." + de.Point.Id.String()
}
func (de *DataEntry) SetEndpoint(endpoint string, pointId string) {
de.EndPoint = endpoint // + "." + pointId
de.Point.Id.SetString(pointId)
}
func (de *DataEntry) SetPointId(pointId string) {
de.Point.Id.SetString(pointId)
}
func (de *DataEntry) SetPointName(name string) {
if name != "" {
de.Point.SetName(name)
}
}
func (de *DataEntry) MakeState(state bool) DataEntry {
var ret DataEntry
for range Only.Once {
// uv := valueTypes.SetUnitValueBool(state)
// de.Value = uv.String()
// de.ValueFloat = uv.Value()
de.Value = valueTypes.SetUnitValueBool(state)
de.Point.Unit = ""
de.Point.ValueType = "Bool"
de.Point.Valid = true
de.Valid = true
// de.EndPoint += ".state"
de.Hide = false
}
return ret
}
func (de *DataEntry) MakeFloat(value float64, unit string, Type string) {
for range Only.Once {
if unit == "" {
unit = de.Point.Unit
}
if Type == "" {
Type = de.Point.ValueType
}
// uv := valueTypes.SetUnitValueFloat(value, unit, Type)
// de.Value = uv.String()
// de.ValueFloat = uv.Value()
de.Value = valueTypes.SetUnitValueFloat(value, unit, Type)
de.Valid = true
de.Hide = false
}
}
func (de *DataEntry) Copy() DataEntry {
var ret DataEntry
ret = *de
var point Point
point = *de.Point
ret.Point = &point
return ret
}

View File

@ -0,0 +1,175 @@
package api
import (
"GoSungrow/iSolarCloud/api/valueTypes"
"github.com/MickMake/GoUnify/Only"
)
type DataEntries struct {
Entries []DataEntry
}
func NewDataPointEntries() DataEntries {
return DataEntries{
Entries: []DataEntry{},
}
}
func (de *DataEntries) Hide() {
for range Only.Once {
for i := range de.Entries {
de.Entries[i].Hide = true
}
}
}
const LastEntry = -1
func (de *DataEntries) GetEntry(index int) *DataEntry {
for range Only.Once {
if de == nil {
return nil
}
if de.Entries == nil {
return nil
}
l := de.Len() - 1
if index > l {
index = l
break
}
if index < 0 {
index = l + index + 1
if index < 0 {
index = 0
}
}
}
return &(de.Entries[index])
}
func (de *DataEntries) GetEntryValue(index int) valueTypes.UnitValue {
var ret valueTypes.UnitValue
for range Only.Once {
ref := de.GetEntry(index)
if ref == nil {
break
}
ret = ref.Value
}
return ret
}
func (de *DataEntries) GetFloat() float64 {
var ret float64
for range Only.Once {
ref := de.GetEntry(0)
if ref == nil {
break
}
ret = ref.Value.Value()
}
return ret
}
func (de *DataEntries) MatchPointId(pointId string) bool {
var yes bool
for range Only.Once {
for _, v := range de.Entries {
if v.Point.Id.String() == pointId {
yes = true
break
}
}
}
return yes
}
func (de *DataEntries) Len() int {
return len(de.Entries)
}
func (de *DataEntries) GetUnits() string {
var unit string
for range Only.Once {
for _, v := range de.Entries {
unit = v.Point.Unit
break
}
}
return unit
}
func (de *DataEntries) Add(ref DataEntry) *DataEntries {
for range Only.Once {
if de == nil {
break
}
de.Entries = append(de.Entries, ref)
}
return de
}
func (de *DataEntries) SetUnits(units string) *DataEntries {
for range Only.Once {
for i := range de.Entries {
de.Entries[i].Point.Unit = units
}
}
return de
}
func (de *DataEntries) SetGroupName(groupName string) *DataEntries {
for range Only.Once {
for i := range de.Entries {
de.Entries[i].Point.GroupName = groupName
}
}
return de
}
func (de *DataEntries) SetTimestamp(timeStamp valueTypes.DateTime) *DataEntries {
for range Only.Once {
for i := range de.Entries {
// dt := valueTypes.SetDateTimeString(timeStamp)
de.Entries[i].Date = timeStamp
}
}
return de
}
func (de *DataEntries) Copy() DataEntries {
var ret DataEntries
for _, d := range de.Entries {
// var point Point
// point = *d.Point
// d.Point = &point
ret.Entries = append(ret.Entries, d.Copy())
}
return ret
}
func (de *DataEntries) MakeState(state bool) *DataEntries {
for i := range de.Entries {
de.Entries[i].MakeState(state)
}
return de
}
func (de *DataEntries) SetFloat(value float64, unit string, Type string) *DataEntries {
for i := range de.Entries {
de.Entries[i].MakeFloat(value, unit, Type)
}
return de
}
func (de *DataEntries) FloatToState(value float64) *DataEntries {
for i := range de.Entries {
if value == 0 {
de.Entries[i].MakeState(false)
break
}
de.Entries[i].MakeState(true)
}
return de
}

View File

@ -14,9 +14,9 @@ type Point struct {
Parents ParentDevices `json:"parents,omitempty"` Parents ParentDevices `json:"parents,omitempty"`
Id valueTypes.PointId `json:"id,omitempty"` Id valueTypes.PointId `json:"id,omitempty"`
GroupName string `json:"group_name,omitempty"` GroupName string `json:"group_name,omitempty"`
Name string `json:"name,omitempty"` Description string `json:"description,omitempty"`
Unit string `json:"unit,omitempty"` Unit string `json:"unit,omitempty"`
TimeSpan string `json:"time_span,omitempty"` UpdateFreq string `json:"time_span,omitempty"`
ValueType string `json:"value_type,omitempty"` ValueType string `json:"value_type,omitempty"`
Valid bool `json:"valid,omitempty"` Valid bool `json:"valid,omitempty"`
States map[string]string `json:"states,omitempty"` States map[string]string `json:"states,omitempty"`
@ -119,45 +119,51 @@ func (p *Point) WhenReset() string {
} }
func (p Point) String() string { func (p Point) String() string {
return fmt.Sprintf("Id:%s\tName:%s\tUnits:%s\tTimespan:%s", p.Id, p.Name, p.Unit, p.TimeSpan) return fmt.Sprintf("Id:%s\tName:%s\tUnits:%s\tUpdateFreq:%s", p.Id, p.Description, p.Unit, p.UpdateFreq)
// return p.TimeSpan
} }
func (p Point) IsInstant() bool { func (p Point) IsInstant() bool {
if p.TimeSpan == PointTimeSpanInstant { if p.UpdateFreq == UpdateFreqInstant {
return true return true
} }
return false return false
} }
func (p Point) IsDaily() bool { func (p Point) IsDaily() bool {
if p.TimeSpan == PointTimeSpanDaily { if p.UpdateFreq == UpdateFreqDaily {
return true return true
} }
return false return false
} }
func (p Point) IsMonthly() bool { func (p Point) IsMonthly() bool {
if p.TimeSpan == PointTimeSpanMonthly { if p.UpdateFreq == UpdateFreqMonthly {
return true return true
} }
return false return false
} }
func (p Point) IsYearly() bool { func (p Point) IsYearly() bool {
if p.TimeSpan == PointTimeSpanYearly { if p.UpdateFreq == UpdateFreqYearly {
return true return true
} }
return false return false
} }
func (p Point) IsTotal() bool { func (p Point) IsTotal() bool {
if p.TimeSpan == PointTimeSpanTotal { if p.UpdateFreq == UpdateFreqTotal {
return true return true
} }
return false return false
} }
func (p *Point) SetName(name string) {
if name == "" {
name = p.Id.PointToName()
}
p.Description = name
}
func GetPoint(point string) *Point { func GetPoint(point string) *Point {
return Points.Get(point) return Points.Get(point)
@ -208,6 +214,47 @@ type ParentDevice struct {
Type string `json:"parent_type"` Type string `json:"parent_type"`
Code string `json:"parent_code"` Code string `json:"parent_code"`
} }
func NewParentDevice(key string) ParentDevice {
var ret ParentDevice
ret.Set(key)
return ret
}
func (pd *ParentDevice) Set(key string) {
for range Only.Once {
pd.Key = key
}
}
func (pd *ParentDevice) Split() {
for range Only.Once {
// if pd.Key == "virtual" {
// break
// }
if pd.Key == "" {
pd.Key = "virtual"
break
}
if !strings.Contains(pd.Key, "_") {
pd.PsId = pd.Key
break
}
s := strings.Split(pd.Key, "_")
if len(s) > 0 {
pd.PsId = s[0]
}
if len(s) > 1 {
pd.Type = s[1]
}
if len(s) > 2 {
pd.Code = s[2]
}
}
}
type ParentDevices struct { type ParentDevices struct {
Map map[string]*ParentDevice Map map[string]*ParentDevice
Index []string Index []string
@ -256,6 +303,17 @@ func (pd *ParentDevices) PsIds() string {
return ret return ret
} }
// func (pd *ParentDevices) Get() ParentDevice {
// var ret ParentDevice
// for range Only.Once {
// if len(pd.Map) == 0 {
// break
// }
// ret = *(pd.Map[len(pd.Map)-1])
// }
// return ret
// }
func (pd *ParentDevices) Codes() string { func (pd *ParentDevices) Codes() string {
var ret string var ret string
for _, l := range pd.Index { for _, l := range pd.Index {
@ -274,40 +332,6 @@ func (pd *ParentDevices) Types() string {
return ret return ret
} }
func (pd *ParentDevice) Set(key string) {
for range Only.Once {
pd.Key = key
}
}
func (pd *ParentDevice) Split() {
for range Only.Once {
// if pd.Key == "virtual" {
// break
// }
if pd.Key == "" {
pd.Key = "virtual"
break
}
if !strings.Contains(pd.Key, "_") {
pd.PsId = pd.Key
break
}
s := strings.Split(pd.Key, "_")
if len(s) > 0 {
pd.PsId = s[0]
}
if len(s) > 1 {
pd.Type = s[1]
}
if len(s) > 2 {
pd.Code = s[2]
}
}
}
// type ParentDevice struct { // type ParentDevice struct {
// Key string `json:"ps_key"` // Key string `json:"ps_key"`
// PsId string `json:"ps_id"` // PsId string `json:"ps_id"`

View File

@ -54,7 +54,7 @@ func (pm *PointsMap) Get(point string) *Point {
// Id: valueTypes.SetPointIdString(point), // Id: valueTypes.SetPointIdString(point),
// Name: "", // Name: "",
// Unit: "", // Unit: "",
// TimeSpan: "", // UpdateFreq: "",
// Valid: false, // Valid: false,
// } // }
} }
@ -108,18 +108,18 @@ func (pm *PointsMap) Add(point Point) bool {
ep = *pm.Map[point.Id.String()] ep = *pm.Map[point.Id.String()]
ep.Parents = ParentDevices{} ep.Parents = ParentDevices{}
if strings.ToLower(ep.Name) == ep.Id.String() { if strings.ToLower(ep.Description) == ep.Id.String() {
ep.Name = point.Name ep.Description = point.Description
} }
if ep.Name == "" { if ep.Description == "" {
ep.Name = point.Name ep.Description = point.Description
} }
if ep.Unit == "" { if ep.Unit == "" {
ep.Unit = point.Unit ep.Unit = point.Unit
} }
if ep.TimeSpan == "" { if ep.UpdateFreq == "" {
ep.TimeSpan = point.TimeSpan ep.UpdateFreq = point.UpdateFreq
} }
if ep.GroupName == "" { if ep.GroupName == "" {
ep.GroupName = point.GroupName ep.GroupName = point.GroupName
@ -181,7 +181,7 @@ func (p *Point) HasChanged(comp Point) bool {
break break
} }
if p.Name != comp.Name { if p.Description != comp.Description {
break break
} }
@ -189,7 +189,7 @@ func (p *Point) HasChanged(comp Point) bool {
break break
} }
if p.TimeSpan != comp.TimeSpan { if p.UpdateFreq != comp.UpdateFreq {
break break
} }
@ -289,72 +289,72 @@ var Points = PointsMap {
// "total_income": { PsKey: "virtual", Id: "total_income", Name: "total_income", Unit: "FOO", Type: PointTypeTotal }, // "total_income": { PsKey: "virtual", Id: "total_income", Name: "total_income", Unit: "FOO", Type: PointTypeTotal },
// Added manually // Added manually
// "foo": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "", Name: "", Unit: "", TimeSpan: PointTimeSpanInstant}, // "foo": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "", Name: "", Unit: "", UpdateFreq: PointUpdateFreqInstant},
// //
// "p13001": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13001", Name: "MPPT1 Voltage", Unit: "V", TimeSpan: PointTimeSpanInstant}, // "p13001": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13001", Name: "MPPT1 Voltage", Unit: "V", UpdateFreq: PointUpdateFreqInstant},
// //
// "p13012": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13012", Name: "Total Reactive Power", Unit: "kvar", TimeSpan: PointTimeSpanDaily}, // "p13012": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13012", Name: "Total Reactive Power", Unit: "kvar", UpdateFreq: PointUpdateFreqDaily},
// //
// "p13105": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13105", Name: "MPPT2 Voltage", Unit: "V", TimeSpan: PointTimeSpanInstant}, // "p13105": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13105", Name: "MPPT2 Voltage", Unit: "V", UpdateFreq: PointUpdateFreqInstant},
// //
// "p13122": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13122", Name: "Daily Feed-in Energy", Unit: "kWh", TimeSpan: PointTimeSpanDaily}, // "p13122": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13122", Name: "Daily Feed-in Energy", Unit: "kWh", UpdateFreq: PointUpdateFreqDaily},
// //
// "p13125": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13125", Name: "Total Feed-in Energy", Unit: "kWh", TimeSpan: PointTimeSpanTotal}, // "p13125": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13125", Name: "Total Feed-in Energy", Unit: "kWh", UpdateFreq: PointUpdateFreqTotal},
// //
// "p13138": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13138", Name: "Battery Voltage", Unit: "V", TimeSpan: PointTimeSpanInstant}, // "p13138": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13138", Name: "Battery Voltage", Unit: "V", UpdateFreq: PointUpdateFreqInstant},
// //
// "p13144": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13144", Name: "Daily Self-consumption Rate", Unit: "%", TimeSpan: PointTimeSpanDaily}, // "p13144": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13144", Name: "Daily Self-consumption Rate", Unit: "%", UpdateFreq: PointUpdateFreqDaily},
// //
// "p13157": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13157", Name: "Phase A Voltage", Unit: "V", TimeSpan: PointTimeSpanInstant}, // "p13157": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13157", Name: "Phase A Voltage", Unit: "V", UpdateFreq: PointUpdateFreqInstant},
// //
// "p13158": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13158", Name: "Phase B Voltage", Unit: "V", TimeSpan: PointTimeSpanInstant}, // "p13158": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13158", Name: "Phase B Voltage", Unit: "V", UpdateFreq: PointUpdateFreqInstant},
// //
// "p13159": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13159", Name: "Phase C Voltage", Unit: "V", TimeSpan: PointTimeSpanInstant}, // "p13159": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13159", Name: "Phase C Voltage", Unit: "V", UpdateFreq: PointUpdateFreqInstant},
// //
// "p13161": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13161", Name: "Bus Voltage", Unit: "V", TimeSpan: PointTimeSpanInstant}, // "p13161": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13161", Name: "Bus Voltage", Unit: "V", UpdateFreq: PointUpdateFreqInstant},
// "p13173": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13173", Name: "Daily Feed-in Energy (PV)", Unit: "kWh", TimeSpan: PointTimeSpanDaily}, // "p13173": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13173", Name: "Daily Feed-in Energy (PV)", Unit: "kWh", UpdateFreq: PointUpdateFreqDaily},
// "p13175": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13175", Name: "Total Feed-in Energy (PV)", Unit: "kWh", TimeSpan: PointTimeSpanTotal}, // "p13175": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13175", Name: "Total Feed-in Energy (PV)", Unit: "kWh", UpdateFreq: PointUpdateFreqTotal},
// "p13002": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13002", Name: "MPPT1 Current", Unit: "A", TimeSpan: PointTimeSpanInstant}, // "p13002": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13002", Name: "MPPT1 Current", Unit: "A", UpdateFreq: PointUpdateFreqInstant},
// "p13003": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13003", Name: "Total DC Power", Unit: "kW"}, // "p13003": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13003", Name: "Total DC Power", Unit: "kW"},
// "p13007": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13007", Name: "Grid Frequency", Unit: "Hz", TimeSpan: PointTimeSpanInstant}, // "p13007": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13007", Name: "Grid Frequency", Unit: "Hz", UpdateFreq: PointUpdateFreqInstant},
// "p13008": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13008", Name: "Phase A Current", Unit: "A", TimeSpan: PointTimeSpanInstant}, // "p13008": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13008", Name: "Phase A Current", Unit: "A", UpdateFreq: PointUpdateFreqInstant},
// "p13009": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13009", Name: "Phase B Current", Unit: "A", TimeSpan: PointTimeSpanInstant}, // "p13009": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13009", Name: "Phase B Current", Unit: "A", UpdateFreq: PointUpdateFreqInstant},
// "p13010": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13010", Name: "Phase C Current", Unit: "A", TimeSpan: PointTimeSpanInstant}, // "p13010": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13010", Name: "Phase C Current", Unit: "A", UpdateFreq: PointUpdateFreqInstant},
// "p13011": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13011", Name: "Total Active Power", Unit: "kW"}, // "p13011": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13011", Name: "Total Active Power", Unit: "kW"},
// "p13013": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13013", Name: "Total Power Factor", Unit: ""}, // "p13013": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13013", Name: "Total Power Factor", Unit: ""},
// "p13018": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13018", Name: "Total Apparent Power", Unit: "VA"}, // "p13018": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13018", Name: "Total Apparent Power", Unit: "VA"},
// "p13019": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13019", Name: "Internal Air Temperature", Unit: "℃", TimeSpan: PointTimeSpanInstant}, // "p13019": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13019", Name: "Internal Air Temperature", Unit: "℃", UpdateFreq: PointUpdateFreqInstant},
// "p13028": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13028", Name: "Daily Battery Charging Energy", Unit: "kWh", TimeSpan: PointTimeSpanDaily}, // "p13028": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13028", Name: "Daily Battery Charging Energy", Unit: "kWh", UpdateFreq: PointUpdateFreqDaily},
// "p13029": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13029", Name: "Daily Battery Discharging Energy", Unit: "kWh", TimeSpan: PointTimeSpanDaily}, // "p13029": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13029", Name: "Daily Battery Discharging Energy", Unit: "kWh", UpdateFreq: PointUpdateFreqDaily},
// "p13034": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13034", Name: "Total Battery Charging Energy", Unit: "kWh", TimeSpan: PointTimeSpanTotal}, // "p13034": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13034", Name: "Total Battery Charging Energy", Unit: "kWh", UpdateFreq: PointUpdateFreqTotal},
// "p13035": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13035", Name: "Total Battery Discharging Energy", Unit: "kWh", TimeSpan: PointTimeSpanTotal}, // "p13035": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13035", Name: "Total Battery Discharging Energy", Unit: "kWh", UpdateFreq: PointUpdateFreqTotal},
// "p13106": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13106", Name: "MPPT2 Current", Unit: "A", TimeSpan: PointTimeSpanInstant}, // "p13106": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13106", Name: "MPPT2 Current", Unit: "A", UpdateFreq: PointUpdateFreqInstant},
// "p13112": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13112", Name: "Daily PV Yield", Unit: "kWh", TimeSpan: PointTimeSpanDaily}, // "p13112": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13112", Name: "Daily PV Yield", Unit: "kWh", UpdateFreq: PointUpdateFreqDaily},
// "p13116": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13116", Name: "Daily Load Energy Consumption from PV", Unit: "kWh", TimeSpan: PointTimeSpanDaily}, // "p13116": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13116", Name: "Daily Load Energy Consumption from PV", Unit: "kWh", UpdateFreq: PointUpdateFreqDaily},
// "p13119": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13119", Name: "Total Load Active Power", Unit: "kW"}, // "p13119": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13119", Name: "Total Load Active Power", Unit: "kW"},
// "p13121": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13121", Name: "Total Export Active Power", Unit: "kW"}, // "p13121": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13121", Name: "Total Export Active Power", Unit: "kW"},
// "p13126": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13126", Name: "Battery Charging Power", Unit: "kW"}, // "p13126": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13126", Name: "Battery Charging Power", Unit: "kW"},
// "p13130": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13130", Name: "Total Load Energy Consumption", Unit: "kWh", TimeSpan: PointTimeSpanTotal}, // "p13130": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13130", Name: "Total Load Energy Consumption", Unit: "kWh", UpdateFreq: PointUpdateFreqTotal},
// "p13134": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13134", Name: "Total PV Yield", Unit: "kWh", TimeSpan: PointTimeSpanTotal}, // "p13134": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13134", Name: "Total PV Yield", Unit: "kWh", UpdateFreq: PointUpdateFreqTotal},
// "p13137": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13137", Name: "Total Load Energy Consumption from PV", Unit: "kWh", TimeSpan: PointTimeSpanTotal}, // "p13137": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13137", Name: "Total Load Energy Consumption from PV", Unit: "kWh", UpdateFreq: PointUpdateFreqTotal},
// "p13139": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13139", Name: "Battery Current", Unit: "A", TimeSpan: PointTimeSpanInstant}, // "p13139": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13139", Name: "Battery Current", Unit: "A", UpdateFreq: PointUpdateFreqInstant},
// "p13140": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13140", Name: "Battery Capacity(kWh)", Unit: "kWh"}, // "p13140": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13140", Name: "Battery Capacity(kWh)", Unit: "kWh"},
// "p13141": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13141", Name: "Battery Level (SOC)", Unit: "%", TimeSpan: PointTimeSpanInstant}, // "p13141": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13141", Name: "Battery Level (SOC)", Unit: "%", UpdateFreq: PointUpdateFreqInstant},
// "p13142": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13142", Name: "Battery Health (SOH)", Unit: "%", TimeSpan: PointTimeSpanInstant}, // "p13142": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13142", Name: "Battery Health (SOH)", Unit: "%", UpdateFreq: PointUpdateFreqInstant},
// "p13143": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13143", Name: "Battery Temperature", Unit: "℃", TimeSpan: PointTimeSpanInstant}, // "p13143": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13143", Name: "Battery Temperature", Unit: "℃", UpdateFreq: PointUpdateFreqInstant},
// "p13147": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13147", Name: "Daily Purchased Energy", Unit: "kWh", TimeSpan: PointTimeSpanDaily}, // "p13147": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13147", Name: "Daily Purchased Energy", Unit: "kWh", UpdateFreq: PointUpdateFreqDaily},
// "p13148": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13148", Name: "Total Purchased Energy", Unit: "kWh", TimeSpan: PointTimeSpanTotal}, // "p13148": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13148", Name: "Total Purchased Energy", Unit: "kWh", UpdateFreq: PointUpdateFreqTotal},
// "p13149": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13149", Name: "Purchased Power", Unit: "kW"}, // "p13149": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13149", Name: "Purchased Power", Unit: "kW"},
// "p13150": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13150", Name: "Battery Discharging Power", Unit: "kW"}, // "p13150": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13150", Name: "Battery Discharging Power", Unit: "kW"},
// "p13160": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13160", Name: "Array Insulation Resistance", Unit: "kΩ", TimeSpan: PointTimeSpanInstant}, // "p13160": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13160", Name: "Array Insulation Resistance", Unit: "kΩ", UpdateFreq: PointUpdateFreqInstant},
// "p13162": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13162", Name: "Max. Charging Current (BMS)", Unit: "A", TimeSpan: PointTimeSpanInstant}, // "p13162": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13162", Name: "Max. Charging Current (BMS)", Unit: "A", UpdateFreq: PointUpdateFreqInstant},
// "p13163": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13163", Name: "Max. Discharging Current (BMS)", Unit: "A", TimeSpan: PointTimeSpanInstant}, // "p13163": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13163", Name: "Max. Discharging Current (BMS)", Unit: "A", UpdateFreq: PointUpdateFreqInstant},
// "p13174": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13174", Name: "Daily Battery Charging Energy from PV", Unit: "kWh", TimeSpan: PointTimeSpanDaily}, // "p13174": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13174", Name: "Daily Battery Charging Energy from PV", Unit: "kWh", UpdateFreq: PointUpdateFreqDaily},
// "p13176": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13176", Name: "Total Battery Charging Energy from PV", Unit: "kWh", TimeSpan: PointTimeSpanTotal}, // "p13176": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13176", Name: "Total Battery Charging Energy from PV", Unit: "kWh", UpdateFreq: PointUpdateFreqTotal},
// "p13199": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13199", Name: "Daily Load Energy Consumption", Unit: "kWh", TimeSpan: PointTimeSpanDaily}, // "p13199": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p13199", Name: "Daily Load Energy Consumption", Unit: "kWh", UpdateFreq: PointUpdateFreqDaily},
// "p18062": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p18062", Name: "Phase A Backup Current", Unit: "A", TimeSpan: PointTimeSpanInstant}, // "p18062": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p18062", Name: "Phase A Backup Current", Unit: "A", UpdateFreq: PointUpdateFreqInstant},
// "p18063": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p18063", Name: "Phase B Backup Current", Unit: "A", TimeSpan: PointTimeSpanInstant}, // "p18063": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p18063", Name: "Phase B Backup Current", Unit: "A", UpdateFreq: PointUpdateFreqInstant},
// "p18064": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p18064", Name: "Phase C Backup Current", Unit: "A", TimeSpan: PointTimeSpanInstant}, // "p18064": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p18064", Name: "Phase C Backup Current", Unit: "A", UpdateFreq: PointUpdateFreqInstant},
// "p18065": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p18065", Name: "Phase A Backup Power", Unit: "kW"}, // "p18065": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p18065", Name: "Phase A Backup Power", Unit: "kW"},
// "p18066": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p18066", Name: "Phase B Backup Power", Unit: "kW"}, // "p18066": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p18066", Name: "Phase B Backup Power", Unit: "kW"},
// "p18067": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p18067", Name: "Phase C Backup Power", Unit: "kW"}, // "p18067": {Parents: ParentDevices{Map: map[string]*ParentDevice{"14_1":{PsId: "manual", Type: "14", Code: "1"}}}, Id: "p18067", Name: "Phase C Backup Power", Unit: "kW"},
@ -362,33 +362,33 @@ var Points = PointsMap {
// "p83001": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83001", Name: "Inverter AC Power Normalization", Unit: "kW/kWp"}, // "p83001": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83001", Name: "Inverter AC Power Normalization", Unit: "kW/kWp"},
// "p83002": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83002", Name: "Inverter AC Power", Unit: "kW"}, // "p83002": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83002", Name: "Inverter AC Power", Unit: "kW"},
// "p83004": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83004", Name: "Inverter Total Yield", Unit: "kWh"}, // "p83004": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83004", Name: "Inverter Total Yield", Unit: "kWh"},
// "p83005": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83005", Name: "Daily Equivalent Hours of Meter", Unit: "h", TimeSpan: PointTimeSpanDaily}, // "p83005": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83005", Name: "Daily Equivalent Hours of Meter", Unit: "h", UpdateFreq: PointUpdateFreqDaily},
// "p83006": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83006", Name: "Meter Daily Yield", Unit: "kWh"}, // "p83006": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83006", Name: "Meter Daily Yield", Unit: "kWh"},
// "p83007": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83007", Name: "Meter PR", Unit: "%", TimeSpan: PointTimeSpanInstant}, // "p83007": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83007", Name: "Meter PR", Unit: "%", UpdateFreq: PointUpdateFreqInstant},
// "p83008": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83008", Name: "Daily Equivalent Hours of Inverter", Unit: "h", TimeSpan: PointTimeSpanDaily}, // "p83008": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83008", Name: "Daily Equivalent Hours of Inverter", Unit: "h", UpdateFreq: PointUpdateFreqDaily},
// "p83009": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83009", Name: "Daily Yield by Inverter", Unit: "kWh", TimeSpan: PointTimeSpanDaily}, // "p83009": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83009", Name: "Daily Yield by Inverter", Unit: "kWh", UpdateFreq: PointUpdateFreqDaily},
// "p83010": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83010", Name: "Inverter PR", Unit: "%", TimeSpan: PointTimeSpanInstant}, // "p83010": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83010", Name: "Inverter PR", Unit: "%", UpdateFreq: PointUpdateFreqInstant},
// "p83013": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83013", Name: "Daily Irradiation", Unit: "Wh/m2"}, // "p83013": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83013", Name: "Daily Irradiation", Unit: "Wh/m2"},
// "p83016": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83016", Name: "Plant Ambient Temperature", Unit: "℃", TimeSpan: PointTimeSpanInstant}, // "p83016": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83016", Name: "Plant Ambient Temperature", Unit: "℃", UpdateFreq: PointUpdateFreqInstant},
// "p83017": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83017", Name: "Plant Module Temperature", Unit: "℃", TimeSpan: PointTimeSpanInstant}, // "p83017": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83017", Name: "Plant Module Temperature", Unit: "℃", UpdateFreq: PointUpdateFreqInstant},
// "p83018": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83018", Name: "Daily Yield (Theoretical)", Unit: "kWh", TimeSpan: PointTimeSpanDaily}, // "p83018": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83018", Name: "Daily Yield (Theoretical)", Unit: "kWh", UpdateFreq: PointUpdateFreqDaily},
// "p83019": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83019", Name: "Power/Installed Power of Plant", Unit: "%", TimeSpan: PointTimeSpanInstant}, // "p83019": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83019", Name: "Power/Installed Power of Plant", Unit: "%", UpdateFreq: PointUpdateFreqInstant},
// "p83020": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83020", Name: "Meter Total Yield", Unit: "kWh"}, // "p83020": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83020", Name: "Meter Total Yield", Unit: "kWh"},
// "p83021": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83021", Name: "Accumulative Power Consumption by Meter", Unit: "kWh"}, // "p83021": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83021", Name: "Accumulative Power Consumption by Meter", Unit: "kWh"},
// "p83022": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83022", Name: "Daily Yield of Plant", Unit: "kWh", TimeSpan: PointTimeSpanDaily}, // "p83022": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83022", Name: "Daily Yield of Plant", Unit: "kWh", UpdateFreq: PointUpdateFreqDaily},
// "p83023": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83023", Name: "Plant PR", Unit: "%", TimeSpan: PointTimeSpanInstant}, // "p83023": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83023", Name: "Plant PR", Unit: "%", UpdateFreq: PointUpdateFreqInstant},
// "p83024": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83024", Name: "Plant Total Yield", Unit: "kWh"}, // "p83024": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83024", Name: "Plant Total Yield", Unit: "kWh"},
// "p83025": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83025", Name: "Plant Equivalent Hours", Unit: "h"}, // "p83025": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83025", Name: "Plant Equivalent Hours", Unit: "h"},
// "p83032": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83032", Name: "Meter AC Power", Unit: "kW"}, // "p83032": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83032", Name: "Meter AC Power", Unit: "kW"},
// "p83033": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83033", Name: "Plant Power", Unit: "kW"}, // "p83033": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83033", Name: "Plant Power", Unit: "kW"},
// "p83097": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83097", Name: "Daily Load Energy Consumption from PV", Unit: "kWh", TimeSpan: PointTimeSpanDaily}, // "p83097": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83097", Name: "Daily Load Energy Consumption from PV", Unit: "kWh", UpdateFreq: PointUpdateFreqDaily},
// "p83100": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83100", Name: "Total Load Energy Consumption from PV", Unit: "kWh"}, // "p83100": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83100", Name: "Total Load Energy Consumption from PV", Unit: "kWh"},
// "p83102": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83102", Name: "Daily Purchased Energy", Unit: "kWh", TimeSpan: PointTimeSpanDaily}, // "p83102": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83102", Name: "Daily Purchased Energy", Unit: "kWh", UpdateFreq: PointUpdateFreqDaily},
// "p83105": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83105", Name: "Total Purchased Energy", Unit: "kWh"}, // "p83105": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83105", Name: "Total Purchased Energy", Unit: "kWh"},
// "p83106": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83106", Name: "Load Power", Unit: "kW"}, // "p83106": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83106", Name: "Load Power", Unit: "kW"},
// "p83124": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83124", Name: "Total Load Energy Consumption", Unit: "MWh"}, // "p83124": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83124", Name: "Total Load Energy Consumption", Unit: "MWh"},
// "p83128": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83128", Name: "Total Active Power of Optical Storage", Unit: "kW"}, // "p83128": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83128", Name: "Total Active Power of Optical Storage", Unit: "kW"},
// "p83129": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83129", Name: "Battery SOC", Unit: "%", TimeSpan: PointTimeSpanInstant}, // "p83129": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83129", Name: "Battery SOC", Unit: "%", UpdateFreq: PointUpdateFreqInstant},
// "p83233": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83233", Name: "Total field maximum rechargeable power", Unit: "MW"}, // "p83233": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83233", Name: "Total field maximum rechargeable power", Unit: "MW"},
// "p83234": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83234", Name: "Total field maximum dischargeable power", Unit: "MW"}, // "p83234": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83234", Name: "Total field maximum dischargeable power", Unit: "MW"},
// "p83235": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83235", Name: "Total field chargeable energy", Unit: "MWh"}, // "p83235": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83235", Name: "Total field chargeable energy", Unit: "MWh"},
@ -400,9 +400,9 @@ var Points = PointsMap {
// "p83242": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83242", Name: "Total field discharge capacity", Unit: "MWh"}, // "p83242": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83242", Name: "Total field discharge capacity", Unit: "MWh"},
// "p83243": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83243", Name: "Total field daily charge capacity", Unit: "MWh"}, // "p83243": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83243", Name: "Total field daily charge capacity", Unit: "MWh"},
// "p83244": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83244", Name: "Total field daily discharge capacity", Unit: "MWh"}, // "p83244": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83244", Name: "Total field daily discharge capacity", Unit: "MWh"},
// "p83252": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83252", Name: "Battery Level (SOC)", Unit: "%", TimeSpan: PointTimeSpanInstant}, // "p83252": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83252", Name: "Battery Level (SOC)", Unit: "%", UpdateFreq: PointUpdateFreqInstant},
// "p83419": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83419", Name: "Daily Highest Inverter Power/Inverter Installed Capacity", Unit: "%"}, // "p83419": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83419", Name: "Daily Highest Inverter Power/Inverter Installed Capacity", Unit: "%"},
// "p83420": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83420", Name: "Current Power/Inverter Installed Capacity", Unit: "%", TimeSpan: PointTimeSpanInstant}, // "p83420": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83420", Name: "Current Power/Inverter Installed Capacity", Unit: "%", UpdateFreq: PointUpdateFreqInstant},
// "p83549": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83549", Name: "Grid active power", Unit: "kW"}, // "p83549": {Parents: ParentDevices{Map: map[string]*ParentDevice{"11_0":{PsId: "manual", Type: "11", Code: "0"}}}, Id: "p83549", Name: "Grid active power", Unit: "kW"},
// //
// "p23014": {Parents: ParentDevices{Map: map[string]*ParentDevice{"22_247":{PsId: "manual", Type: "22", Code: "247"}}}, Id: "p23014", Name: "WLAN Signal Strength", Unit: ""}, // "p23014": {Parents: ParentDevices{Map: map[string]*ParentDevice{"22_247":{PsId: "manual", Type: "22", Code: "247"}}}, Id: "p23014", Name: "WLAN Signal Strength", Unit: ""},

View File

@ -9,7 +9,7 @@ import (
type TemplatePoint struct { type TemplatePoint struct {
Description string Name string
PsKey string PsKey string
PointId valueTypes.PointId PointId valueTypes.PointId
Unit string Unit string
@ -61,7 +61,7 @@ func CreatePoints(points []string) TemplatePoints {
pa[1] = valueTypes.SetPointIdString(pa[1]).String() pa[1] = valueTypes.SetPointIdString(pa[1]).String()
// pa[1] = "p" + strings.TrimPrefix(pa[1], "p") // pa[1] = "p" + strings.TrimPrefix(pa[1], "p")
ret = append(ret, TemplatePoint{ ret = append(ret, TemplatePoint{
Description: "", Name: "",
PsKey: pa[0], PsKey: pa[0],
PointId: valueTypes.SetPointIdString(pa[1]), PointId: valueTypes.SetPointIdString(pa[1]),
Unit: "", Unit: "",

View File

@ -25,7 +25,7 @@ import (
// GroupName: "", // GroupName: "",
// Name: name, // Name: name,
// Unit: uv.Unit(), // Unit: uv.Unit(),
// TimeSpan: "PointTimeSpanInstant", // UpdateFreq: "PointUpdateFreqInstant",
// Valid: true, // Valid: true,
// States: nil, // States: nil,
// } // }
@ -46,22 +46,23 @@ func (e *Web) GetDataTable(endpoint EndPoint) output.Table {
_ = table.SetHeader( _ = table.SetHeader(
"Date", "Date",
"Point Id", "Point Id",
"Group Name",
"Description",
"Value", "Value",
"Unit", "Unit",
"Unit Type", "Unit Type",
"Group Name",
"Description",
"Update Freq",
) )
data := endpoint.GetEndPointData() data := endpoint.GetEndPointData()
var sorted []string var sorted []string
for p := range data.DataPoints { for p := range data.Map {
sorted = append(sorted, string(p)) sorted = append(sorted, string(p))
} }
sort.Strings(sorted) sort.Strings(sorted)
for _, p := range sorted { for _, p := range sorted {
entries := data.DataPoints[p] entries := data.Map[p].Entries
for _, de := range entries { for _, de := range entries {
if de.Hide { if de.Hide {
continue continue
@ -69,15 +70,13 @@ func (e *Web) GetDataTable(endpoint EndPoint) output.Table {
_ = table.AddRow( _ = table.AddRow(
de.Date.Format(valueTypes.DateTimeLayout), de.Date.Format(valueTypes.DateTimeLayout),
// api.NameDevicePointInt(de.Point.Parents, p.PointID.Value()),
// de.Point.Id,
p, p,
// de.Point.Parents.String(),
de.Point.GroupName,
de.Point.Name,
de.Value, de.Value,
de.Point.Unit, de.Point.Unit,
de.Point.ValueType, de.Point.ValueType,
de.Point.GroupName,
de.Point.Description,
de.Point.UpdateFreq,
) )
} }
} }

View File

@ -65,7 +65,7 @@ func (t Bool) MarshalJSON() ([]byte, error) {
break break
} }
t.Valid = true t.Valid = true
// t.string = strconv.FormatFloat(t.bool, 'f', 12, 64) // t.string = strconv.FormatFloat(t.bool, 'f', -1, 64)
} }
return data, err return data, err
@ -75,6 +75,13 @@ func (t Bool) Value() bool {
return t.bool return t.bool
} }
func (t Bool) Match(comp bool) bool {
if t.bool == comp {
return true
}
return false
}
func (t Bool) String() string { func (t Bool) String() string {
return t.string return t.string
} }

View File

@ -99,7 +99,15 @@ func (dt DateTime) Value() time.Time {
} }
func (dt DateTime) String() string { func (dt DateTime) String() string {
return dt.Original() // return dt.Original()
return dt.Time.Format(DateTimeLayout)
}
func (dt DateTime) Match(comp time.Time) bool {
if dt.Time == comp {
return true
}
return false
} }
func (dt *DateTime) SetString(value string) *DateTime { func (dt *DateTime) SetString(value string) *DateTime {

View File

@ -55,7 +55,7 @@ func (t Float) MarshalJSON() ([]byte, error) {
break break
} }
t.Valid = true t.Valid = true
// t.string = strconv.FormatFloat(t.float64, 'f', 12, 64) // t.string = strconv.FormatFloat(t.float64, 'f', -1, 64)
} }
return data, err return data, err
@ -65,6 +65,13 @@ func (t Float) Value() float64 {
return t.float64 return t.float64
} }
func (t Float) Match(comp float64) bool {
if t.float64 == comp {
return true
}
return false
}
func (t Float) String() string { func (t Float) String() string {
return t.string return t.string
} }
@ -100,7 +107,7 @@ func (t *Float) SetValue(value float64) Float {
t.string = "" t.string = ""
t.float64 = value t.float64 = value
t.Valid = true t.Valid = true
t.string = strconv.FormatFloat(t.float64, 'f', 12, 64) t.string = strconv.FormatFloat(t.float64, 'f', -1, 64)
} }
return *t return *t

View File

@ -69,6 +69,13 @@ func (t Integer) String() string {
return t.string return t.string
} }
func (t Integer) Match(comp int64) bool {
if t.int64 == comp {
return true
}
return false
}
func (t *Integer) SetString(value string) Integer { func (t *Integer) SetString(value string) Integer {
for range Only.Once { for range Only.Once {
t.string = value t.string = value
@ -181,6 +188,13 @@ func (t Count) String() string {
return t.string return t.string
} }
func (t Count) Match(comp int64) bool {
if t.int64 == comp {
return true
}
return false
}
func (t *Count) SetString(value string) Count { func (t *Count) SetString(value string) Count {
for range Only.Once { for range Only.Once {
t.string = value t.string = value

View File

@ -73,6 +73,13 @@ func (t PointId) String() string {
return t.string return t.string
} }
func (t PointId) Match(comp int64) bool {
if t.int64 == comp {
return true
}
return false
}
func (t *PointId) SetString(value string) PointId { func (t *PointId) SetString(value string) PointId {
for range Only.Once { for range Only.Once {
t.string = value t.string = value

View File

@ -59,6 +59,13 @@ func (t String) String() string {
return t.string return t.string
} }
func (t String) Match(comp string) bool {
if t.string == comp {
return true
}
return false
}
func (t *String) SetString(value string) String { func (t *String) SetString(value string) String {
for range Only.Once { for range Only.Once {
t.string = value t.string = value
@ -132,6 +139,17 @@ func (t PsKey) Value() string {
return t.string return t.string
} }
func (t PsKey) String() string {
return t.string
}
func (t PsKey) Match(comp string) bool {
if t.string == comp {
return true
}
return false
}
func (t PsKey) PsKey() string { func (t PsKey) PsKey() string {
return t.string return t.string
} }

View File

@ -10,32 +10,111 @@ import (
) )
func IsUnknownStruct(fieldTo reflect.StructField, fieldVo reflect.Value) bool { const (
TypeBool = "Bool"
TypeCount = "Count"
TypeDateTime = "DateTime"
TypeFloat = "Float"
TypeInteger = "Integer"
TypePointId = "PointId"
TypePsKey = "PsKey"
TypeString = "String"
TypeTime = "Time"
TypeUnitValue = "UnitValue"
TypeArrayBool = "[]Bool"
TypeArrayCount = "[]Count"
TypeArrayDateTime = "[]DateTime"
TypeArrayFloat = "[]Float"
TypeArrayInteger = "[]Integer"
TypeArrayPointId = "[]PointId"
TypeArrayPsKey = "[]PsKey"
TypeArrayString = "[]String"
TypeArrayTime = "[]Time"
TypeArrayUnitValue = "[]UnitValue"
TypeUnitValues = "UnitValues"
TypeArrayValueTypesBool = "[]valueTypes.Bool"
TypeArrayValueTypesCount = "[]valueTypes.Count"
TypeArrayValueTypesDateTime = "[]valueTypes.DateTime"
TypeArrayValueTypesFloat = "[]valueTypes.Float"
TypeArrayValueTypesInteger = "[]valueTypes.Integer"
TypeArrayValueTypesPointId = "[]valueTypes.PointId"
TypeArrayValueTypesPsKey = "[]valueTypes.PsKey"
TypeArrayValueTypesString = "[]valueTypes.String"
TypeArrayValueTypesTime = "[]valueTypes.Time"
TypeArrayValueTypesUnitValue = "[]valueTypes.UnitValue"
TypeValueTypesBool = "valueTypes.Bool"
TypeValueTypesCount = "valueTypes.Count"
TypeValueTypesDateTime = "valueTypes.DateTime"
TypeValueTypesFloat = "valueTypes.Float"
TypeValueTypesInteger = "valueTypes.Integer"
TypeValueTypesPointId = "valueTypes.PointId"
TypeValueTypesPsKey = "valueTypes.PsKey"
TypeValueTypesString = "valueTypes.String"
TypeValueTypesTime = "valueTypes.Time"
TypeValueTypesUnitValue = "valueTypes.UnitValue"
)
func IsUnknownStruct(ref interface{}) bool {
var ok bool var ok bool
for range Only.Once { for range Only.Once {
fieldVo := reflect.ValueOf(ref)
// fieldTo := reflect.TypeOf(ref)
// fmt.Printf("fieldVo.Type().String(): %s\n", fieldVo.Type().String())
// fmt.Printf("fieldVo.Type().Name(): %s\n", fieldVo.Type().Name())
// fmt.Printf("fieldVo.Kind().String(): %s\n", fieldVo.Kind().String())
// fmt.Printf("fieldTo.String(): %s\n", fieldTo.String())
// fmt.Printf("fieldTo.Name(): %s\n", fieldTo.Name())
// fmt.Printf("fieldTo.Kind().String(): %s\n", fieldTo.Kind().String())
// fmt.Printf("DEBUYg: K:%s / T:%s\n", fieldVo.Kind().String(), fieldVo.Type().String())
if fieldVo.Kind() == reflect.Slice {
if fieldVo.Len() > 0 {
ok = IsUnknownStruct(fieldVo.Index(0).Interface())
}
break
}
if fieldVo.Kind() == reflect.Array {
if fieldVo.Len() > 0 {
ok = IsUnknownStruct(fieldVo.Index(0).Interface())
}
break
}
if fieldVo.Kind() == reflect.Map {
mk := fieldVo.MapKeys()
if len(mk) > 0 {
ok = IsUnknownStruct(fieldVo.MapIndex(mk[0]).Interface())
}
break
}
if fieldVo.Kind() == reflect.Struct { if fieldVo.Kind() == reflect.Struct {
switch fieldTo.Type.String() { switch fieldVo.Type().String() {
case "Bool": case TypeBool:
case "Count": case TypeCount:
case "DateTime": case TypeDateTime:
case "Float": case TypeFloat:
case "Integer": case TypeInteger:
case "PointId": case TypePointId:
case "PsKey": case TypePsKey:
case "String": case TypeString:
case "Time": case TypeTime:
case "UnitValue": case TypeUnitValue:
case "valueTypes.Bool": case TypeValueTypesBool:
case "valueTypes.Count": case TypeValueTypesCount:
case "valueTypes.DateTime": case TypeValueTypesDateTime:
case "valueTypes.Float": case TypeValueTypesFloat:
case "valueTypes.Integer": case TypeValueTypesInteger:
case "valueTypes.PointId": case TypeValueTypesPointId:
case "valueTypes.PsKey": case TypeValueTypesPsKey:
case "valueTypes.String": case TypeValueTypesString:
case "valueTypes.Time": case TypeValueTypesTime:
case "valueTypes.UnitValue": case TypeValueTypesUnitValue:
default: default:
ok = true ok = true
@ -83,14 +162,14 @@ func PrintInt(s int, i interface{}) string {
case "int64": case "int64":
val = i.(int64) val = i.(int64)
case "valueTypes.Integer": case TypeValueTypesInteger:
fallthrough fallthrough
case "Integer": case TypeInteger:
val = i.(Integer).Value() val = i.(Integer).Value()
case "valueTypes.Count": case "valueTypes.Count":
fallthrough fallthrough
case "Count": case TypeCount:
val = i.(Integer).Value() val = i.(Integer).Value()
} }
@ -116,14 +195,14 @@ func SizeOfInt(i interface{}) int {
case "int64": case "int64":
val = i.(int64) val = i.(int64)
case "valueTypes.Integer": case TypeValueTypesInteger:
fallthrough fallthrough
case "Integer": case TypeInteger:
val = i.(Integer).Value() val = i.(Integer).Value()
case "valueTypes.Count": case TypeValueTypesCount:
fallthrough fallthrough
case "Count": case TypeCount:
val = i.(Integer).Value() val = i.(Integer).Value()
} }
switch { switch {
@ -167,7 +246,6 @@ func TypeToString(intSize int, dateFormat string, e interface{}) string {
ret = PrintInt(intSize, e.(int32)) ret = PrintInt(intSize, e.(int32))
case "int64": case "int64":
ret = PrintInt(intSize, e.(int64)) ret = PrintInt(intSize, e.(int64))
case "float32": case "float32":
// ret = float64(s.(float32)) // ret = float64(s.(float32))
v , err := json.Marshal(e) v , err := json.Marshal(e)
@ -175,7 +253,6 @@ func TypeToString(intSize int, dateFormat string, e interface{}) string {
break break
} }
ret = string(v) ret = string(v)
case "float64": case "float64":
// ret = s.(float64) // ret = s.(float64)
v , err := json.Marshal(e) v , err := json.Marshal(e)
@ -183,23 +260,28 @@ func TypeToString(intSize int, dateFormat string, e interface{}) string {
break break
} }
ret = string(v) ret = string(v)
case "string": case "string":
ret = strings.Trim(e.(string), ".") ret = strings.Trim(e.(string), ".")
case "bool": case "bool":
ret = fmt.Sprintf("%v", e.(bool)) ret = fmt.Sprintf("%v", e.(bool))
case "[]string":
// v := strings.Join(s.([]string), ",")
v , err := json.Marshal(e)
if err != nil {
break
}
ret = string(v)
case "valueTypes.UnitValue": case TypeValueTypesUnitValue:
fallthrough fallthrough
case "UnitValue": case TypeUnitValue:
ret = e.(UnitValue).String() ret = e.(UnitValue).String()
case "UnitValues": case TypeUnitValues:
fallthrough fallthrough
case "[]UnitValue": case TypeArrayUnitValue:
fallthrough fallthrough
case "[]valueTypes.UnitValue": case TypeArrayValueTypesUnitValue:
// ret = s.([]UnitValue) // ret = s.([]UnitValue)
v , err := json.Marshal(e) v , err := json.Marshal(e)
if err != nil { if err != nil {
@ -207,9 +289,9 @@ func TypeToString(intSize int, dateFormat string, e interface{}) string {
} }
ret = string(v) ret = string(v)
case "valueTypes.Float": case TypeValueTypesFloat:
fallthrough fallthrough
case "Float": case TypeFloat:
// ret = s.(Float) // ret = s.(Float)
v , err := json.Marshal(e) v , err := json.Marshal(e)
if err != nil { if err != nil {
@ -217,9 +299,9 @@ func TypeToString(intSize int, dateFormat string, e interface{}) string {
} }
ret = string(v) ret = string(v)
case "[]valueTypes.Float": case TypeArrayValueTypesFloat:
fallthrough fallthrough
case "[]Float": case TypeArrayFloat:
// ret = s.([]Float) // ret = s.([]Float)
v , err := json.Marshal(e) v , err := json.Marshal(e)
if err != nil { if err != nil {
@ -227,14 +309,14 @@ func TypeToString(intSize int, dateFormat string, e interface{}) string {
} }
ret = string(v) ret = string(v)
case "valueTypes.Integer": case TypeValueTypesInteger:
fallthrough fallthrough
case "Integer": case TypeInteger:
ret = PrintInt(intSize, e.(Integer)) ret = PrintInt(intSize, e.(Integer))
case "[]valueTypes.Integer": case TypeArrayValueTypesInteger:
fallthrough fallthrough
case "[]Integer": case TypeArrayInteger:
// ret = s.([]Integer) // ret = s.([]Integer)
v , err := json.Marshal(e) v , err := json.Marshal(e)
if err != nil { if err != nil {
@ -242,14 +324,14 @@ func TypeToString(intSize int, dateFormat string, e interface{}) string {
} }
ret = string(v) ret = string(v)
case "valueTypes.Count": case TypeValueTypesCount:
fallthrough fallthrough
case "Count": case TypeCount:
ret = PrintInt(intSize, e.(Count)) ret = PrintInt(intSize, e.(Count))
case "[]valueTypes.Count": case TypeArrayValueTypesCount:
fallthrough fallthrough
case "[]Count": case TypeArrayCount:
// ret = s.([]Count) // ret = s.([]Count)
v , err := json.Marshal(e) v , err := json.Marshal(e)
if err != nil { if err != nil {
@ -257,14 +339,14 @@ func TypeToString(intSize int, dateFormat string, e interface{}) string {
} }
ret = string(v) ret = string(v)
case "valueTypes.Bool": case TypeValueTypesBool:
fallthrough fallthrough
case "Bool": case TypeBool:
ret = e.(Bool).String() ret = e.(Bool).String()
case "[]valueTypes.Bool": case TypeArrayValueTypesBool:
fallthrough fallthrough
case "[]Bool": case TypeArrayBool:
// ret = s.([]Bool) // ret = s.([]Bool)
v , err := json.Marshal(e) v , err := json.Marshal(e)
if err != nil { if err != nil {
@ -272,14 +354,14 @@ func TypeToString(intSize int, dateFormat string, e interface{}) string {
} }
ret = string(v) ret = string(v)
case "valueTypes.String": case TypeValueTypesString:
fallthrough fallthrough
case "String": case TypeString:
ret = strings.Trim(e.(String).String(), ".") ret = strings.Trim(e.(String).String(), ".")
case "[]valueTypes.String": case TypeArrayValueTypesString:
fallthrough fallthrough
case "[]String": case TypeArrayString:
// ret = s.([]String) // ret = s.([]String)
v , err := json.Marshal(e) v , err := json.Marshal(e)
if err != nil { if err != nil {
@ -287,14 +369,14 @@ func TypeToString(intSize int, dateFormat string, e interface{}) string {
} }
ret = string(v) ret = string(v)
case "valueTypes.PsKey": case TypeValueTypesPsKey:
fallthrough fallthrough
case "PsKey": case TypePsKey:
ret = e.(PsKey).Value() ret = e.(PsKey).Value()
case "[]valueTypes.PsKey": case TypeArrayValueTypesPsKey:
fallthrough fallthrough
case "[]PsKey": case TypeArrayPsKey:
// ret = s.([]PsKey) // ret = s.([]PsKey)
v , err := json.Marshal(e) v , err := json.Marshal(e)
if err != nil { if err != nil {
@ -302,14 +384,14 @@ func TypeToString(intSize int, dateFormat string, e interface{}) string {
} }
ret = string(v) ret = string(v)
case "valueTypes.PointId": case TypeValueTypesPointId:
fallthrough fallthrough
case "PointId": case TypePointId:
ret = e.(PointId).String() ret = e.(PointId).String()
case "[]valueTypes.PointId": case TypeArrayValueTypesPointId:
fallthrough fallthrough
case "[]PointId": case TypeArrayPointId:
// ret = s.([]PointId) // ret = s.([]PointId)
v , err := json.Marshal(e) v , err := json.Marshal(e)
if err != nil { if err != nil {
@ -317,41 +399,33 @@ func TypeToString(intSize int, dateFormat string, e interface{}) string {
} }
ret = string(v) ret = string(v)
case "valueTypes.DateTime": case TypeValueTypesDateTime:
fallthrough fallthrough
case "DateTime": case TypeDateTime:
ret = e.(DateTime).Format(dateFormat) ret = e.(DateTime).Format(dateFormat)
case "[]valueTypes.DateTime": case TypeArrayValueTypesDateTime:
fallthrough fallthrough
case "[]DateTime": case TypeArrayDateTime:
// ret = s.([]DateTime) // ret = s.([]DateTime)
v , err := json.Marshal(e) v , err := json.Marshal(e)
if err != nil { if err != nil {
break break
} }
ret = string(v) ret = string(v)
case "[]string":
// v := strings.Join(s.([]string), ",")
v , err := json.Marshal(e)
if err != nil {
break
}
ret = string(v)
} }
} }
return ret return ret
} }
func AnyToUnitValue(e interface{}, unit string, Type string) (UnitValues, bool, bool) { func AnyToUnitValue(e interface{}, unit string, Type string, dateFormat string) (UnitValues, bool, bool) {
var uv UnitValues var uv UnitValues
ok := true ok := true
isNil := false isNil := false
for range Only.Once { for range Only.Once {
if IsNil(e) { if IsNil(e) {
// fmt.Println("DEBUG: AnyToUnitValue(): NIL") // fmt.Println("DEBUG: AnyToUnitValue(): NIL")
uv = append(uv, SetUnitValueString("", unit, Type + "(nil)")) uv = append(uv, SetUnitValueString("", unit, Type + "(unknown)"))
isNil = true isNil = true
break break
} }
@ -373,7 +447,6 @@ func AnyToUnitValue(e interface{}, unit string, Type string) (UnitValues, bool,
Type = "--" Type = "--"
} }
uv = append(uv, SetUnitValueInteger(e.(int64), unit, Type)) uv = append(uv, SetUnitValueInteger(e.(int64), unit, Type))
case "float32": case "float32":
if Type == "" { if Type == "" {
Type = "--" Type = "--"
@ -384,13 +457,11 @@ func AnyToUnitValue(e interface{}, unit string, Type string) (UnitValues, bool,
Type = "--" Type = "--"
} }
uv = append(uv, SetUnitValueFloat(e.(float64), unit, Type)) uv = append(uv, SetUnitValueFloat(e.(float64), unit, Type))
case "string": case "string":
if Type == "" { if Type == "" {
Type = "--" Type = "--"
} }
uv = append(uv, SetUnitValueString(e.(string), unit, Type)) uv = append(uv, SetUnitValueString(e.(string), unit, Type))
case "[]string": case "[]string":
// v := strings.Join(e.([]string), ",") // v := strings.Join(e.([]string), ",")
if Type == "" { if Type == "" {
@ -401,105 +472,105 @@ func AnyToUnitValue(e interface{}, unit string, Type string) (UnitValues, bool,
j = []byte(fmt.Sprintf("%v", e.([]string))) j = []byte(fmt.Sprintf("%v", e.([]string)))
} }
uv = append(uv, SetUnitValueString(string(j), unit, Type)) uv = append(uv, SetUnitValueString(string(j), unit, Type))
case "bool": case "bool":
if Type == "" { if Type == "" {
Type = "--" Type = "--"
} }
uv = append(uv, SetUnitValueBool(e.(bool))) uv = append(uv, SetUnitValueBool(e.(bool)))
case "valueTypes.UnitValue": case TypeValueTypesUnitValue:
fallthrough fallthrough
case "UnitValue": case TypeUnitValue:
if Type == "" { if Type == "" {
Type = "--" Type = "--"
} }
uv = append(uv, e.(UnitValue)) uv = append(uv, e.(UnitValue))
// uv = uv.UnitValueFix() // uv = uv.UnitValueFix()
case "UnitValues": case TypeUnitValues:
fallthrough fallthrough
case "[]valueTypes.UnitValue": case TypeArrayValueTypesUnitValue:
fallthrough fallthrough
case "[]UnitValue": case TypeArrayUnitValue:
for _, val := range e.([]UnitValue) { for _, val := range e.([]UnitValue) {
uv = append(uv, val) uv = append(uv, val)
} }
case "valueTypes.Float": case TypeValueTypesFloat:
fallthrough fallthrough
case "Float": case TypeFloat:
if Type == "" { if Type == "" {
Type = "Float" Type = TypeFloat
} }
v := e.(Float) v := e.(Float)
uv = append(uv, SetUnitValueFloat(v.Value(), unit, Type)) uv = append(uv, SetUnitValueFloat(v.Value(), unit, Type))
case "[]valueTypes.Float": case TypeArrayValueTypesFloat:
fallthrough fallthrough
case "[]Float": case TypeArrayFloat:
if Type == "" { if Type == "" {
Type = "Float" Type = TypeFloat
} }
v := e.([]Float) v := e.([]Float)
for _, val := range v { for _, val := range v {
uv = append(uv, SetUnitValueFloat(val.Value(), unit, Type)) uv = append(uv, SetUnitValueFloat(val.Value(), unit, Type))
} }
case "valueTypes.Integer": case TypeValueTypesInteger:
fallthrough fallthrough
case "Integer": case TypeInteger:
if Type == "" { if Type == "" {
Type = "Integer" Type = TypeInteger
} }
v := e.(Integer).Value() v := e.(Integer).Value()
uv = append(uv, SetUnitValueInteger(v, unit, Type)) uv = append(uv, SetUnitValueInteger(v, unit, Type))
case "[]valueTypes.Integer": case TypeArrayValueTypesInteger:
fallthrough fallthrough
case "[]Integer": case TypeArrayInteger:
if Type == "" { if Type == "" {
Type = "Integer" Type = TypeInteger
} }
v := e.([]Integer) v := e.([]Integer)
for _, val := range v { for _, val := range v {
uv = append(uv, SetUnitValueInteger(val.Value(), unit, Type)) uv = append(uv, SetUnitValueInteger(val.Value(), unit, Type))
} }
// HERE IS THE PROBLEM - need to return SOMETHING, even if it's null!
case "valueTypes.Count": case TypeValueTypesCount:
fallthrough fallthrough
case "Count": case TypeCount:
if Type == "" { if Type == "" {
Type = "Count" Type = TypeCount
} }
v := e.(Count).Value() v := e.(Count).Value()
uv = append(uv, SetUnitValueInteger(v, unit, Type)) uv = append(uv, SetUnitValueInteger(v, unit, Type))
case "[]valueTypes.Count": case TypeArrayValueTypesCount:
fallthrough fallthrough
case "[]Count": case TypeArrayCount:
if Type == "" { if Type == "" {
Type = "Count" Type = TypeCount
} }
v := e.([]Count) v := e.([]Count)
for _, val := range v { for _, val := range v {
uv = append(uv, SetUnitValueInteger(val.Value(), unit, Type)) uv = append(uv, SetUnitValueInteger(val.Value(), unit, Type))
} }
case "valueTypes.Bool": case TypeValueTypesBool:
fallthrough fallthrough
case "Bool": case TypeBool:
if Type == "" { if Type == "" {
Type = "Bool" Type = TypeBool
} }
v := e.(Bool) v := e.(Bool)
uv = append(uv, SetUnitValueBool(v.Value())) uv = append(uv, SetUnitValueBool(v.Value()))
case "[]valueTypes.Bool": case TypeArrayValueTypesBool:
fallthrough fallthrough
case "[]Bool": case TypeArrayBool:
if Type == "" { if Type == "" {
Type = "Bool" Type = TypeBool
} }
v := e.([]Bool) v := e.([]Bool)
for _, val := range v { for _, val := range v {
@ -507,113 +578,305 @@ func AnyToUnitValue(e interface{}, unit string, Type string) (UnitValues, bool,
uv = append(uv, SetUnitValueBool(val.Value())) uv = append(uv, SetUnitValueBool(val.Value()))
} }
case "valueTypes.String": case TypeValueTypesString:
fallthrough fallthrough
case "String": case TypeString:
if Type == "" { if Type == "" {
Type = "String" Type = TypeString
} }
v := e.(String).String() v := e.(String).String()
uv = append(uv, SetUnitValueString(v, unit, Type)) uv = append(uv, SetUnitValueString(v, unit, Type))
case "[]valueTypes.String": case TypeArrayValueTypesString:
fallthrough fallthrough
case "[]String": case TypeArrayString:
if Type == "" { if Type == "" {
Type = "String" Type = TypeString
} }
v := e.([]String) v := e.([]String)
for _, val := range v { for _, val := range v {
uv = append(uv, SetUnitValueString(val.Value(), unit, Type)) uv = append(uv, SetUnitValueString(val.Value(), unit, Type))
} }
case "valueTypes.PsKey": case TypeValueTypesPsKey:
fallthrough fallthrough
case "PsKey": case TypePsKey:
if Type == "" { if Type == "" {
Type = "PsKey" Type = TypePsKey
} }
v := e.(PsKey).Value() v := e.(PsKey).Value()
uv = append(uv, SetUnitValueString(v, unit, Type)) uv = append(uv, SetUnitValueString(v, unit, Type))
case "[]valueTypes.PsKey": case TypeArrayValueTypesPsKey:
fallthrough fallthrough
case "[]PsKey": case TypeArrayPsKey:
if Type == "" { if Type == "" {
Type = "PsKey" Type = TypePsKey
} }
v := e.([]PsKey) v := e.([]PsKey)
for _, val := range v { for _, val := range v {
uv = append(uv, SetUnitValueString(val.Value(), unit, Type)) uv = append(uv, SetUnitValueString(val.Value(), unit, Type))
} }
case "valueTypes.PointId": case TypeValueTypesPointId:
fallthrough fallthrough
case "PointId": case TypePointId:
if Type == "" { if Type == "" {
Type = "PointId" Type = TypePointId
} }
v := e.(PointId).String() v := e.(PointId).String()
uv = append(uv, SetUnitValueString(v, unit, Type)) uv = append(uv, SetUnitValueString(v, unit, Type))
case "[]valueTypes.PointId": case TypeArrayValueTypesPointId:
fallthrough fallthrough
case "[]PointId": case TypeArrayPointId:
if Type == "" { if Type == "" {
Type = "PointId" Type = TypePointId
} }
v := e.([]PointId) v := e.([]PointId)
for _, val := range v { for _, val := range v {
uv = append(uv, SetUnitValueString(val.String(), unit, Type)) uv = append(uv, SetUnitValueString(val.String(), unit, Type))
} }
case "valueTypes.DateTime": case TypeValueTypesDateTime:
fallthrough fallthrough
case "DateTime": case TypeDateTime:
if Type == "" { if Type == "" {
Type = "DateTime" Type = TypeDateTime
} }
v := e.(DateTime).String() v := e.(DateTime).Format(dateFormat)
uv = append(uv, SetUnitValueString(v, unit, Type)) uv = append(uv, SetUnitValueString(v, unit, Type))
case "[]valueTypes.DateTime": case TypeArrayValueTypesDateTime:
fallthrough fallthrough
case "[]DateTime": case TypeArrayDateTime:
if Type == "" { if Type == "" {
Type = "DateTime" Type = TypeDateTime
} }
v := e.([]DateTime) v := e.([]DateTime)
for _, val := range v { for _, val := range v {
uv = append(uv, SetUnitValueString(val.String(), unit, Type)) uv = append(uv, SetUnitValueString(val.Format(dateFormat), unit, Type))
} }
case "valueTypes.Time": case TypeValueTypesTime:
fallthrough fallthrough
case "Time": case TypeTime:
if Type == "" { if Type == "" {
Type = "Time" Type = TypeTime
} }
v := e.(Time).String() v := e.(Time).Format(TimeLayout)
uv = append(uv, SetUnitValueString(v, unit, Type)) uv = append(uv, SetUnitValueString(v, unit, Type))
case "[]valueTypes.Time": case TypeArrayValueTypesTime:
fallthrough fallthrough
case "[]Time": case TypeArrayTime:
if Type == "" { if Type == "" {
Type = "Time" Type = TypeTime
} }
v := e.([]Time) v := e.([]Time)
for _, val := range v { for _, val := range v {
uv = append(uv, SetUnitValueString(val.String(), unit, Type)) uv = append(uv, SetUnitValueString(val.Format(TimeLayout), unit, Type))
} }
default: default:
uv = append(uv, SetUnitValueString("", unit, Type + "(unknown)"))
ok = false ok = false
} }
} }
return uv, isNil, ok return uv, isNil, ok
} }
func AnyToValueString(e interface{}, intSize int, dateFormat string) string {
var ret string
for range Only.Once {
if IsNil(e) {
break
}
// fmt.Printf("DEBUG TYPE: %s\n", reflect.TypeOf(e).String())
switch reflect.TypeOf(e).String() {
case "bool":
ret = fmt.Sprintf("%v", e.(bool))
case "int":
ret = PrintInt(intSize, e.(int))
case "int32":
ret = PrintInt(intSize, e.(int32))
case "int64":
ret = PrintInt(intSize, e.(int64))
case "float32":
// ret = float64(s.(float32))
v , err := json.Marshal(e)
if err != nil {
break
}
ret = string(v)
case "float64":
// ret = s.(float64)
v , err := json.Marshal(e)
if err != nil {
break
}
ret = string(v)
case "string":
ret = e.(string)
// ret = strings.Trim(e.(string), ".")
case "[]string":
// v := strings.Join(s.([]string), ",")
v , err := json.Marshal(e)
if err != nil {
break
}
ret = string(v)
case TypeValueTypesUnitValue:
fallthrough
case TypeUnitValue:
ret = e.(UnitValue).String()
case TypeUnitValues:
fallthrough
case TypeArrayUnitValue:
fallthrough
case TypeArrayValueTypesUnitValue:
// ret = s.([]UnitValue)
v , err := json.Marshal(e)
if err != nil {
break
}
ret = string(v)
case TypeValueTypesFloat:
fallthrough
case TypeFloat:
ret = e.(Float).String()
case TypeArrayValueTypesFloat:
fallthrough
case TypeArrayFloat:
// ret = s.([]Float)
v , err := json.Marshal(e)
if err != nil {
break
}
ret = string(v)
case TypeValueTypesInteger:
fallthrough
case TypeInteger:
ret = PrintInt(intSize, e.(Integer))
case TypeArrayValueTypesInteger:
fallthrough
case TypeArrayInteger:
// ret = s.([]Integer)
v , err := json.Marshal(e)
if err != nil {
break
}
ret = string(v)
case TypeValueTypesCount:
fallthrough
case TypeCount:
ret = PrintInt(intSize, e.(Count))
case TypeArrayValueTypesCount:
fallthrough
case TypeArrayCount:
// ret = s.([]Count)
v , err := json.Marshal(e)
if err != nil {
break
}
ret = string(v)
case TypeValueTypesBool:
fallthrough
case TypeBool:
ret = e.(Bool).String()
case TypeArrayValueTypesBool:
fallthrough
case TypeArrayBool:
// ret = s.([]Bool)
v , err := json.Marshal(e)
if err != nil {
break
}
ret = string(v)
case TypeValueTypesString:
fallthrough
case TypeString:
ret = e.(String).String()
case TypeArrayValueTypesString:
fallthrough
case TypeArrayString:
// ret = s.([]String)
v , err := json.Marshal(e)
if err != nil {
break
}
ret = string(v)
case TypeValueTypesPsKey:
fallthrough
case TypePsKey:
ret = e.(PsKey).Value()
case TypeArrayValueTypesPsKey:
fallthrough
case TypeArrayPsKey:
// ret = s.([]PsKey)
v , err := json.Marshal(e)
if err != nil {
break
}
ret = string(v)
case TypeValueTypesPointId:
fallthrough
case TypePointId:
ret = e.(PointId).String()
case TypeArrayValueTypesPointId:
fallthrough
case TypeArrayPointId:
// ret = s.([]PointId)
v , err := json.Marshal(e)
if err != nil {
break
}
ret = string(v)
case TypeValueTypesDateTime:
fallthrough
case TypeDateTime:
ret = e.(DateTime).Format(dateFormat)
case TypeArrayValueTypesDateTime:
fallthrough
case TypeArrayDateTime:
// ret = s.([]DateTime)
v , err := json.Marshal(e)
if err != nil {
break
}
ret = string(v)
case TypeValueTypesTime:
fallthrough
case TypeTime:
ret = e.(Time).Format(dateFormat)
default:
}
}
return ret
}
// func Float32ToString(num float64) string { // func Float32ToString(num float64) string {
// s := fmt.Sprintf("%.6f", num) // s := fmt.Sprintf("%.6f", num)

View File

@ -15,14 +15,16 @@ type UnitValue struct {
TypeValue string `json:"type_value"` TypeValue string `json:"type_value"`
float64 `json:"value_float,omitempty"` *float64 `json:"value_float,omitempty"`
int64 `json:"value_int,omitempty"` *int64 `json:"value_int,omitempty"`
bool `json:"value_bool,omitempty"` *bool `json:"value_bool,omitempty"`
isFloat bool // isFloat bool
Valid bool `json:"valid"` Valid bool `json:"valid"`
} }
var zero = int64(0)
func (t *UnitValue) UnitValueFix() UnitValue { func (t *UnitValue) UnitValueFix() UnitValue {
switch t.UnitValue { switch t.UnitValue {
case "w": case "w":
@ -112,14 +114,14 @@ func (t UnitValue) MarshalJSON() ([]byte, error) {
for range Only.Once { for range Only.Once {
t.Valid = false t.Valid = false
if t.isFloat { if t.float64 != nil {
// Store result to JSON string // Store result to JSON string
data, err = json.Marshal(&struct { data, err = json.Marshal(&struct {
Unit string `json:"unit"` Unit string `json:"unit"`
Value float64 `json:"value"` Value float64 `json:"value"`
}{ }{
Unit: t.UnitValue, Unit: t.UnitValue,
Value: t.float64, Value: *t.float64,
}) })
if err != nil { if err != nil {
break break
@ -129,17 +131,33 @@ func (t UnitValue) MarshalJSON() ([]byte, error) {
break break
} }
if t.int64 != nil {
// Store result to JSON string // Store result to JSON string
data, err = json.Marshal(&struct { data, err = json.Marshal(&struct {
Unit string `json:"unit"` Unit string `json:"unit"`
Value int64 `json:"value"` Value int64 `json:"value"`
}{ }{
Unit: t.UnitValue, Unit: t.UnitValue,
Value: t.int64, Value: *t.int64,
}) })
if err != nil { if err != nil {
break break
} }
}
if t.bool != nil {
// Store result to JSON string
data, err = json.Marshal(&struct {
Unit string `json:"unit"`
Value bool `json:"value"`
}{
Unit: t.UnitValue,
Value: *t.bool,
})
if err != nil {
break
}
}
t.Valid = true t.Valid = true
} }
@ -148,26 +166,102 @@ func (t UnitValue) MarshalJSON() ([]byte, error) {
} }
func (t UnitValue) Value() float64 { func (t UnitValue) Value() float64 {
if t.isFloat { var ret float64
return t.float64 for range Only.Once {
if t.float64 != nil {
ret = *t.float64
break
} }
return float64(t.int64)
if t.int64 != nil {
ret = float64(*t.int64)
break
}
if t.bool != nil {
if *t.bool {
ret = 1
break
}
ret = 0
break
}
}
return ret
} }
func (t UnitValue) ValueFloat() float64 { func (t UnitValue) ValueFloat() float64 {
return t.float64 if t.float64 == nil {
return 0
}
return *t.float64
} }
func (t UnitValue) ValueInt() int64 { func (t UnitValue) ValueInt() int64 {
return t.int64 if t.int64 == nil {
return 0
}
return *t.int64
} }
func (t UnitValue) ValueBool() bool { func (t UnitValue) ValueBool() bool {
return t.bool if t.float64 == nil {
return false
}
return *t.bool
} }
func (t UnitValue) String() string { func (t UnitValue) String() string {
return t.StringValue var ret string
for range Only.Once {
if t.float64 != nil {
ret = strconv.FormatFloat(*t.float64, 'f', -1, 64)
break
}
if t.int64 != nil {
ret = strconv.FormatInt(*t.int64, 10)
break
}
if t.bool != nil {
ret = strconv.FormatBool(*t.bool)
break
}
ret = t.StringValue
}
return ret
}
func (t UnitValue) MatchFloat(comp float64) bool {
if t.float64 == nil {
return false
}
if *t.float64 == comp {
return true
}
return false
}
func (t UnitValue) MatchInt(comp int64) bool {
if t.int64 == nil {
return false
}
if *t.int64 == comp {
return true
}
return false
}
func (t UnitValue) MatchBool(comp bool) bool {
if t.bool == nil {
return false
}
if *t.bool == comp {
return true
}
return false
} }
func (t UnitValue) Unit() string { func (t UnitValue) Unit() string {
@ -178,10 +272,14 @@ func (t UnitValue) Type() string {
return t.TypeValue return t.TypeValue
} }
var varTrue = true
var varFalse = false
func (t *UnitValue) SetString(value string) UnitValue { func (t *UnitValue) SetString(value string) UnitValue {
for range Only.Once { for range Only.Once {
t.StringValue = value t.StringValue = value
t.int64 = 0 t.float64 = nil
t.int64 = nil
t.bool = nil
t.Valid = false t.Valid = false
if value == "" { if value == "" {
@ -193,6 +291,15 @@ func (t *UnitValue) SetString(value string) UnitValue {
break break
} }
if value == "true" {
t.SetBool(true)
break
}
if value == "false" {
t.SetBool(false)
break
}
if strings.Contains(value, ".") { if strings.Contains(value, ".") {
v, err := strconv.ParseFloat(t.StringValue, 64) v, err := strconv.ParseFloat(t.StringValue, 64)
if err != nil { if err != nil {
@ -214,11 +321,12 @@ func (t *UnitValue) SetString(value string) UnitValue {
func (t *UnitValue) SetInteger(value int64) UnitValue { func (t *UnitValue) SetInteger(value int64) UnitValue {
for range Only.Once { for range Only.Once {
t.int64 = value t.int64 = &value
t.float64 = float64(value) // fv := float64(value); t.float64 = &fv
t.isFloat = false t.float64 = nil
t.bool = nil
t.Valid = true t.Valid = true
t.StringValue = strconv.FormatInt(t.int64, 10) t.StringValue = strconv.FormatInt(*t.int64, 10)
} }
return *t return *t
@ -226,13 +334,15 @@ func (t *UnitValue) SetInteger(value int64) UnitValue {
func (t *UnitValue) SetFloat(value float64) UnitValue { func (t *UnitValue) SetFloat(value float64) UnitValue {
for range Only.Once { for range Only.Once {
t.int64 = int64(value) // iv := int64(value)
t.float64 = value // t.int64 = &iv
t.isFloat = true t.int64 = nil
t.float64 = &value
t.bool = nil
t.Valid = true t.Valid = true
// t.String = strconv.FormatFloat(t.float64, 'f', 12, 64) // t.String = strconv.FormatFloat(t.float64, 'f', 12, 64)
// t.String = strings.TrimRight(t.String, "0") // t.String = strings.TrimRight(t.String, "0")
t.StringValue = strconv.FormatFloat(t.float64, 'f', -1, 64) t.StringValue = strconv.FormatFloat(*t.float64, 'f', -1, 64)
} }
return *t return *t
@ -240,19 +350,50 @@ func (t *UnitValue) SetFloat(value float64) UnitValue {
func (t *UnitValue) SetBool(value bool) UnitValue { func (t *UnitValue) SetBool(value bool) UnitValue {
for range Only.Once { for range Only.Once {
t.isFloat = false
t.Valid = true t.Valid = true
if value { t.float64 = nil
t.bool = value t.int64 = nil
t.float64 = 0 t.bool = &value
t.int64 = 0 t.StringValue = strconv.FormatBool(value)
t.StringValue = "true"
break
} }
t.bool = value
t.float64 = 1 return *t
t.int64 = 1 }
func (t *UnitValue) SetBoolString(value string) UnitValue {
for range Only.Once {
t.Valid = true
t.float64 = nil
t.int64 = nil
// t.StringValue = strconv.FormatBool(value)
switch strings.ToLower(value) {
case "false":
fallthrough
case "no":
fallthrough
case "off":
fallthrough
case "0":
fallthrough
case "":
// fallthrough
// case "--":
t.bool = &varFalse
t.StringValue = "false" t.StringValue = "false"
t.Valid = true
case "true":
fallthrough
case "yes":
fallthrough
case "on":
fallthrough
case "1":
t.bool = &varTrue
t.StringValue = "true"
t.Valid = true
}
} }
return *t return *t
@ -261,7 +402,6 @@ func (t *UnitValue) SetBool(value bool) UnitValue {
func (t *UnitValue) SetUnit(unit string) UnitValue { func (t *UnitValue) SetUnit(unit string) UnitValue {
for range Only.Once { for range Only.Once {
t.UnitValue = unit t.UnitValue = unit
// t.Valid = true
} }
return *t return *t

View File

@ -61,7 +61,7 @@ func (sg *SunGrow) GetEndpoints(endpoints []string, psIds []valueTypes.Integer,
} }
if date.IsZero() { if date.IsZero() {
date = valueTypes.NewDateTime("now") date = valueTypes.NewDateTime(valueTypes.Now)
} }
// fmt.Printf("FilePrefix: %s\n", date.Original()) // fmt.Printf("FilePrefix: %s\n", date.Original())
// fmt.Printf("String: %s\n", date.String()) // fmt.Printf("String: %s\n", date.String())

View File

@ -56,7 +56,7 @@ func (sg *SunGrow) GetPointNamesFromTemplate(template string) api.TemplatePoints
ret = append(ret, api.TemplatePoint { ret = append(ret, api.TemplatePoint {
PsKey: dn, PsKey: dn,
PointId: pr.PointID, PointId: pr.PointID,
Description: pr.PointName, Name: pr.PointName,
Unit: pr.Unit, Unit: pr.Unit,
}) })
} }
@ -150,7 +150,7 @@ func (sg *SunGrow) GetTemplatePoints(template string) error {
sg.Error = table.AddRow( sg.Error = table.AddRow(
// api.NameDevicePoint(s.PsKey, s.PointId), // api.NameDevicePoint(s.PsKey, s.PointId),
s.PsKey + "." + s.PointId.String(), s.PsKey + "." + s.PointId.String(),
s.Description, s.Name,
s.Unit, s.Unit,
) )
if sg.Error != nil { if sg.Error != nil {
@ -787,6 +787,7 @@ func (sg *SunGrow) GetDevicePoints(psIds ...valueTypes.Integer) error {
break break
} }
points.AppendMap(data) points.AppendMap(data)
// api raw getPowerStationData '{"date_id":"202210","date_type":"2","ps_id":"1171348"}' // api raw getPowerStationData '{"date_id":"202210","date_type":"2","ps_id":"1171348"}'
ep = sg.GetByStruct("AppService.getPowerStationData", getPowerStationData.RequestData{ PsId: psId, DateType: "2", DateID: "202210"}, DefaultCacheTimeout) ep = sg.GetByStruct("AppService.getPowerStationData", getPowerStationData.RequestData{ PsId: psId, DateType: "2", DateID: "202210"}, DefaultCacheTimeout)
if sg.Error != nil { if sg.Error != nil {
@ -799,6 +800,7 @@ func (sg *SunGrow) GetDevicePoints(psIds ...valueTypes.Integer) error {
break break
} }
points.AppendMap(data) points.AppendMap(data)
// api raw getPowerStationData '{"date_id":"2022","date_type":"3","ps_id":"1171348"}' // api raw getPowerStationData '{"date_id":"2022","date_type":"3","ps_id":"1171348"}'
ep = sg.GetByStruct("AppService.getPowerStationData", getPowerStationData.RequestData{ PsId: psId, DateType: "3", DateID: "2022"}, DefaultCacheTimeout) ep = sg.GetByStruct("AppService.getPowerStationData", getPowerStationData.RequestData{ PsId: psId, DateType: "3", DateID: "2022"}, DefaultCacheTimeout)
if sg.Error != nil { if sg.Error != nil {
@ -1086,7 +1088,7 @@ func (sg *SunGrow) GetDevices(print bool) (getDeviceList.Devices, error) {
DeviceModelID: valueTypes.SetIntegerValue(0), DeviceModelID: valueTypes.SetIntegerValue(0),
TypeName: valueTypes.SetStringValue("Ps Id"), TypeName: valueTypes.SetStringValue("Ps Id"),
DeviceState: psId.PsHealthStatus, DeviceState: psId.PsHealthStatus,
DevStatus: psId.PsStatus.String(), DevStatus: psId.PsStatus,
Uuid: valueTypes.SetIntegerValue(0), Uuid: valueTypes.SetIntegerValue(0),
// PsFaultStatus: d.PsFaultStatus, // PsFaultStatus: d.PsFaultStatus,

View File

@ -449,7 +449,7 @@ func (m *Mqtt) GetLastReset(pointType string) string {
if !pt.Valid { if !pt.Valid {
break break
} }
if pt.TimeSpan == "" { if pt.UpdateFreq == "" {
break break
} }
ret = pt.WhenReset() ret = pt.WhenReset()