How does one download data now for real time


Title says it all really, fed up of seeing 0 on home page

How does one download data now for real time display on website, was working when opensensors but not now


Hi @smokie, probably the easiest way to get what you’re looking for is to go to and fill out the form to get emailed with CSV data. You can then either plot that in your own tools, or you can drop the CSV file into the web tool we put up here at

If you want to see real-time data plotted in the browser with a bit less flexibility, you should use https://, log into that using Google Chrome (only browser supported right now, but we’re working on changing that).

If you haven’t already, you’ll need to Claim Your Egg. Under the side menu ‘hamburger’ in the upper left, click Explore Eggs, then click on the “My Eggs” segment in the middle top of the page, and then click on the big green plus sign in the lower right corner and enter the serial number and claim code. If it doesn’t show up under my Eggs, you may need to restart the browser and/or log out and back in (again we are working on fixes). Once it’s listed under “My Eggs” you can click on the Egg’s icon, and in the upper right hand corner of the page you can find an icon that looks like a heartbeat. Click it and you’ll see real-time graphs for that Egg. Clicking on “Change Duration” in the upper right hand corner on that page will let you change the time scale from 15 minutes to a week.

We’re hard at work making this whole experience a bit more streamlined, but one of those two methods should get you where you want to be.

If you want to integrate data onto your own website, currently I have created a lightweight API, and access to it is basically by request. You can read the docs at, and just let me know by emailing support at wickeddevice dot com if you are interested in that.


OK, had a quick look baffled by this jwt Authorization vicatcu


Would like to explore with you how to make it more accessible. Do you have any suggestions?


An easy set up guide or perhaps a widget we could put on web site would be great


Sorry for the long cycle in replying. You can think of JWT as a way to get an new “API key” (called a token in this context) on request using your username and password, and once you get one it’s good for a period of time. If you get an “Unauthorized” response from an API request, it generally means it’s time to request a fresh token. I want to lower the barrier to entry for this stuff, but it’s a balancing act of not compromising security and resiliency goals in the process.

Perhaps you can point me to an example of some other service that does what you want well so I can take a look at emulating / taking inspiration from a good approach rather than trying to invent it from soup to nuts?


Do you have any sample php code to retrieve data using JWT, I’m stuck

3rd attempt email keeps bounced back


Sure, I have some PHP experience and can try and help with that. Will have to wait till later today or tomorrow though. I can also just private message you your JWT token to get you started.


Vicatcu, Made some progress today, got JWT working and data out using start and end dates, is it possible to just get last uploaded MQTT rather than a whole day or am I missing something


Ya, I think I can probably come up with a way to do that… stay tuned.


