modify_device()
- Modify existing device fields. (only for migration)
Edit
- params: device_id, device (table).
fields | type | description |
---|---|---|
gateway_id | string | [deprecated] an id of a gateway the device is being registering for |
name | string | a name displayed by the UI |
category | string | a device category |
subcategory | string | a device subcategory |
type | string | |
device_type_id | string | |
room_id | string | [opt] an id of a room this device belongs to |
parent_device_id | string | [opt] id of parent device |
info | [opt] some additional information for this device | |
battery_powered | bool | whether the device is battery powered |
reachable | bool | [opt] whether the device is reachable |
persistent | bool | [opt] whether the device is persistent. False by default. |
security | string | [opt] Security level how the device is connected. Possible options: , , , . by default. |
ready | bool | [opt] Ready status of device. value means device is ready to any changes. value means device is busy. |
status | string | [opt] a device status |
house_modes_options | object | [opt] Information about a device settings in preset house modes. |
parentRoom | bool | [opt] Defines the behavior of a child device when the parent device is moved to another room. If true, it should follow the parent device. If false, it can be placed in a separate room. This property is available only for child devices. The default value is true |
- params: device_id, device (table).
Fields that will be modified |
---|
category |
subcategory |
type |
security |
name |
parent_device_id |
info |
house_modes_options |
Possible info value | Required | Description |
---|---|---|
manufacturer | + | Name of device manufacturer |
model | + | Name of device model |
firmware | Firmware version | |
hardware | Hardware version |
Note: If parent_device_id is set to a child device id, then the return value would be nil and no device will be created.
Edit
Edit
require "core"
local gateway = core.get_gateway()
local device = core.modify_device( device_id, { gateway_id = gateway.id, ... } )
Edit
require "core"
local gateway = core.get_gateway()
local sirenDevice = core.modify_device( siren_device_id, { house_modes_options = { alarms_off = {"1", "2", "3", "4" } }, ... } )
local motionSensorDevice = core.modify_device( motion_sensor_id, { house_modes_options = { disarmed = {"1", "3"} }, ... } )