Skip to content

Commit

Permalink
v3.0.0-alpha - almost done
Browse files Browse the repository at this point in the history
  • Loading branch information
MickMake committed Dec 1, 2022
1 parent 5c9767e commit 361db3e
Show file tree
Hide file tree
Showing 62 changed files with 2,805 additions and 1,947 deletions.
406 changes: 147 additions & 259 deletions .idea/workspace.xml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions cmd/cmd_mqtt.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,15 +408,15 @@ func (ca *Cmds) Update(endpoint string, data api.DataMap, newDay bool) error {

fullId := r.EndPoint
if r.Point.GroupName == "alias" {
fullId = mmHa.JoinStringsForId(r.Parent.Key, r.Point.Parents.Index[0], r.Point.Id.String())
fullId = mmHa.JoinStringsForId(r.Parent.Key, r.Point.Parents.Index[0], r.Point.Id)
}

re := mmHa.EntityConfig {
Name: mmHa.JoinStringsForName(" - ", fullId), // r.Point.Name, // PointName,
SubName: "",
ParentId: r.EndPoint,
ParentName: r.Parent.Key,
UniqueId: r.Point.Id.String(),
UniqueId: r.Point.Id,
// UniqueId: r.Id,
FullId: fullId, // string(r.FullId), // WAS r.Point.FullId
// FullName: r.Point.Name,
Expand Down
18 changes: 10 additions & 8 deletions iSolarCloud/AppService/getAreaList/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,22 @@ func (rd RequestData) Help() string {

type ResultData struct {
PageList []struct {
GoStruct GoStruct.GoStruct `json:"-" PointIdFrom:"OrgId" PointIdReplace:"true"`

OrgId valueTypes.Integer `json:"org_id"`
OrgName valueTypes.String `json:"org_name"`
StationCount valueTypes.Integer `json:"station_count"`
FaultStationCount valueTypes.Integer `json:"fault_station_count"`
IsHaveEsPs valueTypes.Bool `json:"is_have_es_ps"`
IsLeaf valueTypes.Bool `json:"is_leaf"`
OrgId valueTypes.Integer `json:"org_id"`
OrgName valueTypes.String `json:"org_name"`
P83048 valueTypes.UnitValue `json:"p83048"`
P83049 valueTypes.UnitValue `json:"p83049"`
P83050 valueTypes.UnitValue `json:"p83050"`
P83051 valueTypes.UnitValue `json:"p83051"`
P83048 valueTypes.UnitValue `json:"p83048" PointVirtual:"true"`
P83049 valueTypes.UnitValue `json:"p83049" PointVirtual:"true"`
P83050 valueTypes.UnitValue `json:"p83050" PointVirtual:"true"`
P83051 valueTypes.UnitValue `json:"p83051" PointVirtual:"true"`
PlanMonth valueTypes.String `json:"plan_month"`
StationCount valueTypes.Integer `json:"station_count"`
TodayEnergy valueTypes.UnitValue `json:"today_energy"`
TotalEnergy valueTypes.UnitValue `json:"total_energy"`
} `json:"pageList" PointId:"page_list" PointIdFromChild:"OrgId" PointIdReplace:"true" DataTable:"true"`
} `json:"pageList" PointId:"areas" DataTable:"true"`
RowCount valueTypes.Integer `json:"rowCount" PointId:"row_count" PointIgnore:"true"`
}

Expand Down
32 changes: 6 additions & 26 deletions iSolarCloud/AppService/getBatchNewestPointData/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@ package getBatchNewestPointData
import (
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/GoStruct"
"GoSungrow/iSolarCloud/api/GoStruct/valueTypes"

"github.com/MickMake/GoUnify/Only"
"fmt"
)

const Url = "/v1/devService/getBatchNewestPointData"
const Disabled = false

type RequestData struct {
}
PointIds valueTypes.String `json:"ps_key_points" required:"true"`
}

func (rd RequestData) IsValid() error {
// rd.PointIds = valueTypes.SetStringValue("1129147_14_1_1.p13143")
rd.PointIds = valueTypes.SetStringValue("p13143")
return GoStruct.VerifyOptionsRequired(rd)
}

Expand All @@ -25,39 +28,16 @@ func (rd RequestData) Help() string {


type ResultData struct {
// Dummy valueTypes.String `json:"dummy"`
}

func (e *ResultData) IsValid() error {
var err error
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 {
entries := api.NewDataMap()

for range Only.Once {
entries.StructToDataMap(*e, "", GoStruct.EndPointPath{})
}

entries.StructToDataMap(*e, "", GoStruct.EndPointPath{})
return entries
}
14 changes: 4 additions & 10 deletions iSolarCloud/AppService/getChnnlListByPsId/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"GoSungrow/iSolarCloud/api/GoStruct"
"GoSungrow/iSolarCloud/api/GoStruct/valueTypes"
"fmt"
"github.com/MickMake/GoUnify/Only"
)

const Url = "/v1/devService/getChnnlListByPsId"
Expand All @@ -26,6 +25,8 @@ func (rd RequestData) Help() string {

type ResultData struct {
PageList []struct {
GoStruct GoStruct.GoStruct `json:"-" PointIdFrom:"PsId" PointIdReplace:"true" PointIdReplace:"true"`

PsId valueTypes.Integer `json:"ps_id"`
Sn valueTypes.String `json:"sn"`
ChannelId valueTypes.Integer `json:"chnnl_id" PointId:"channel_id"`
Expand All @@ -39,7 +40,7 @@ type ResultData struct {
IsEnable valueTypes.Bool `json:"is_enable"`
IsSure valueTypes.Bool `json:"is_sure"`
ProtocolType interface{} `json:"protocol_type"`
} `json:"pageList" PointId:"page_list" PointIdFromChild:"PsId" PointIdReplace:"true" DataTable:"true"`
} `json:"pageList" PointId:"devices" DataTable:"true"`
RowCount valueTypes.Integer `json:"rowCount" PointId:"row_count"`
}

Expand All @@ -50,13 +51,6 @@ func (e *ResultData) IsValid() error {

func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()

for range Only.Once {
// pkg := reflection.GetName("", *e)
// dt := valueTypes.NewDateTime(valueTypes.Now)
// name := pkg + "." + e.Request.PsId.String()
entries.StructToDataMap(*e, e.Request.PsId.String(), GoStruct.NewEndPointPath(e.Request.PsId.String()))
}

entries.StructToDataMap(*e, e.Request.PsId.String(), GoStruct.EndPointPath{})
return entries
}
45 changes: 16 additions & 29 deletions iSolarCloud/AppService/getCommunicationDeviceConfigInfo/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ package getCommunicationDeviceConfigInfo
import (
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/GoStruct"

"github.com/MickMake/GoUnify/Only"
"GoSungrow/iSolarCloud/api/GoStruct/valueTypes"
"fmt"
)

const Url = "/v1/devService/getCommunicationDeviceConfigInfo"
const Disabled = false

type RequestData struct {
}
}

func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)
Expand All @@ -24,40 +23,28 @@ func (rd RequestData) Help() string {
}


type ResultData struct {
// Dummy valueTypes.String `json:"dummy"`
type ResultData []struct {
GoStructParent GoStruct.GoStructParent `json:"-" DataTable:"true" DataTableSortOn:"TypeId"`
GoStruct GoStruct.GoStruct `json:"-" PointIdFrom:"TypeId" PointIdReplace:"false"`

TypeId valueTypes.Integer `json:"type_id"`
DeviceName valueTypes.String `json:"device_name"`
CustomTopic valueTypes.String `json:"custom_topic"`
Remark valueTypes.String `json:"remark"`
IsNeedModbus valueTypes.Bool `json:"is_need_modbus"`
IsSupportParamSet valueTypes.Bool `json:"is_support_param_set"`
IsSupportRemoteUpgrade valueTypes.Bool `json:"is_support_remote_upgrade"`
IsSupportTimezoneSet valueTypes.Bool `json:"is_support_timezone_set"`
IsThirdParty valueTypes.Bool `json:"is_third_party"`
}

func (e *ResultData) IsValid() error {
var err error
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 {
entries := api.NewDataMap()

for range Only.Once {
entries.StructToDataMap(*e, "", GoStruct.EndPointPath{})
}

entries.StructToDataMap(*e, "", GoStruct.EndPointPath{})
return entries
}
45 changes: 23 additions & 22 deletions iSolarCloud/AppService/getDeviceList/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,39 @@ func (rd RequestData) Help() string {
return ret
}

// ResultData - Both getDeviceList & queryDeviceListForApp have the same output.
type ResultData struct {
PageList []struct {
GoStructParent GoStruct.GoStructParent `json:"-" PointDeviceFrom:"PsKey"`
GoStruct GoStruct.GoStruct `json:"-" PointDeviceFrom:"PsKey" PointIdFrom:"PsKey" PointIdReplace:"true"`

AttrId valueTypes.Integer `json:"attr_id"`
PsKey valueTypes.PsKey `json:"ps_key"`
PsId valueTypes.PsId `json:"ps_id"`
DeviceType valueTypes.Integer `json:"device_type"`
DeviceCode valueTypes.Integer `json:"device_code"`
ChannelId valueTypes.Integer `json:"chnnl_id" PointId:"channel_id"`
Sn valueTypes.String `json:"sn" PointName:"Serial Number"`
FactoryName valueTypes.String `json:"factory_name"`

AttrId valueTypes.Integer `json:"attr_id"`
CommandStatus valueTypes.Integer `json:"command_status"`
ConnectState valueTypes.Integer `json:"connect_state"`
ConnectState valueTypes.Bool `json:"connect_state"`
DataFlag valueTypes.Integer `json:"data_flag"`
DataFlagDetail valueTypes.Integer `json:"data_flag_detail"`

DevFaultStatus valueTypes.Integer `json:"dev_fault_status"`
DevStatus valueTypes.Integer `json:"dev_status"`
DeviceArea valueTypes.Integer `json:"device_area"`
DeviceCode valueTypes.Integer `json:"device_code"`
DevStatus valueTypes.Bool `json:"dev_status"`
DeviceArea valueTypes.String `json:"device_area"`
DeviceFactoryDate valueTypes.DateTime `json:"device_factory_date" PointNameDateFormat:"2006/01/02 15:04:05"`
DeviceId valueTypes.Integer `json:"device_id"`
DeviceModel valueTypes.String `json:"device_model"`
DeviceModelCode valueTypes.String `json:"device_model_code"`
DeviceModelId valueTypes.Integer `json:"device_model_id"`
DeviceName valueTypes.String `json:"device_name"`
DeviceProSn valueTypes.String `json:"device_pro_sn" PointName:"Device Serial Number"`
DeviceProSn valueTypes.String `json:"device_pro_sn"`
DeviceState valueTypes.Integer `json:"device_state"`
DeviceSubType interface{} `json:"device_sub_type"`
DeviceSubTypeName interface{} `json:"device_sub_type_name"`
DeviceType valueTypes.Integer `json:"device_type"`
FactoryName valueTypes.String `json:"factory_name"`
InstallerDevFaultStatus valueTypes.Integer `json:"installer_dev_fault_status"`
InverterModelType valueTypes.Integer `json:"inverter_model_type"`

IsCountryCheck valueTypes.Bool `json:"is_country_check"`
IsHasFunctionEnum valueTypes.Bool `json:"is_has_function_enum"`
IsHasTheAbility valueTypes.Bool `json:"is_has_the_ability"`
Expand All @@ -62,18 +67,18 @@ type ResultData struct {
IsReset valueTypes.Bool `json:"is_reset"`
IsSecond valueTypes.Bool `json:"is_second"`
IsThirdParty valueTypes.Bool `json:"is_third_party"`

InstallerDevFaultStatus valueTypes.Integer `json:"installer_dev_fault_status"`
InverterModelType valueTypes.Integer `json:"inverter_model_type"`
ModuleUUID valueTypes.Integer `json:"module_uuid"`
OwnerDevFaultStatus valueTypes.Integer `json:"owner_dev_fault_status"`
P24 interface{} `json:"p24"`
Posx interface{} `json:"posx"`
Posy interface{} `json:"posy"`
PsId valueTypes.PsId `json:"ps_id"`
PsKey valueTypes.PsKey `json:"ps_key"`
RelState valueTypes.Integer `json:"rel_state"`
Sn valueTypes.String `json:"sn" PointName:"Serial Number"`
RelState valueTypes.Bool `json:"rel_state"`
TypeName valueTypes.String `json:"type_name"`
UUID valueTypes.Integer `json:"uuid"`
} `json:"pageList" PointId:"page_list" PointIdFromChild:"PsKey" PointIdReplace:"true"`
} `json:"pageList" PointId:"devices" DataTable:"true" DataTableSortOn:"PsKey"`
RowCount valueTypes.Integer `json:"rowCount" PointId:"row_count"`
}

Expand All @@ -95,7 +100,7 @@ type Device struct {
DeviceModelId valueTypes.Integer
TypeName valueTypes.String
DeviceState valueTypes.Integer
DevStatus valueTypes.Integer
DevStatus valueTypes.Bool
Uuid valueTypes.Integer
}
type Devices []Device
Expand Down Expand Up @@ -272,10 +277,6 @@ func GetDevicesTable(data Devices) output.Table {

func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()

for range Only.Once {
entries.StructToDataMap(*e, e.Request.PsId.String(), GoStruct.NewEndPointPath(e.Request.PsId.String()))
}

entries.StructToDataMap(*e, e.Request.PsId.String(), GoStruct.NewEndPointPath(e.Request.PsId.String()))
return entries
}
32 changes: 1 addition & 31 deletions iSolarCloud/AppService/getDevicePoints/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/GoStruct"
"GoSungrow/iSolarCloud/api/GoStruct/valueTypes"
"github.com/MickMake/GoUnify/Only"
"fmt"
)

Expand All @@ -29,40 +28,11 @@ type ResultData []struct {

func (e *ResultData) IsValid() error {
var err error
//switch {
//case e.Dummy == "":
// break
//default:
// err = errors.New(fmt.Sprintf("unknown error '%s'", e.Dummy))
//}
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 {
entries := api.NewDataMap()

for range Only.Once {
entries.StructToDataMap(*e, "", GoStruct.EndPointPath{})
}

entries.StructToDataMap(*e, "", GoStruct.EndPointPath{})
return entries
}
4 changes: 2 additions & 2 deletions iSolarCloud/AppService/getDeviceTypeList/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ func (rd RequestData) Help() string {

type ResultData struct {
DeviceTypeList []struct {
DevListOrderId valueTypes.Integer `json:"dev_list_order_id"`
DeviceType valueTypes.Integer `json:"device_type"`
DevListOrderId valueTypes.Integer `json:"dev_list_order_id"`
TypeName valueTypes.String `json:"type_name"`
} `json:"deviceTypeList" DataTable:"true"`
} `json:"deviceTypeList" DataTable:"true" DataTableSortOn:"DeviceType"`
}

func (e *ResultData) IsValid() error {
Expand Down

0 comments on commit 361db3e

Please sign in to comment.