Can anyone help with this script? Thermostat temp send to Domoticz

Gents and Ladies,

I thought it was about time I learned a bit more about Lua and played around a bit more with scripting.

I’ve created a virtual temp sensor on Domoticz and I have tested sending the values to it, this works correctly using the following from “test lua” and from a scene.

local url = require(“socket.url”)
luup.inet.wget(“http://192.168.1.66:8080/json.htm?type=command&param=udevice&idx=3&nvalue=0&svalue=15”)

Now the Thermostat I want to take the current temp from is Vera device 49 (alt id for zwave 6).

I though I could use this code to extract the temp;

local CurrentTemp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, 49)

The problem seems to be when I combine the two I am sending Zero, I guess I am reading Zero from the thermostat.

local CurrentTemp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, 49)

local url = require(“socket.url”)
luup.inet.wget(“http://192.168.1.66:8080/json.htm?type=command&param=udevice&idx=3&nvalue=0&svalue=[b]CurrentTemp[/b]”)

When I check the value in the device variables or check the value read into PLEG i was seeing a temp of 18.6 deg.

Can anyone see what I’m doing wrong?

For reference I use this code to read a temp from another sensor (child device) into a different thermostat and it works.

local CurrentTemp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, 256)
luup.variable_set(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, CurrentTemp, 225)

Hi,
Does this work?
luup.inet.wget(“http://192.168.1.66:8080/json.htm?type=command&param=udevice&idx=3&nvalue=0&svalue=”…CurrentTemp)

Cheers Rene

Not sure about the syntax of your application but I had to put the following code if front:

local status,

This gets the current temp from my Oregon weather station. I think status is 0 or -1 for pass/fail and seems to be required.

local status, tmp = luup.inet.wget(“http://xxx.xxx.x.xxx:3480/data_request?id=variableget&DeviceNum=xx&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature”)

Mark

[quote=“reneboer, post:2, topic:195024”]Hi,
Does this work?
luup.inet.wget(“http://192.168.1.66:8080/json.htm?type=command&param=udevice&idx=3&nvalue=0&svalue=”…CurrentTemp)

Cheers Rene[/quote]

Thanks for your assistance guys.
[b]
local CurrentTemp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, 49)

luup.inet.wget(“http://192.168.1.66:8080/json.htm?type=command&param=udevice&idx=3&nvalue=0&svalue=”…CurrentTemp)[/b]

this worked.

Now I just have to figure out why so I can work it out myself in future!