Skip to content

Commit

Permalink
Added support for celcius in metervalues
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and lorenzodonini committed Jul 2, 2024
1 parent 5268cd9 commit 717e26d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ocpp1.6/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ const (
UnitOfMeasureA UnitOfMeasure = "A"
UnitOfMeasureV UnitOfMeasure = "V"
UnitOfMeasureCelsius UnitOfMeasure = "Celsius"
UnitOfMeasureCelcius UnitOfMeasure = "Celcius"
UnitOfMeasureFahrenheit UnitOfMeasure = "Fahrenheit"
UnitOfMeasureK UnitOfMeasure = "K"
UnitOfMeasurePercent UnitOfMeasure = "Percent"
Expand Down Expand Up @@ -291,7 +292,7 @@ func isValidLocation(fl validator.FieldLevel) bool {
func isValidUnitOfMeasure(fl validator.FieldLevel) bool {
unitOfMeasure := UnitOfMeasure(fl.Field().String())
switch unitOfMeasure {
case UnitOfMeasureA, UnitOfMeasureWh, UnitOfMeasureKWh, UnitOfMeasureVarh, UnitOfMeasureKvarh, UnitOfMeasureW, UnitOfMeasureKW, UnitOfMeasureVA, UnitOfMeasureKVA, UnitOfMeasureVar, UnitOfMeasureKvar, UnitOfMeasureV, UnitOfMeasureCelsius, UnitOfMeasureFahrenheit, UnitOfMeasureK, UnitOfMeasurePercent:
case UnitOfMeasureA, UnitOfMeasureWh, UnitOfMeasureKWh, UnitOfMeasureVarh, UnitOfMeasureKvarh, UnitOfMeasureW, UnitOfMeasureKW, UnitOfMeasureVA, UnitOfMeasureKVA, UnitOfMeasureVar, UnitOfMeasureKvar, UnitOfMeasureV, UnitOfMeasureCelsius, UnitOfMeasureCelcius, UnitOfMeasureFahrenheit, UnitOfMeasureK, UnitOfMeasurePercent:
return true
default:
return false
Expand Down

3 comments on commit 717e26d

@andig
Copy link
Contributor

@andig andig commented on 717e26d Aug 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lorenzodonini why is this being added? Seems that sofar standards compliance was key. Does the standard allow both?

@lorenzodonini
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lorenzodonini why is this being added? Seems that sofar standards compliance was key. Does the standard allow both?

Not exactly. There was an error in the specs that was fixed later on, which probably led to some incorrect implementations. This allows to support those cases. Check out the original PR description.

@andig
Copy link
Contributor

@andig andig commented on 717e26d Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, thanks- I missed the PR, much appreciated.

Please sign in to comment.