hardybarth-salia: add rfid identifier (#20255)
This commit is contained in:
parent
a44758a4c8
commit
3f00018817
2 changed files with 16 additions and 6 deletions
|
|
@ -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"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue