Hi I have some lua code in a scene which runs fine
[code]local http=require’socket.http’
local OW_urltemplate = “http://192.168.2.252:3000/%s/temperature12”
local sensenames = {“Tank Top”, “Tank Middle”, “Tank Bottom”, “Cold Tank”, “Airing Cupboard” }
local senseids = {“28.CD54A3040000”, “28.EA5CA3040000”, “28.FE55A3040000”, “28.742AC3040000”,“28.B172A3040000” }
local devid = {33,34,35,36,37}
function round2(num, idp)
return tonumber(string.format(“%.” … (idp or 0) … “f”, num))
end
function getnextract_temp(owid)
local url = string.format(OW_urltemplate, owid)
local tdata, retcode = http.request(url)
startpos=string.find(tdata,“temperature12”)+26
return tonumber(string.sub(tdata,startpos,startpos+11))
end
for x=1,5 do
mytemp = round2(getnextract_temp(senseids[x]),2)
luup.variable_set(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, mytemp , devid[x])
end[/code]
If I go in and edit the scene and look at the code this line startpos=string.find(tdata,"temperature12</B></TD><TD>")+26
is always changed to startpos=string.find(tdata,"temperature12")+26
so If I edit the scene I always have to correct the line and submit - scene runs fine then (until the next time I edit it)
its not a major problem - I just have to remember to do it
This is running on a RPI openLuup vs v16.10.23 Altui vs v1.73.1947
Well it definitely saves it ok because the scene runs fine and populates the devices with the correct temperatures it only becomes a problem when you re-edit the scene and it doesnt matter if you open the LUA tab or not.
I think I know what it is, it is saved properly and it is at the time of display when you enter the editor that the html characters are removed. I ll have a fix in next release