Revert "SHM: uppercase hex vendor id (#23616)"
This reverts commit 2a35026f4f.
This commit is contained in:
parent
54419f9e7d
commit
0222b07f2c
2 changed files with 8 additions and 12 deletions
|
|
@ -26,7 +26,7 @@ const (
|
|||
sempController = "Sunny Home Manager"
|
||||
sempBaseURLEnv = "SEMP_BASE_URL"
|
||||
sempGateway = "urn:schemas-simple-energy-management-protocol:device:Gateway:1"
|
||||
sempDeviceId = "F-%s-%.12X-00" // 6 bytes
|
||||
sempDeviceId = "F-%s-%.12x-00" // 6 bytes
|
||||
sempSerialNumber = "%s-%d"
|
||||
sempCharger = "EVCharger"
|
||||
basePath = "/semp"
|
||||
|
|
@ -55,17 +55,11 @@ type Config struct {
|
|||
|
||||
// NewFromConfig creates a new SEMP instance from configuration and starts it
|
||||
func NewFromConfig(cfg Config, site site.API, addr string, router *mux.Router) error {
|
||||
vendorId := strings.ToUpper(cfg.VendorId)
|
||||
vendorId := cfg.VendorId
|
||||
if vendorId == "" {
|
||||
vendorId = "28081973"
|
||||
} else {
|
||||
if _, err := hex.DecodeString(cfg.VendorId); err != nil {
|
||||
return fmt.Errorf("vendor id: %w", err)
|
||||
}
|
||||
|
||||
if len(cfg.VendorId) != 8 {
|
||||
return fmt.Errorf("invalid vendor id: %v. Must be 8 characters HEX string", vendorId)
|
||||
}
|
||||
} else if len(vendorId) != 8 {
|
||||
return fmt.Errorf("invalid vendor id: %v. Must be 8 characters HEX string", vendorId)
|
||||
}
|
||||
|
||||
uid, err := uuid.NewUUID()
|
||||
|
|
@ -204,7 +198,7 @@ func (s *SEMP) gatewayDescription(w http.ResponseWriter, r *http.Request) {
|
|||
Device: Device{
|
||||
DeviceType: sempGateway,
|
||||
FriendlyName: "evcc",
|
||||
Manufacturer: "evcc.io",
|
||||
Manufacturer: "github.com/evcc-io/evcc",
|
||||
ModelName: serverName,
|
||||
PresentationURL: s.hostURI,
|
||||
UDN: uid,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue