Skip to content

REST: Add batterymode-endpoint #750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"format": "prettier --write . && node src/sortOpenAPI.js",
"format": "prettier --write . && npm run sort",
"sort": "node src/sortOpenAPI.js",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids"
},
Expand Down
47 changes: 47 additions & 0 deletions static/rest-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,26 @@ paths:
responses:
"200":
$ref: "#/components/responses/NumberResult"
/batterymode:
delete:
summary: Disable external battery control
description: Default evcc control behavior is restored
tags:
- Home Battery
responses:
"200":
$ref: "#/components/responses/BatteryModeResult"
/batterymode/{batteryMode}:
post:
summary: Set external battery mode
description: Directly controls the mode of all controllable batteries. evcc behavior like "price limit" or "prevent discharge while fast charging" is overruled. External mode resets after 60s. The external system has to call this endpoint regularly.
tags:
- Home Battery
parameters:
- $ref: "#/components/parameters/batteryMode"
responses:
"200":
$ref: "#/components/responses/BatteryModeResult"
/buffersoc/{soc}:
post:
summary: Set battery buffer SoC
Expand Down Expand Up @@ -966,6 +986,15 @@ paths:
$ref: "#/components/schemas/StaticSocPlan"
components:
schemas:
BatteryMode:
description: TODO
type: string
example: normal
enum:
- unknown
- normal
- hold
- charge
ChangePassword:
type: object
properties:
Expand Down Expand Up @@ -1335,6 +1364,12 @@ components:
required: true
schema:
$ref: "#/components/schemas/Power"
batteryMode:
name: batteryMode
in: path
required: true
schema:
$ref: "#/components/schemas/BatteryMode"
costLimit:
name: cost
description: Cost limit in configured currency (default EUR) or CO2 limit in g/kWh
Expand Down Expand Up @@ -1445,6 +1480,18 @@ components:
type: string
enum:
- Unauthorized
BatteryModeResult:
content:
application/json:
schema:
type: object
properties:
result:
type: integer
description: |
Battery mode. 0: unknown, 1: normal, 2: hold, 3: charge
minimum: 0
maximum: 3
securitySchemes:
cookieAuth:
type: apiKey
Expand Down