![]() |
|
Scene on Mosaic - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: OLD visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9) +--- Thread: Scene on Mosaic (/showthread.php?tid=4689) |
Scene on Mosaic - CristianAgata - 29.03.2023 Good afternoon, A simple info.... Is it possible create event script to run scene created in mosaic? Best regards Cristian RE: Scene on Mosaic - admin - 30.03.2023 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
endRE: Scene on Mosaic - CristianAgata - 30.03.2023 (30.03.2023, 05:55)admin Wrote: 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. Thanks admin, I will try and I let you know. Best regards Cristian RE: Scene on Mosaic - CristianAgata - 01.04.2023 (30.03.2023, 05:55)admin Wrote: 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. Hi admin, tested and it works, thank you so much. Could I suggest an improve? It could be interesting add some delay between a command and other. It could be useful for scene that interest TV command for example. BR Cristian |