File tree Expand file tree Collapse file tree 3 files changed +28
-14
lines changed Expand file tree Collapse file tree 3 files changed +28
-14
lines changed Original file line number Diff line number Diff line change @@ -189,12 +189,19 @@ func (e *LPC) AddFeatures() {
189
189
Unit : util .Ptr (model .UnitOfMeasurementTypeW ),
190
190
},
191
191
)
192
- dcs .AddKeyValueDescription (
193
- model.DeviceConfigurationKeyValueDescriptionDataType {
194
- KeyName : util .Ptr (model .DeviceConfigurationKeyNameTypeFailsafeDurationMinimum ),
195
- ValueType : util .Ptr (model .DeviceConfigurationKeyValueTypeTypeDuration ),
196
- },
197
- )
192
+
193
+ // only add if it doesn't exist yet
194
+ filter := model.DeviceConfigurationKeyValueDescriptionDataType {
195
+ KeyName : util .Ptr (model .DeviceConfigurationKeyNameTypeFailsafeDurationMinimum ),
196
+ }
197
+ if data , err := dcs .GetKeyValueDescriptionsForFilter (filter ); err == nil && len (data ) == 0 {
198
+ dcs .AddKeyValueDescription (
199
+ model.DeviceConfigurationKeyValueDescriptionDataType {
200
+ KeyName : util .Ptr (model .DeviceConfigurationKeyNameTypeFailsafeDurationMinimum ),
201
+ ValueType : util .Ptr (model .DeviceConfigurationKeyValueTypeTypeDuration ),
202
+ },
203
+ )
204
+ }
198
205
199
206
value := & model.DeviceConfigurationKeyValueValueType {
200
207
ScaledNumber : model .NewScaledNumberType (0 ),
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ func (e *LPP) SetProductionLimit(limit ucapi.LoadLimit) (resultErr error) {
79
79
return loadControlf .UpdateLimitDataForId (limitData , deleteTimePeriod , limidId )
80
80
}
81
81
82
- // return the currently pending incoming consumption write limits
82
+ // return the currently pending incoming production write limits
83
83
func (e * LPP ) PendingProductionLimits () map [model.MsgCounterType ]ucapi.LoadLimit {
84
84
result := make (map [model.MsgCounterType ]ucapi.LoadLimit )
85
85
@@ -127,7 +127,7 @@ func (e *LPP) PendingProductionLimits() map[model.MsgCounterType]ucapi.LoadLimit
127
127
return result
128
128
}
129
129
130
- // accept or deny an incoming consumption write limit
130
+ // accept or deny an incoming production write limit
131
131
//
132
132
// use PendingProductionLimits to get the list of currently pending requests
133
133
func (e * LPP ) ApproveOrDenyProductionLimit (msgCounter model.MsgCounterType , approve bool , reason string ) {
Original file line number Diff line number Diff line change @@ -189,12 +189,19 @@ func (e *LPP) AddFeatures() {
189
189
Unit : util .Ptr (model .UnitOfMeasurementTypeW ),
190
190
},
191
191
)
192
- dcs .AddKeyValueDescription (
193
- model.DeviceConfigurationKeyValueDescriptionDataType {
194
- KeyName : util .Ptr (model .DeviceConfigurationKeyNameTypeFailsafeDurationMinimum ),
195
- ValueType : util .Ptr (model .DeviceConfigurationKeyValueTypeTypeDuration ),
196
- },
197
- )
192
+
193
+ // only add if it doesn't exist yet
194
+ filter := model.DeviceConfigurationKeyValueDescriptionDataType {
195
+ KeyName : util .Ptr (model .DeviceConfigurationKeyNameTypeFailsafeDurationMinimum ),
196
+ }
197
+ if data , err := dcs .GetKeyValueDescriptionsForFilter (filter ); err == nil && len (data ) == 0 {
198
+ dcs .AddKeyValueDescription (
199
+ model.DeviceConfigurationKeyValueDescriptionDataType {
200
+ KeyName : util .Ptr (model .DeviceConfigurationKeyNameTypeFailsafeDurationMinimum ),
201
+ ValueType : util .Ptr (model .DeviceConfigurationKeyValueTypeTypeDuration ),
202
+ },
203
+ )
204
+ }
198
205
199
206
value := & model.DeviceConfigurationKeyValueValueType {
200
207
ScaledNumber : model .NewScaledNumberType (0 ),
You can’t perform that action at this time.
0 commit comments