Page 1 of 1
HTTP get, need also time
Posted: 02 Sep 2015 10:07
by lowilly
Hi, i've have turned on the app "Sensor Values Logging" on a Dummy device (it's a switch).
I send an httpget message to a server with this request
http://ip:5000/test/${id}?Valore=${value}
on server side i collect the message correctly
"GET /test/DummyDevice_9?Valore=off"
my question is, how can i also get the time?
i've tried a lot but nothing seems to work...
for example if i try
http://ip:5000/test/${id}?Valore=${value},Time=${time}
i get
"GET /test/DummyDevice_9?Valore=off,Time=${time}"
it seems it doesn't know the variable time...
how can i solve it??
Re: HTTP get, need also time
Posted: 02 Sep 2015 10:35
by pz1
You don't make it clear what you try to achieve. I don't understand why you start a log and do independently query the device in addition to that log.
Your app SensorValuesLogging streams the data with timestamp to a file in /opt/z-way-server/automation storage.
Below is an example for a powermeter log that I have:
Code: Select all
{"deviceId":"ZWayVDev_zway_31-0-49-4","deviceName":"Sensor Power 31-0-49-4","sensorData":[{"time":1439648424794,"value":1.5}, etc, etc
Re: HTTP get, need also time
Posted: 02 Sep 2015 12:53
by lowilly
hi pz1, thank you for the answer...I try to make my request more clear
i know that it stores the log in a local file but i want to use the "httpGet" method instead of the JSON file
This is my "Sensor Value Loggin" config page

the http requests are sent to a server listening on port 5000
those are the requests that the server catch

As you can see the server listen the "get request" and on this request there is the device id(DummyDevice_9) and also the value (on/off)
my question is, how can i also add the timestamp to the string of the get request so the server can extract the device id, value and time?
Re: HTTP get, need also time
Posted: 02 Sep 2015 13:34
by pz1
I never used the HTTPGET method. If I read the little helpfile I understand that the method is used to push your data to an external logging service. In your last screenshot I see that in your logs the timestamps are generated by the logger.
What is wrong with that one?
An alternative could be making an adaptation of the logging module, but that requires knowledge of Javascript, and a bit of insight of how Z-Way modules work.
Re: HTTP get, need also time
Posted: 04 Sep 2015 18:40
by remecz
Hi lowilly, currently it looks like the HTTPGET method only sends the device id and the sensor value. As pz1 suggested you could use a timestamp in your server or modify the logging module's code.