Scene code changed after editting

Hi I have some lua code in a scene which runs fine

[code]local http=require’socket.http’
local OW_urltemplate = “
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))
function getnextract_temp(owid)
local url = string.format(OW_urltemplate, owid)
local tdata, retcode = http.request(url)
return tonumber(string.sub(tdata,startpos,startpos+11))

for x=1,5 do
mytemp = round2(getnextract_temp(senseids[x]),2)
luup.variable_set(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, mytemp , devid[x])

If I go in and edit the scene and look at the code this line
is always changed to

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



Yes, I can duplicate this. using:


which gets translated to:

x = "temperature12"

The HTML request to create the scene is:


which, when url-decoded reads:

{"timers":[],"triggers":[],"groups":[{"delay":0,"actions":[]}],"name":"HTML test","lua":"x = \"temperature12</B></TD><TD>\"\n","room":0,"modeStatus":"0","paused":0}

This is correct, so the error seems to be in openLuup.

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.



Ah, interesting! I hadn’t appreciated that subtlety. I will have to did deeper. Would be good to try this on a Vera.

Yes I just tried it on the Vera and the same thing happens it loses the


when you go in and re-edit it (didnt run the scene though)

Edit: btw using the vera scene editor doesnt lose the code between edit

Ah well, that IS an AltUI issue, then.

Must be a scene read error in the code somewhere (probably a string matching problem.) Help @amg0!

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

EDIT : you can try the beta in GitHub - amg0/ALTUI: Enhancement Interface for VERA home automation system

Yes, works great. Thanks!