Skip to content

Read a Grocy battery

GET
/api/v1/lookup/grocy/batteries/{battery_id}
curl --request GET \
--url https://example.com/api/v1/lookup/grocy/batteries/example \
--header 'X-Label-Hub-Key: <X-Label-Hub-Key>'

Name, description, last and next charging and the number of charge cycles of one Grocy battery, for the page a scanned battery code opens. Same access and errors as the product lookup: 404 when Grocy has no such battery, 503 when Grocy is not set up, 502 when it fails.

battery_id
required
Battery Id

The numeric Grocy id

string
/^[0-9]{1,18}$/

The numeric Grocy id

Successful Response

Media typeapplication/json
GrocyBatteryResult

What Grocy knows about one battery.

object
charge_cycles
Charge Cycles

How often it was charged so far

integer
0
description
Description

The description, when one is set

Any of:
string
id
required
Id

The battery id

string
last_charged
Last Charged

When it was last charged. Grocy’s local time, without a time zone offset; null when Grocy has no such date.

Any of:
string format: date-time
name
required
Name

The battery’s name

string
next_estimated_charge
Next Estimated Charge

When it is estimated to need charging next; null without interval. Grocy’s local time, without a time zone offset; null when Grocy has no such date.

Any of:
string format: date-time
url
Url

The battery’s page in Grocy’s web UI

Any of:
string

Example

{
"charge_cycles": 0
}

The request names an integration this hub does not have.

The integration failed or its upstream could not be reached.