07.12.2020, 07:18
1. Check Errog log for errors because your code has correct syntax but running it will produce an error
2. Log the return value of the insert function call. Otherwise you won't know why insert does not happen
3. As I've already mentioned do not specify ID because it must be unique. The database will set it automatically if ID is not specified
4. type value is missing, this will cause the visualization to stop working completely
Try this:
2. Log the return value of the insert function call. Otherwise you won't know why insert does not happen
3. As I've already mentioned do not specify ID because it must be unique. The database will set it automatically if ID is not specified
4. type value is missing, this will cause the visualization to stop working completely
Try this:
Code:
require('json')
res, err = db:insert('visobjects', {
object = 2305,
statusobject = 2405,
type = 0,
floor = 851,
locx = 35,
locy = 107,
nobg = 1,
notouch = 0,
readonly = 0,
sortorder = 1,
statusobject = 2405,
name = 'Electro-válvula Corte Agua',
params = json.encode({
size = 12,
bold = 0,
italic = 0,
underline = 0,
width = 56,
height = 56,
icon_on = 'Electrovalvula_activada.png',
icon_off = 'Electrovalvula.png',
icon_touch = 'Electrovalvula.png',
displaymode = 'icon-value',
showcontrol = 0,
update = false,
widget = json.null,
backdrop = 0
}),
})
log(res, err)