hardybarth-salia: add rfid identifier (#20255)

This commit is contained in:
Markus Lembke 2025-03-31 22:16:46 +02:00 • committed by GitHub
parent a44758a4c8
commit 3f00018817
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 6 deletions

View file

@ -87,4 +87,10 @@ type Port struct {
EvPresent int `json:"ev_present,string"`
Charging int `json:",string"`
GridCurrentLimit float64 `json:"grid_current_limit,string"`
RFID struct {
Type string `json:"type"`
Available string `json:"available"`
Authorizereq string `json:"authorizereq"`
AuthorizationRequest []string `json:"authorization_request,string"`
} `json:"rfid"`
}

View file

@ -266,12 +266,16 @@ func (wb *Salia) currents() (float64, float64, float64, error) {
return i.L1.Actual / 1e3, i.L2.Actual / 1e3, i.L3.Actual / 1e3, err
}
// var _ api.Identifier = (*Salia)(nil)
// // Identify implements the api.Identifier interface
// func (wb *Salia) Identify() (string, error) {
// return "", api.ErrNotAvailable
// }
func (wb *Salia) Identify() (string, error) {
res, err := wb.apiG.Get()
if err != nil {
return "", err
}
if req := res.Secc.Port0.RFID.AuthorizationRequest; len(req) == 2 && req[1] != "" {
return req[1], nil
}
return "", api.ErrNotAvailable
}
func (wb *Salia) getPhases() (int, error) {
res, err := wb.apiG.Get()