OK, cool … so I think I should be able to provide a specialized route for this relatively easily. I’ve made some adjustments to the data flows on the back end so that for each Egg I always have a representation of the last data that was sent by it for any particular sensor key. So the object you’ll get back is something like:

    "serial-number": "egg0080...",
    "temperature": { 
       "date": "ISO-8601 formatted timestamp like 2018-04-19T18:34:23Z"
       // ... normal temperature payload ... 
    // ... etc. keys and payloads for any other sensors being reported by the egg ...

And for the route, I was thinking something like

Sound OK to you @smokie? I suspect I could have that running quite soon. I’ll report back.


@smokie OK I think that’s actually working, let me know if it “answers the mail” or if you have ideas on how to make it more useful / usable. Cheers!


Note, in case it impacts / impacted you, I just fixed it so it names the key “date” rather than “timestamp.”


Yes, it works fine, just what i wanted, got to do some scripting to put readings online at the weekend.

When i first tried it kept coming back, not found, but is working now


Done it, Online , check out my website, CO still shows zero

Which should I use “converted-value” or “compensated-value”, using converted-value

This might be a more difficult question, is it possible to include graphs on website to ?

Included link back to you as well


Awesome, well done! Recommend using compensated-value generally. “Converted” value is mostly of diagnostic interest. I can certainly work on a graph image delivering API call, but that’s going to some work. Let me get back to you next week.

Zero may mean need to recalibrate / adjust baseline tables. You can use command “co_negz 0” (then “exit” and wait for Egg to connect to server before resetting) in Config Mode to allow the Egg to report negative values to get any idea how far its drifted negative. I want to update desktop application to let you adjust ppb of gas sensors, but knowing how much to adjust by is a pre-requisite. Topic for a different thread.

Also link to your website here so others can see?


Website Link,

Have changed to compensated-value

For others, just to get you started here’s my php code to get last message and save, then display code. I am only a novice so I’m sure it can be done better

 $cacheName="/home/xxxx/public_html/xxx/egg-cache.json"; // set to your website
 $jwt='your jwt token here';
// egg api call
 $url = '  egg number '; // *** most recent mqtt upload

 $result=jwt_request($jwt, $url); // call function

// save for display
 file_put_contents($cacheName, $result);	

 function jwt_request($token, $ur) {

	$ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $ur);                         // connect to provided URL

    curl_setopt($ch, CURLOPT_USERAGENT,  'Mozilla/5.0 (egg-fetch.php -');
       $authorization = "Authorization: Bearer ".$token; // **Prepare Autorisation Token**

    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization )); // **Inject Token into Header**
    curl_setopt( $ch, CURLOPT_COOKIEFILE, 'cookiefile' );
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $numberOfSeconds);  //  connection timeout
    curl_setopt($ch, CURLOPT_TIMEOUT, $numberOfSeconds);         //  data timeout
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);              // return the data transfer

    curl_setopt($ch, CURLOPT_HEADER, 0);      // No headers returned with result
    $result = curl_exec($ch);
    //  $response = curl_getinfo( $ch );
    return $result;

 // fetch is called by cron

 // display is done by loading file

 $jsondata = file_get_contents($eggfile);
 $data = json_decode($jsondata, true);

 echo $data['no2']['compensated-value'];


Hello @vicatcu,
I have a error, can you help me please. This is my code:

$jwt= getToken();
$url = ‘ serial here’; // *** most recent mqtt upload
$result=getData($jwt, $url);

if($result== false){
echo 'Curl error: ’ . curl_error($ch);
echo $result;

//echo ($authorization = "Authorization: Bearer ".$jwt); //Prepare Autorisation Token

function getToken(){
$data = array(“name” => “my username”, “password” => “my password”);
$data_string = json_encode($data);
$ch = curl_init(‘’);
curl_setopt($ch, CURLOPT_TIMEOUT, 10); //timeout after 10 seconds
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
‘Content-Type: application/json’,
'Content-Length: ’ . strlen($data_string))
$result = curl_exec($ch);
if($result== false){
$jwt = 'Curl error: ’ . curl_error($ch);
$data = json_decode($result, true); //Convert array in Json to Array in PHP
$jwt = $data[‘jwt’]; //print jwt value;
return $jwt;

function getData($token, $ur) {
$numberOfSeconds = “10”;
$ch = curl_init();
$authorization = "Authorization: Bearer ".$token; //Prepare Autorisation Token
curl_setopt($ch, CURLOPT_URL, $ur);
curl_setopt($ch, CURLOPT_USERAGENT, ‘Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0’);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’, $authorization )); //Inject Token into Header
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $numberOfSeconds); // connection timeout
curl_setopt($ch, CURLOPT_TIMEOUT, $numberOfSeconds); //data timeout
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //return the data transfer
curl_setopt($ch, CURLOPT_HEADER, 0); //No headers returned with result
$result = curl_exec($ch);
return $result;

When I run my code, function getToken() is very well. But function getData() have a error ({“error”:“my usernam is not authorized for mqtt path /most-recent/messages/device/my serial here”} )


@ngsangmt You have to have claimed the Egg you are requesting data for with the account whose credentials you are using to make the request, or you have to have to have a subscription account that grants you authorization to download data from any Egg. Please email support at airqualityegg dot com if you believe you fall into one of these categories and are receiving the unauthorized message in error, or if you have more specific questions.


Just following up here to close the loop. @ngsangmt I fixed a small bug on the server that was impacting you, and it should be all set now. Thanks again for bringing it to my attention.