30.03.2023, 05:55
Try this. Change title variable to the title of your scene widget (case sensitive). If you have multiple scenes with the same title then this script will run all such scenes.
Code:
title = 'my scene'
config = storage.exec('get', 'mosaic30:config:0')
config = require('json').decode(config)
function checkwidget(widget)
if widget.type ~= 'user_scene' then
return
elseif widget.title ~= title then
return
end
for addr, value in pairs(widget.settings.objects) do
grp.write(addr, value)
end
end
for _, floor in ipairs(config.floors or {}) do
for _, room in ipairs(floor.rooms or {}) do
for _, widget in ipairs(room.widgets or {}) do
checkwidget(widget)
end
end
end