summaryrefslogtreecommitdiffstats
path: root/provisioning-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'provisioning-model.lua')
-rw-r--r--provisioning-model.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/provisioning-model.lua b/provisioning-model.lua
index 3c4dfe7..2c54619 100644
--- a/provisioning-model.lua
+++ b/provisioning-model.lua
@@ -1257,7 +1257,7 @@ mymodule.update_group = function(self, group, action, create)
-- Update the devices after databasedisconnect so device failure doesn't rollback the change
if success then
- -- Notify the devices that their params might have changed
+ -- Notify the devices that their params might have changed (this will also validate)
for i,d in ipairs(devices) do
local r = set_device_params(get_device_params(d.device_id, false), false)
if r.errtxt then self.logevent("Failed to update params for device "..d.device_id..": "..r.errtxt) end
@@ -1442,7 +1442,7 @@ mymodule.update_param = function(self, param, action, create)
-- Update the devices after databasedisconnect so device failure doesn't rollback the change
if success then
- -- Notify the devices that their params might have changed
+ -- Notify the devices that their params might have changed (this will also validate)
for i,d in ipairs(devices) do
local r = set_device_params(get_device_params(d.device_id, false), false)
if r.errtxt then self.logevent("Failed to update params for device "..d.device_id..": "..r.errtxt) end
@@ -1648,8 +1648,14 @@ mymodule.update_device = function(self, device, action, create)
end
end
+ -- Notify the device that its params might have changed (this will also validate)
local s = saved_device_params[device.value.device_id.value]
- callscript(updatedevicescriptfile, device, saved_devices[device.value.device_id.value], get_device_params(device.value.device_id.value), s)
+ local r = set_device_params(get_device_params(device.value.device_id.value, false), false)
+ if r.errtxt then
+ error(r:print_errtxt())
+ end
+
+ callscript(updatedevicescriptfile, device, saved_devices[device.value.device_id.value], r, s)
saved_devices[device.value.device_id.value] = device
end