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
#8
(07.12.2020, 07:18)admin Wrote: 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)
Hello 
To run this code in different machine one should change
Name: which is the plan name?
icon_on, icon_off, icon_touch: script created Icon, and the icon name should be in my machine
object, statusobject! I don't understand what are these
what else should be changed?
regards
Best Regards,
Reply


Messages In This Thread
Create visualisation from script - by MantasJ - 25.11.2020, 20:53
RE: Create visualisation from script - by khalil - 17.03.2021, 08:45

Forum Jump: