456339 (2) [Avatar] Offline
Hi, Wonderful book! I'll review it on amazon soon!

I'm trying to use Google Charts and Chart.js for my own webpage: embedded-iot.net and I'm trying to employ your function from chapter2-hello-wot/client/ex-2.2-polling-temp-char

function doPoll() { //#F
function (result) {
addDataPoint(result); //#G
setTimeout(doPoll, 2000);

however, when I go to : http://devices.webofthings.io/pi/sensors/temperature/value I don't see where on that web page you are picking up the temperature value from?

My goal is to post from the ESP8266 (as I have done to google sheets with GScript, and my own webpage using a PhP script) but I don't see how the temperature is appearing anywhere on http://devices.webofthings.io/pi/sensors/temperature/value to be received by "chapter2-hello-wot/client/ex-2.2-polling-temp-char."

Please let me know where on the aforementioned web page the temperature is incoming from so that I can try my own charts with your temperature and then send my own data from the device-side to chart and graph.

thanks for any info
domguinard (69) [Avatar] Offline

First: very cool domain name! Congrats for grabbing embedded-iot.net!

Then, for your question. I'd suggest you have a second look at section 6.1.4 in the book: it will tell you all about content-negotiation, or the way to get different formats for a resource.


gets the temperature resource in JSON, when you go to http://devices.webofthings.io/pi/sensors/temperature/value with your browser you request it in HTML. To see the actual value in HTML try going to: http://devices.webofthings.io/pi/sensors/temperature which is the actual address of the temperature resource (/value is just a shortcut to get *only* the value).

Hope this helps, good luck with your site!
456339 (2) [Avatar] Offline
Hi Dominic,

thanks for your replie but I still dont get it.

On page view-source:http://devices.webofthings.io/pi/sensors/temperature/value/

there is no actual numeric incoming value from the RPi anywhere on the page from which to take information from

then on page view-source:http://devices.webofthings.io/pi/sensors/temperature/

the "recorded at" an sensor temp value are dynamically changing but I don't see anywhere in the code that is making this dynamically change. I'm confused where temp value is being recorded from and what code is making the second page dynamically update.

domguinard (69) [Avatar] Offline

The page: http://devices.webofthings.io/pi/sensors/temperature/ is actually generated on the server of the Pi and sent to your browser with the latest temperature value. If you want to build a page that fetches this you have to use Javascript and dynamically get the value from the API of the Pi.

For instance the following snippet gets the value and displays it in a popup:

function (result) { 

Hope that helps,