Announcement

Collapse
No announcement yet.

Trigger IR by Script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trigger IR by Script

    Hello,

    I am giving the plugin a try before I purchase and have been very impressed by how easy it was / is to import the IR signals.

    Do you have any document or reference on how to trigger an IR signal by Script using HS3. I have an ATI remote which is received by RFXCOM that subsequently triggers a script. The script controls a number of devices but I would like to directly control the TV through the script, i.e send the Power ON Signal.

    Thanks .
    HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

    Facebook | Twitter | Flickr | Google+ | Website | YouTube

  • #2
    Hello travisdh. It is much easier to send IR using event actions by simply controlling the device using "Control a Device", then selecting the Global Cache device, then selecting the named IR button. Will that work?

    If you must use a script, then you can send IR by simply setting the device value of the device. For a list of valid values, see the Status Graphics pairs defined for the device (View > Device Management > Click on Device Name > select Status Graphics tab).

    Regards,
    Ultrajones
    Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

    Comment


    • #3
      I am looking to control the IR devices through scripting if possible, just as it allows the most power and ability.

      I have an ATI remote which is picked up by the HA system, and within this I am controlling my TV's and a number of other devices, but I would prefer to control it through as a script as it will be far easier than creating a number of different events (about 100 events) to send IR codes to the appropriate devices, or determine the status etc.

      With setting the device value, would this work if I set it to the same value more than once, for example if I send the IR signal volume down by setting the device value to 6, if I keep setting the device value to 6 will it keep sending the IR signal?

      If not, is there a scripting API or anything similar?

      Thanks,
      HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

      Facebook | Twitter | Flickr | Google+ | Website | YouTube

      Comment


      • #4
        Hi,

        Just a quick one, if i wanted to control an IR device through a script would I use the following:

        &hs.SetDeviceValueByRef(222, 118, True)

        where 222 is my device reference ID, and the 118 is the device code for the IR Signal I want to send, if i wanted to do it in a script I would then just remove the &.

        Will this allow me to send multiple signals (e.g this is volume up), as when i trued to send it nothing happened
        HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

        Facebook | Twitter | Flickr | Google+ | Website | YouTube

        Comment


        • #5
          Well, that is unexpected behavior. I'll have to ping Rich on that as I don't even see HomeSeer calling SetIOMulti when I run &hs.SetDeviceValueByRef(27, 2, True) on my system.

          I'll also publish the API shortly (e.g. SendIrCommand) after further testing.

          Regards,
          Ultrajones
          Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

          Comment


          • #6
            Thanks for following it up, it is nice to know it is not just my system that is having this issue.

            Interestingly though if you use Control a device it works fine, just not through the SetDeviceValue side of things.

            Once i can get this all going, and have a look at the API side of things I should be good to purchase a license. I have been very impressed with your GCIR plugin so far (especially the import feature!!!)
            HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

            Facebook | Twitter | Flickr | Google+ | Website | YouTube

            Comment


            • #7
              Just wanted to follow up on the API to send IR signals from your script, and also if you had the chance to speak to Rich about the issue with the plugin not being triggered on a device value being set.

              This is the last thing holding me from purchasing the plugin (I have been really happy with it so far) but really need to be able to trigger the IR signals from scripts (or Scripts & your API) rather than events.

              As of last I checked (yesterday I think) I was still having troubles getting the IR signal to be triggered from a script setting the device value of an IR device (e.g. read the value from the Device properties for TV ON, which may have a value of say 102 then set the device value (by ref) to 102.

              Thanks.
              HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

              Facebook | Twitter | Flickr | Google+ | Website | YouTube

              Comment


              • #8
                Hello. Can you send an e-mail to ultrajones@hotmail.com and provide the details on exactly what you're looking for in the API call?
                Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

                Comment


                • #9
                  Sorry for the necrobump, I'm also trying to script something. Is the API available, or is setting the device status the way to do this?

                  Comment


                  • #10
                    Travisdh, UltraJones suggested the following "If you must use a script, then you can send IR by simply setting the device value of the device".

                    I have scripts that uses the hs.setdevicevalue function and they work perfectly. Here is a snippet of one of my scripts.

                    'set the FiOS set top box to channel 504
                    hs.setdevicevalue "]16", 29
                    hs.setdevicevalue "]16", 34
                    hs.setdevicevalue "]16", 28
                    hs.setdevicevalue "]16", 9


                    ]16 points to IR module 4:1 in the GC-100. The numbers that follow point to the IR code stored in the UltraGCIR data base.

                    Hope that helps.

                    Comment


                    • #11
                      Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

                      Comment


                      • #12
                        Curious... Why am I getting this in the log when I run the sample script provided in the documentation?

                        Error 1 Running script C:\Program Files (x86)\HomeSeer HS3\scripts\UltraGCIR Test.vb :Exception has been thrown by the target of an invocation.Public member 'plugin' on type 'hsapplication' not found.

                        Here's the sample script... (modified for my specific device)
                        -----------------------------------------------------------------
                        Sub Main(ByVal parm As Object)
                        '
                        ' Define our plug-in object
                        '
                        Dim hspi As Object = hs.plugin("UltraGCIR")
                        '
                        ' SendIrCommand will accept either HomeSeer "Location DeviceName"
                        ' or the DeviceCode
                        '
                        Dim arrDevices As String() = {"GC001:1:3", "iTachWF2IR IR Module 1:3"}
                        For Each strDevice As String In arrDevices
                        Dim bSuccess As Boolean = hspi.SendIrCommand(strDevice, "TV Power")
                        Next
                        End Sub

                        --------------------------------------------------------------

                        I am considering purchasing this plugin, IF I can get it to work with scripting. I have several occasions where I need to send "bursts" of IR commands, IE: Volume and channel changing which is NOT fast enough using events to send IR commands.
                        Last edited by artstein; August 27th, 2014, 12:32 PM.

                        Comment


                        • #13
                          Has there been any feedback on this?

                          Comment


                          • #14
                            The examples below shows you how to turn on a Global Cache relay or send an IR command via script. The examples below should also work from the Tools > Control Panel > Immediate Script Command.

                            Here is a Global Cache IR example:
                            Note: GC005:4:1 is the Device Technology Address for the GC IR Device and "POWER ON" and "POWER OFF" are button names I created for my IR device.
                            Code:
                            hs.CAPIControlHandler(hs.CAPIGetSingleControl(hs.GetDeviceRef("GC005:4:1"), False, "POWER ON", False, False))
                            Code:
                            hs.CAPIControlHandler(hs.CAPIGetSingleControl(hs.GetDeviceRef("GC005:4:1"), False, "POWER Off", False, False))
                            Here is a Global Cache Relay example:
                            Note: GC004:1:1 is the Device Technology Address for the GC Relay Device and "Activate" and "Inactivate" will control the relay.
                            Code:
                            hs.CAPIControlHandler(hs.CAPIGetSingleControl(hs.GetDeviceRef("GC004:1:1"), False, "Activate", False, False))
                            Code:
                            hs.CAPIControlHandler(hs.CAPIGetSingleControl(hs.GetDeviceRef("GC004:1:1"), False, "Inactivate", False, False))
                            Regards,
                            Ultrajones
                            Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

                            Comment


                            • #15
                              Thank you SO much for that!!!

                              Looks like I have found my winner! I was going to see which plugin author provided a scripting solution first before deciding which one I would purchase.

                              This solves a number of problems that I had in switching over to HS3.

                              Thanks again!

                              P.S. I've used a number of your plugins over the years, always quality stuff! Thanks for all of your hard work!

                              Comment

                              Working...
                              X