Facility Control

 View Only
  • 1.  Projector Control

    Posted 04-10-2018 20:52
    I am new to scripting and scripting in Dashboard. I am looking for a way to control our projector power from Dashboard and need help. I can open up Putty and send commands via RAW but not having much luck with creating a button in Dashboard to power the projector on. I'm using the ogScript>Communication>Send TCP Messages (string). The projector ip is 10.108.16.111 and port 7000. The string to power on is *power = 1 and off is *power = 0. The projector does reply with ack power = 1 if turned on. If this could work, I would also love to find a way to run a loop of *power ? to give a power state indicator even if the projector is powered on via a remote. Something else I've noticed that sometimes has issues is data rate. It really wants 9600 baud and I don't know how to change that. I can change it in Putty and it works all the time but I don't know if there is a way in Dashboard.


  • 2.  RE: Projector Control

    Posted 04-12-2018 14:00
    Well thank to a previous post about Sharp TVs powering on and off I was able to get the PJ to power on and off. Now to create some kind of way of seeing the PJ power state. I'm getting really excited about exploring the big world of Dashboard and really creating intuitive custom stuff.
    #DashBoard


  • 3.  RE: Projector Control

    Posted 04-12-2018 18:57
    So an additional question to creating a way to see the power state of the projector, how can I modify the ViewControl layout to have 2 buttons be the power on and off for the projector?
    #DashBoard


  • 4.  RE: Projector Control

    Posted 04-15-2018 22:46
    If you want a label that indicates the power state, you will need to run a timer to poll the projector online status periodically and then update the label. I'm not sure which method you are using to talk to the projector, but rosstalk.sendmessage and ogscript.asyncpost both support callback functions that are called when a reply is sent. If you can read the response of the projector with a callback function, you can check if it says "ack" and then update the label. In addition to the timer method, you could also write a function that checks the status and updates the label, and call it anytime any other button (or buttons you create/select) are clicked on, just for extra updates. I've found, however, if I limit the path of device control (i.e. don't let people turn on projectors manually, etc.) that I can know the state of the projector fairly confidently because they're only using my code to turn them off/on.

    I don't think you can modify the ViewControl layout, but you could probably recreate a lot of it in your own custom panel and then add the extra buttons you need.

    Hope this helps! I am happy to be a resource for you if needed.

    Joseph
    #DashBoard


  • 5.  RE: Projector Control

    Posted 04-22-2018 12:30
    @josephadams thank you for the ideas. I very much understand the concept and all that. What I'm looking for is an example. I've been using the Visual Logic to build everything so far. It's been easy and a huge time saver. I just wanted to see if anyone had an example script or something. I can usually read scripts and translate it to the Visual Logic just don't know how to build from scratch.
    #DashBoard


  • 6.  RE: Projector Control

    Posted 04-23-2018 17:59
    function checkPowerStatus()
    {
         rosstalk.sendMessage(10.108.16.111, 7000, "power = 1", callbackFunction);
    }
    
    function callbackFunction(success, sentData, resultString, exception)
    {
         if (resultString == "ACK")
         {
              //code to update a button or parameter here
         }
    }

    If you set up a timer to run the checkPowerStatus function on a set interval, it can poll the projector and give a reply. If the "power = 1" string is also the command that turns the projector on (in addition to checking status), then you would want to make sure the timer does not begin until the projector has been intentionally powered on, or it would turn on every time the timer function runs.


    #DashBoard