I am trying to create a webpage, hosted in an Apache server (with PHP and mySQL) on the Raspberry, where I can see the values of my Fibaro Flood Sensor, more or less like an interface. Following an old post on this forum and Mr. Hekkers blog, I am currently executing a .js file in my z-way-server with the following code:
Code: Select all
var callback = function(type,arg) {
try {
var options = {};
// timestamp
var ts = (new Date()).getTime();
ts = Math.floor(ts/1000).toString();
// query local ZWave API
options.url = "http://192.168.1.50:8083/ZWaveAPI/Run/devices[2].instances[0].commandClasses[156].data[5].sensorState.value"+ts; //sensor value
options.method = "GET";
var res = http.request(options);
// send response to webpage
options.url = "http://192.168.1.50:80"; // my Apache server on the Raspberry
options.method = "POST";
options.data = JSON.stringify(res);
res = http.request(options);
} catch(err) {
debugPrint("Failed to upload device state changes to webpage: " + err);
}
};
for (var dv in zway.devices) {
var dv = zway.devices[dv];
dv.data.bind(callback, null, true);
}
Any info would be really appreciated, as I am really blocked right now.
Thank you very much and sorry if this is not the correct place to ask.
EDITED to add code tags