Battery Drain monitor

Hello,

I want to know that can we retrieve battery drain from beacon.when i was mapping beacon through estimote app that time i saw that it was showing battery life 8month, 13months something like that. can we retrieve battery drain details from beacon. If yes please let me know How can we retrieve ?

Thanks

You could retrieve the latest estimation of your beacons’ battery life from our Cloud API:

http://cloud.estimote.com/docs/

Alternatively, our new Location Beacons can broadcast the remaining battery life estimate directly in the Estimote Telemetry packet, so you could read that directly off of it. (But you need to be in range of a beacon then.)

How do you want to use the battery life information?

curl -u YOUR_APP_ID:YOUR_APP_TOKEN \
    -H 'Accept: application/json' https://cloud.estimote.com/v1/beacons

In the JSON that follows, look for the battery_life_expectancy_in_days.

You can generate an App ID and Token for your app here:

https://cloud.estimote.com/#/apps/add/your-own-app

You can make an HTTP request to our Cloud API from your app. There should be quite a lot of tutorials about how to do that out there (:

What platform/language do you want to build this with? iOS, Android, Ruby, Python? I’ll find an appropriate tutorial.

You can simply parse the JSON response and extract only the data you need:

http://php.net/manual/en/function.json-decode.php

Try this:

$ch = curl init();
curl_setopt($ch, CURLOPT_URL, "https://cloud.estimote.com/v1/beacons");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "achopra-smu-edu-sg-s-your--iuw:10e891270177480e7443148908d0afa3");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/json"));
$output = curl_exec($ch);
curl_close($ch);

i tried this but this is not working if i’m combining this with php just adding php format.

You’re doing the JSON decoding wrong, here’s how:

$output = curl_exec($ch);

$json = json_decode($output);
var_dump($json);

Ooops, just realized I made a mistake above.

var_dump(json_decode($json));

needs to be:

var_dump($json);

This should give you an idea what $json looks like after all this, and how to access the major or battery level data.