Hi,
I’m new with Vera and Lua.
I have VerEdge with Fabiro Universal Sensor.
I’ve attached 3 x Temperature Sensors to the Universal Sensor.
I need to log the temperatures and send them to another server for processing…
The completed string need to look like this:
http://server_ip:socket/SignalTower/jsp/custom/ob/addEvent.jsp?deviceType=OWC&rawData=XXXXXXXXXXXXXXXXXXXXXVRE000011820200001E%2020160728 210748%2015.25%20%20%20%20%20%20%20%20%20%20?C%20%20%2050%20
I can confirm that this string call works.
I was able to test bits an pieces of the code using: Lua: demo
But I have not been able to test the actual retrieving of the Value, and the HTTP request I can only do on Vera.
My Vera Scene runs “Success”, but I don’t get the data on the server.
Please let me know if there is a mistake in the code, or if there is another way I can debug my code.
Here is my code:
//---------------------------
local device = 29
local prefix = [[XXXXXXXXXXXXXXXXXXXXX]]
local accountcode = [[VRE00001]]
local alarmcode = ‘202’
local zone = ‘001’
local datetime = os.date(“%Y%m%d %H%m%S”)
local qualifier = ‘E%20’
local partition = ‘00’
local value = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor:1”,“CurrentTemperature”, device)
local units = [[?C%20%20%20]]
local signal = ‘50%20’
local page = [[http://server_ip:socket/SignalTower/jsp/custom/ob/addEvent.jsp?deviceType=OWC&rawData=]]
require(‘ltn12’)
local http = require(‘socket.http’)
socket.http.TIMEOUT = 5
local response_body = {}
local request_body = ‘’
local r, c, h = socket.http.request{
url = page…prefix…accountcode…‘18’…alarmcode…partition…zone…qualifier…datetime…‘%20’…value…units…signal,
method = “POST”,
headers = {
[“Content-Length”] = string.len(request_body),
[“Content-Type”] = “application/x-www-form-urlencoded”
}}[/color]
//---------------------------
I was able to test must of the code using:
http://www.lua.org/cgi-bin/demo
I’ve not bee able to test the following:
-
Retrieving the value of the sensor:
local value = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor:1”,“CurrentTemperature”, device) -
HTTP request:
require(‘ltn12’)
local http = require(‘socket.http’)
socket.http.TIMEOUT = 5
local response_body = {}
local request_body = ‘’
local r, c, h = socket.http.request{
url = page…prefix…accountcode…‘18’…alarmcode…partition…zone…qualifier…datetime…‘%20’…value…units…signal,
method = “POST”,
headers = {
[“Content-Length”] = string.len(request_body),
[“Content-Type”] = “application/x-www-form-urlencoded”
}}[/color]