This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Create visualisation from script
#5
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:
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)
Reply


Messages In This Thread
Create visualisation from script - by MantasJ - 25.11.2020, 20:53
RE: Create visualisation from script - by admin - 07.12.2020, 07:18

Forum Jump: