Logic Machine Forum
Jump to visualization page when ID is received - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Jump to visualization page when ID is received (/showthread.php?tid=2663)



Jump to visualization page when ID is received - jurmaster - 30.05.2020

Hey Everybody,

I can't get the example script :"Open IP camera visualization page when intercom call is received" working.
I also want to use this functionality for more triggers, so I was hoping for a script in which the visualisation ID is triggert.

So for example: http://IP-ADDRESS/scada-vis/#18   This triggers by sending "18" to an 2 byte unsigned integer.

Anybody who can help me?

Thanks!


RE: Jump to visualization page when ID is received - Erwin van der Zwart - 31.05.2020

Hi,

Here is a custom JS to do that:
Code:
$(function(){
  if (typeof grp != 'undefined') {
    grp.listen('1/1/1', function(object, state) {
      if (state == 'value') {
          showPlan(object.value);      
      }
    });
  }
});
BR,

Erwin


RE: Jump to visualization page when ID is received - jurmaster - 31.05.2020

(31.05.2020, 07:39)Erwin van der Zwart Wrote: Hi,

Here is a custom JS to do that:
Code:
$(function(){
  if (typeof grp != 'undefined') {
    grp.listen('1/1/1', function(object, state) {
      if (state == 'value') {
          showPlan(object.value);      
      }
    });
  }
});
BR,

Erwin
Hi Erwin,

Many thanks!  Works like a charme!
Added time out, so it hops back to startscreen (i defined).

if (plantimer){
        clearTimeout(plantimer)
        }
          plantimer=setTimeout(function(){
              showPlan(XX);
          }, 60000);
        }
      });


1.

(31.05.2020, 07:39)Erwin van der Zwart Wrote: Hi,

Here is a custom JS to do that:
Code:
$(function(){
  if (typeof grp != 'undefined') {
    grp.listen('1/1/1', function(object, state) {
      if (state == 'value') {
          showPlan(object.value);      
      }
    });
  }
});
BR,

Erwin
  Erwin,

1 question in addition to this. Can you also make the visualisation active?  I now use dimming. So the visulaisation is shown, but the screen is dimmed.


RE: Jump to visualization page when ID is received - Erwin van der Zwart - 31.05.2020

Hi,

Add this line to your code:
Code:
$('.modal-backdrop').addClass("hide");
BR,

Erwin


RE: Jump to visualization page when ID is received - jurmaster - 01.06.2020

(31.05.2020, 21:33)Erwin van der Zwart Wrote: Hi,

Add this line to your code:
Code:
$('.modal-backdrop').addClass("hide");
BR,

Erwin


Hi Erwin,
Thx again for the quick response, however I now find it difficult to apply in my code. Can you please help.

My code: 

var plantimer;
$(function(){

  if (typeof grp != 'undefined') {
 
      grp.listen('1/1/1', function(incomingEvent, eventType) {
        if (eventType == 'value') {
          switch(incomingEvent.value){
              case 1:
                  showPlan(11);
                  break;
              case 2:
                  showPlan(7);
                  break;
              case 3:
                  showPlan(38);
                  break;
          }
  if (plantimer){
        clearTimeout(plantimer)
        }
          plantimer=setTimeout(function(){
              showPlan(1);
          }, 60000);
        }
      });
 
    }
});


RE: Jump to visualization page when ID is received - admin - 01.06.2020

Just add it after each showPlan call where needed


RE: Jump to visualization page when ID is received - jurmaster - 01.06.2020

(01.06.2020, 09:49)admin Wrote: Just add it after each showPlan call where needed


Thx, it was the ";" I still had in there, why it did not work :-)