Results 1 to 9 of 9

Thread: Instance Switching

  1. #1

    Default Instance Switching

    am sure that this is possible, and I hope that you can help me. I am constructing an additional control network for a quadriplegic who already has an X10 and infrared control network based on an IPAQ running NetRemote, a computer running Homeseer with the HSGirder plugin and a Global Cache GC-100-12 device. The IPAQ is mounted either on her wheelchair or on her bed and uses a wireless router to communicate with the computer and GC. This works well, but is a bit slow and we have had trouble both with WiFi performance to the IPAQ and changing IP addresses – I won’t bore you with the details.

    I am constructing a new, independent, parallel system based on a Samsung Q1P running Vista, which will replace/backup the IPAQ, and also using a new router, a new computer and a new GC-100-6. The reason that we are doing it in parallel is so that when we finish, we will have a full home control backup system in place, so a problem with one does not leave the user helpless.

    Now, my question is, can you show me how I can add one (or possibly more) buttons in the NetRemote screens that will allow the user to change the IP addresses of both the Girder and Infrared plug-ins, so that if the user switches between wireless networks, I can make the same NetRemote screen suite work using either network? I believe that I could create multiple instances of the Girder and Infrared plug-ins and switch between the instances, each instance being setup to work on one network. Is this possible, so that the same control button on an NR screen will send the command to a different IP address if the Q1P or the IPAQ is connected to a different network? I realize, by the way, that the easiest way would be to make the computer and GC IP addresses the same on both networks, but that has proved impossible within the very tight budget that I have, as I would have had to replace too much of the existing network equipment to make that approach possible.

    Anyway, I know that this is not strictly a support question, but if you think that what I am proposing is possible, could you put together an example of what I would have to program in an NR button to reliably switch between the two instances/networks/IP addresses, so that the same IR and X10 buttons effectively address different IP addresses, depending on the selection?

    I am at my own home doing this, with just one system, and the quadriplegic lives a two-hour drive away and my time there is limited, so I am trying to do as much of the work at possible at home, where I am limited in my ability to test some of this functionality at home, hence my request, to try and minimize my time on site!

    One additional twist: since writing the above, I have found the infrared switch instance action for a button to switch infrared instances - very useful as it scrolls through the instances and you just press till you find an instance that works - this works really well, and it means that direct or passthrough can be included as an option. The only way that I've found to handle Girder/HSGirder switching problem is to address each Girder instance individually with separate actions in each X10 button with multiple button actions - this seems to work (on my single test system), but is very slow because you have to wait for the disconnected instance to fail before the button actions completes and you can use another button.

  2. #2
    Join Date
    May 2002
    Location
    CT
    Posts
    6,559

    Default

    Hi Chris -
    Are you familiar with Lua?

    You can change the "default" instance of any plugin by doing the following (in a lua button)...

    Code:
    plugin = NetRemote.GetPlugin(-1); -- This is the Girder plugin ID, you can also get it by name if you choose
    instance = plugin:GetInstance(-1001); -- This is the ID of the instance
    instance:SetCurrent();
    You can also do the following (though it's a little less clear)
    Code:
    NetRemote.SetPluginInstance(-1,-1001);
    Does that make sense/help?

  3. #3

    Default

    Thanks, Ben, that makes perfect sense.

    I have used Lua before but find, every time I've tried to go there, that a lack of examples in all the reference material available online just makes it too difficult to get into - especially when I do not have a clear idea of how to debug code - I remain at the stage of writing something that either works or does not, and I can only go through my entered text line by line trying to find errors by intuition and reference. I cannot see how to go beyond that. An example is worth a thousand words. I very much appreciate your guidance, and can easily take it from here, now that I have something to work with.

    Thank you again

  4. #4

    Default

    Sorry to be a pain. I've tried both methods and get the same error messages each time (when attempting to call either instance of Girder):

    Error running Lua chunk.

    [string"NRLUA"] :1: attempt to call field 'GetPlugin' (a nil value)

    Something that I am doing wrong?

  5. #5
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    Can you paste the Lua code from the action so we can see what's wrong.

    Also, what version of NR is this?
    --Rob

  6. #6

    Default

    Sorry, Rob,
    When you mentioned versions, I realized that I was writing and testing the code on my main computer that has the earlier NetRemote/Designer versions on it from a couple of years ago. The buttons do work on the new, dlownloaded NR/Designer on the Q1P. Sorry.

    I do have one other question/confirmation:
    In the button Action Designer, you can select a Send Event to Girder action either from under the Girder tab itself or from under one of the instances. If you select one under the Girder tab, it has the default instance address of -1, but you can select from under one of the instances, in which case the command will have one of the other instance addresses. Does the Lua instance switching affect all the actions, or only the actions entered under the default instance, with the default instance address? The Lua button instance switchers do work (using either of your code examples), but I am seeing some inconsistencies, and wonder if I should go through and make sure that all the button actions address only the default Girder instance?

  7. #7
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    They will only affect the default instance.
    --Rob

  8. #8

    Default

    Thanks, Rob, I guess that I will have to go through all the screens and X10 buttons and ensure that the actions are addressing the default! Your patience and help are much appreciated.

    I still wish that there was a page of Lua code examples posted somewhere on the proximis web site, though (or am I missing something that actually is there?)

  9. #9
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    That would probably be a good idea, yes.
    --Rob

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •