|  Developer
Updated on May 17, 2022

modify_item()

  • Modify existing item fields. (only for migration)
Edit

  • params: item_id, item (table).
fields type description
device_id string an id of a device the item is being registering for
name string a type of the item
value_type string [int : bool : float : string : rgb : scalable : userCode : buttonState : token : dictionary.#subtype : array.#subtype] a type of an item’s value
has_getter bool whether the item provides an ability to get a value
has_setter bool whether the item provides an ability to set a value
show bool whether the item should be shown on UI
enum table [opt] set of values for value type ‘token’
value int : bool : float : string : rgb : scalable : userCode : buttonState : token : dictionary.#subtype : array.#subtype an item’s value
value_min int : float : scalable [opt] lower limit of item’s value
value_max int : float : scalable [opt] upper limit of item’s value
elementsMaxNumber int max allowed elements of a dictionary or an array value
stringRestriction string Regexp restriction for a value in item of value type
userCodeRestriction string Regexp restriction for a field in any value of value type. E.g. it’s used in item .
userCodeModes array of strings List of available pin code modes. It’s used in item.
elementsMaxNumberPerArray int max allowed elements of each array ( if array is subtype of dictionary or another array )
oneWeekDayCost int cost of one week day in item
oneShiftedWeekDayCost int cost of one shifted (startTime > stopTime) week day in item
  • return: none.
  • All item fields can be modified using this method.
Edit
				
					require "core"

local item = core.modify_item( item_id, { device_id = device_id, ... } )