Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Correct Data Types for Setpoint Description, Selector, and HVAC #37

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion model/hvac.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type HvacSystemFunctionOperationModeRelationListDataSelectorsType struct {
type HvacSystemFunctionSetpointRelationDataType struct {
SystemFunctionId *HvacSystemFunctionIdType `json:"systemFunctionId,omitempty" eebus:"key"`
OperationModeId *HvacOperationModeIdType `json:"operationModeId,omitempty"`
SetpointId *SetpointIdType `json:"setpointId,omitempty"`
SetpointId []SetpointIdType `json:"setpointId,omitempty"`
}

type HvacSystemFunctionSetpointRelationDataElementsType struct {
Expand Down
26 changes: 13 additions & 13 deletions model/setpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ type SetpointConstraintsListDataSelectorsType struct {
}

type SetpointDescriptionDataType struct {
SetpointId *SetpointIdType `json:"setpointId,omitempty" eebus:"key"`
MeasurementId *SetpointIdType `json:"measurementId,omitempty"`
TimeTableId *SetpointIdType `json:"timeTableId,omitempty"`
SetpointType *SetpointTypeType `json:"setpointType,omitempty"`
Unit *ScaledNumberType `json:"unit,omitempty"`
ScopeType *ScaledNumberType `json:"scopeType,omitempty"`
Label *LabelType `json:"label,omitempty"`
Description *DescriptionType `json:"description,omitempty"`
SetpointId *SetpointIdType `json:"setpointId,omitempty" eebus:"key"`
MeasurementId *SetpointIdType `json:"measurementId,omitempty" eebus:"key"`
TimeTableId *SetpointIdType `json:"timeTableId,omitempty" eebus:"key"`
SetpointType *SetpointTypeType `json:"setpointType,omitempty"`
Unit *UnitOfMeasurementType `json:"unit,omitempty"`
ScopeType *ScopeTypeType `json:"scopeType,omitempty"`
Label *LabelType `json:"label,omitempty"`
Description *DescriptionType `json:"description,omitempty"`
}

type SetpointDescriptionDataElementsType struct {
Expand All @@ -90,9 +90,9 @@ type SetpointDescriptionListDataType struct {
}

type SetpointDescriptionListDataSelectorsType struct {
SetpointId *SetpointIdType `json:"setpointId,omitempty"`
MeasurementId *SetpointIdType `json:"measurementId,omitempty"`
TimeTableId *SetpointIdType `json:"timeTableId,omitempty"`
SetpointType *SetpointIdType `json:"setpointType,omitempty"`
ScopeType *ScaledNumberType `json:"scopeType,omitempty"`
SetpointId *SetpointIdType `json:"setpointId,omitempty"`
MeasurementId *MeasurementIdType `json:"measurementId,omitempty"`
TimeTableId *TimeTableIdType `json:"timeTableId,omitempty"`
SetpointType *SetpointTypeType `json:"setpointType,omitempty"`
ScopeType *ScopeTypeType `json:"scopeType,omitempty"`
}
18 changes: 12 additions & 6 deletions model/setpoint_additions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,27 @@ func TestSetpointDescriptionListDataType_Update(t *testing.T) {
sut := SetpointDescriptionListDataType{
SetpointDescriptionData: []SetpointDescriptionDataType{
{
SetpointId: util.Ptr(SetpointIdType(0)),
Description: util.Ptr(DescriptionType("old")),
SetpointId: util.Ptr(SetpointIdType(0)),
MeasurementId: util.Ptr(SetpointIdType(0)),
TimeTableId: util.Ptr(SetpointIdType(0)),
Description: util.Ptr(DescriptionType("old")),
},
{
SetpointId: util.Ptr(SetpointIdType(1)),
Description: util.Ptr(DescriptionType("old")),
SetpointId: util.Ptr(SetpointIdType(1)),
MeasurementId: util.Ptr(SetpointIdType(1)),
TimeTableId: util.Ptr(SetpointIdType(1)),
Description: util.Ptr(DescriptionType("old")),
},
},
}

newData := SetpointDescriptionListDataType{
SetpointDescriptionData: []SetpointDescriptionDataType{
{
SetpointId: util.Ptr(SetpointIdType(1)),
Description: util.Ptr(DescriptionType("new")),
SetpointId: util.Ptr(SetpointIdType(1)),
MeasurementId: util.Ptr(SetpointIdType(1)),
TimeTableId: util.Ptr(SetpointIdType(1)),
Description: util.Ptr(DescriptionType("new")),
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions spine/function_data_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ func CreateFunctionData[F any](featureType model.FeatureTypeType) []F {

if featureType == model.FeatureTypeTypeHvac || featureType == model.FeatureTypeTypeGeneric {
result = append(result, []F{
createFunctionData[model.HvacOperationModeDescriptionDataType, F](model.FunctionTypeHvacOperationModeDescriptionListData),
createFunctionData[model.HvacOperationModeDescriptionListDataType, F](model.FunctionTypeHvacOperationModeDescriptionListData),
createFunctionData[model.HvacOverrunDescriptionListDataType, F](model.FunctionTypeHvacOverrunDescriptionListData),
createFunctionData[model.HvacOverrunListDataType, F](model.FunctionTypeHvacOverrunListData),
createFunctionData[model.HvacSystemFunctionDescriptionDataType, F](model.FunctionTypeHvacSystemFunctionDescriptionListData),
createFunctionData[model.HvacSystemFunctionDescriptionListDataType, F](model.FunctionTypeHvacSystemFunctionDescriptionListData),
createFunctionData[model.HvacSystemFunctionListDataType, F](model.FunctionTypeHvacSystemFunctionListData),
createFunctionData[model.HvacSystemFunctionOperationModeRelationListDataType, F](model.FunctionTypeHvacSystemFunctionOperationModeRelationListData),
createFunctionData[model.HvacSystemFunctionPowerSequenceRelationListDataType, F](model.FunctionTypeHvacSystemFunctionPowerSequenceRelationListData),
Expand Down
4 changes: 2 additions & 2 deletions spine/function_data_factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ func TestFunctionDataFactory_FunctionData(t *testing.T) {

result = CreateFunctionData[api.FunctionDataInterface](model.FeatureTypeTypeHvac)
assert.Equal(t, 8, len(result))
assert.IsType(t, &FunctionData[model.HvacOperationModeDescriptionDataType]{}, result[0])
assert.IsType(t, &FunctionData[model.HvacOperationModeDescriptionListDataType]{}, result[0])
assert.IsType(t, &FunctionData[model.HvacOverrunDescriptionListDataType]{}, result[1])
assert.IsType(t, &FunctionData[model.HvacOverrunListDataType]{}, result[2])
assert.IsType(t, &FunctionData[model.HvacSystemFunctionDescriptionDataType]{}, result[3])
assert.IsType(t, &FunctionData[model.HvacSystemFunctionDescriptionListDataType]{}, result[3])
assert.IsType(t, &FunctionData[model.HvacSystemFunctionListDataType]{}, result[4])

result = CreateFunctionData[api.FunctionDataInterface](model.FeatureTypeTypeIdentification)
Expand Down
Loading