Avoid treating empty charge mode as off (#333)
This commit is contained in:
parent
5882644fff
commit
f98fc8148d
2 changed files with 4 additions and 2 deletions
|
|
@ -11,7 +11,9 @@ func ChargeModeString(mode string) ChargeMode {
|
|||
return ModeMinPV
|
||||
case string(ModePV):
|
||||
return ModePV
|
||||
default:
|
||||
case string(ModeOff):
|
||||
return ModeOff
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ func ChargeModeHandler(loadpoint loadpoint) http.HandlerFunc {
|
|||
|
||||
modeS, ok := vars["mode"]
|
||||
mode := api.ChargeModeString(modeS)
|
||||
if string(mode) != modeS || !ok {
|
||||
if mode == "" || string(mode) != modeS || !ok {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue