Read a Grocy battery
GET
/api/v1/lookup/grocy/batteries/{battery_id}
const url = 'https://example.com/api/v1/lookup/grocy/batteries/example';const options = {method: 'GET', headers: {'X-Label-Hub-Key': '<X-Label-Hub-Key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”battery_id
required
Battery Id
The numeric Grocy id
string
The numeric Grocy id
Responses
Section titled “Responses”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
id
required
Id
The battery id
string
last_charged
name
required
Name
The battery’s name
string
next_estimated_charge
Example
{ "charge_cycles": 0}The request names an integration this hub does not have.
The integration failed or its upstream could not be reached.