> ## Documentation Index
> Fetch the complete documentation index at: https://developer.energy-hub.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get battery data

> Returns general data of a single battery.



## OpenAPI

````yaml get /v1.0.0/batteries/{batteryId}
openapi: 3.0.1
info:
  description: A service used for battery and pv inverter devices
  title: home-power-service
  version: 1.0.0
servers:
  - description: Generated server url
    url: https://api.energy-hub.io
security: []
paths:
  /v1.0.0/batteries/{batteryId}:
    get:
      tags:
        - Battery Controller
      summary: Get battery data
      description: Returns general data of a single battery.
      operationId: getSingleBattery
      parameters:
        - schema:
            format: uuid
            type: string
          in: path
          name: batteryId
          description: Battery ID
          required: true
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatteryResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessageDto'
              examples:
                UNAUTHORIZED:
                  $ref: '#/components/examples/UNAUTHORIZED'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessageDto'
              examples:
                BATTERY_NOT_FOUND:
                  $ref: '#/components/examples/BATTERY_NOT_FOUND'
      security:
        - API_Key: []
components:
  schemas:
    BatteryResponse:
      description: Object of battery response.
      type: object
      required:
        - id
        - isOnline
        - staticData
        - userId
      properties:
        lastUpdated:
          format: date-time
          description: The timestamp of the last update of any variable of the battery.
          type: string
        chargeState:
          $ref: '#/components/schemas/ChargeState'
        locationId:
          format: uuid
          description: The location ID of the battery.
          type: string
        isOnline:
          description: Indicates if the battery is reachable trough the vendor system.
          type: boolean
          example: true
        id:
          format: uuid
          description: The ID of the battery.
          type: string
        userId:
          description: The ID of the user.
          type: string
          example: 896f9d5a-b618-48a2-98ae-957059bf1bc9
        staticData:
          $ref: '#/components/schemas/BatteryStaticData'
    ErrorMessageDto:
      type: object
      required:
        - errorCode
        - id
        - message
      properties:
        errorCode:
          description: The error code
          type: string
          example: EXAMPLE_ERROR_CODE
        id:
          format: uuid
          description: The error identifier
          type: string
          example: 7958818d-64d2-4ede-b12b-4786dd2f348b
        message:
          description: The error message
          type: string
          example: Example error message
    ChargeState:
      description: Object of charge state data of a battery.
      type: object
      required:
        - lastUpdated
      properties:
        mode:
          description: The mode  of the battery.
          type: string
          enum:
            - AUTO
            - SELF_CONSUMPTION
            - EXPORT_FOCUS
            - MANUAL
        chargeRate:
          format: double
          description: >-
            The charge rate of the battery in kW. Values are negative during
            discharging and positive during charging of the battery.
          type: number
          example: 6.512
        lastUpdated:
          format: date-time
          description: The timestamp of the last update of the battery state data.
          type: string
        stateOfCharge:
          format: double
          description: The state of the charge of the battery in percent.
          type: number
          example: 72.25
        chargeLimitMin:
          format: double
          description: >-
            The minimum state of charge set by the user for the battery in
            percent.
          type: number
          example: 20.25
        chargeLimitMax:
          format: double
          description: >-
            The maximum state of charge set by the user for the battery in
            percent.
          type: number
          example: 80.25
        maxChargeRate:
          format: double
          description: The maximum charge rate of the battery in kW
          type: number
          example: 6
        maxDischargeRate:
          format: double
          description: The maximum discharge rate of the battery in kW
          type: number
          example: 6
        chargingState:
          description: The current charging state.
          type: string
          enum:
            - CHARGING
            - DISCHARGING
            - IDLE
            - FAULT
          example: CHARGING
    BatteryStaticData:
      description: Object of static data of a home energy device.
      type: object
      required:
        - lastUpdated
        - model
        - name
        - vendor
      properties:
        lastUpdated:
          format: date-time
          description: The timestamp of the last update of the static data.
          type: string
        vendor:
          description: The vendor of the home energy device.
          type: string
          enum:
            - FRONIUS
            - TESLA
            - HUAWEI
            - SMA
        name:
          description: The display name of the home energy device.
          type: string
          example: My device
        siteName:
          description: The site name of the home energy device.
          type: string
          example: My Home
        model:
          description: The model of the home energy device.
          type: string
          example: Charge
        batteryCapacity:
          format: double
          description: The capacity of battery in kWh.
          type: number
          example: 12.5
  examples:
    UNAUTHORIZED:
      value:
        errorCode: UNAUTHORIZED
        id: 57da008b-bd4d-442e-b8f8-584cb9058e29
        message: Unauthorized
    BATTERY_NOT_FOUND:
      value:
        errorCode: BATTERY_NOT_FOUND
        id: 57da008b-bd4d-442e-b8f8-584cb9058e29
        message: '[BATTERY] Battery not found'
  securitySchemes:
    API_Key:
      in: header
      name: X-API-KEY
      description: API key used for authorization and authentication.
      type: apiKey

````