- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Hello Everyone
Is it possible to run a script when a specific plan opens?
I have a plan with some results to show, but instead of using the resident script, I think to use an event-based script that runs when the plan opens.
How I can do this
any idea?
Best Regards,
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Hi,
You can do that with custom Javascript
$(function(){
$('body').on('showplan', function(e, id) {
if(id == 1){
grp.write('1/0/0', true);
}
});
});
Attach your script to 1/0/0 as event based
BR,
Erwin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Hi,
You can do that with custom Javascript
$(function(){
$('body').on('showplan', function(e, id) {
if(id == 1){
grp.write('1/0/0', true);
}
});
});
Attach your script to 1/0/0 as event based
BR,
Erwin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Goto Configurator -> Scripting -> Tools -> Edit Custom JavaScript and past the code in there, reload the browser so the client gets the JS loaded.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Thank you @Erwin-vd-Zwart
Does this Script run for any plan?
I past the script there but the address 0/0/1 didn't change when I open a plan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
No, current sample is plan ID 1 if(id == 1), change 1 to your actual plan where you want to activate the LUA script from
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
hello @Erwin-vd-Zwart
IF I want to use this script for Widgets what should I change?
I try: $('body').on('showwidget', function(e, id) {
but seems not right.
regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Hi,
There is no build-in event for detecting an open widget, but you can use this to achieve what you want:
$(function(){
var OutputAddr = '32/1/1'
var OpenWidget = 0;
setInterval(function() {
var WidgetNumber = 0;
$('.layer-widget').each(function( index, element ) {
if ( $(this).is(':visible') == true) {
fields = $(this)[0].id.split(/-/);
WidgetNumber = Number(fields[1]);
}
});
if (WidgetNumber > 0 && OpenWidget != WidgetNumber){
OpenWidget = WidgetNumber;
grp.update(OutputAddr, WidgetNumber);
//console.log(WidgetNumber);
}
if (WidgetNumber == 0 && OpenWidget != WidgetNumber){
OpenWidget = WidgetNumber;
grp.update(OutputAddr, WidgetNumber);
//console.log(WidgetNumber);
}
}, 1000);
});
This writes the widget number to an object, you can add a event script to this object and add a LUA script like this:
if event.getvalue() == 3 then -- run when widget 3 is open
-- do your action
end
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
thanks @Erwin-vd-Zwart
perfect 🙂
This Script gives me the Widget ID when it's Open and 0 when closed Right?
I should only enter the address
regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Hello @Erwin-vd-Zwart
I've noticed that both JS stop working after Firmware update.
now I am using the last Version 2.8.0
Could you help in this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
I just tested both on 2.8.0 and they still work.. Do you have any errors in the console (F12)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.

