Somehow i’m in
with old school stuff and this Nokia LCD is cute and compact!
I have everything hooked up and its working well so the next step is to figure out the webhooks setup so that I can pull in the Air-quality index and view it easily!
Here’s the github repo: https://github.com/kennethlimcp/nokia-iot
5 Likes
So i am trying to extract the data from the dataset here:
<channel>
<title>PM2.5 Update</title>
<source>Airviro</source>
<item>
<region>
<id>rNO</id>
<latitude>1.41803</latitude>
<longitude>103.82000</longitude>
<record timestamp="20150919220000">
<reading type="PM25_RGN_1HR" value="42"/>
</record>
</region>
<region>
<id>rCE</id>
<latitude>1.35735</latitude>
<longitude>103.82000</longitude>
<record timestamp="20150919220000">
<reading type="PM25_RGN_1HR" value="43"/>
</record>
</region>
<region>
<id>rEA</id>
<latitude>1.35735</latitude>
<longitude>103.94000</longitude>
<record timestamp="20150919220000">
<reading type="PM25_RGN_1HR" value="52"/>
</record>
</region>
<region>
<id>rWE</id>
<latitude>1.35735</latitude>
<longitude>103.70000</longitude>
<record timestamp="20150919220000">
<reading type="PM25_RGN_1HR" value="52"/>
</record>
</region>
<region>
<id>rSO</id>
<latitude>1.29587</latitude>
<longitude>103.82000</longitude>
<record timestamp="20150919220000">
<reading type="PM25_RGN_1HR" value="57"/>
</record>
</region>
</item>
</channel>
Using a simple .indexOf()
search function, i managed to extract information for rNO
and rEA
(2 hook response from webhook`) but the other 2 data set is missing due to the way i am processing the response.
Any suggestion on how i can extract them efficiently? 
I need the:
<id>rNO</id>
-
<reading type="PM25_RGN_1HR" value="42"/>
(only the number 42)
1 Like
breezometer.com has a free API that gives JSON responses so you could use a Response Template and filter down to the exact data you want. No need to extract, just tokenize and reuse the data to display on the screen. I am fan of this method because I am not so good with extract and it culls the data to minimum needed.
2 Likes
@LukeUSMC thanks cool!
But this dataset is from Singapore’s agency and it’s more accurate to the hour. I appreciate your inputs though! 
Fair enough. Here is a XML to JSON proxy service that you could route the call through… 
XML to JSON Proxy
Here is another using Google Feed API
XML to JSON using Google Feed API
1 Like
If you can’t tell…I am a HUGE fan of JSON and loath XML and the parsing mess it creates! One response, nothing but the data you want and no parsing. Doesn’t get much better than that!
2 Likes