Announcement

Collapse
No announcement yet.

TCP Trigger Plugin

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

    TCP Trigger Plugin

    This is a simple plugin I wrote that listens on a TCP port for incoming strings and triggers events when matching strings are received. I use it primarily with iRule (http://www.iruleathome.com) but I'm sure there are many other uses.

    By default it listens on port 6969 but you can change this by editing HSPI_HSDRTCPTRIG.ini in your HomeSeer\Config directory.

    Once installed and enabled, a new trigger type is added: "Received TCP String".

    Click image for larger version

Name:	tcptrigger.jpg
Views:	1
Size:	76.9 KB
ID:	1204122

    Received strings are case sensitive.

    Hope you find this useful

    -David

    #2
    poked around, did not see anything that was too clear, but DOES iRule exist for android devices?

    --I guess I should check the Market...I didn't think that the download for that might be there...

    --Dan
    Last edited by drozwood90; November 7, 2011, 09:43 AM.
    Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

    Comment


      #3
      At the moment, iRule is only available on iOS devices.

      [Update] iRule now runs on Android too.
      Last edited by drule; June 14, 2012, 11:36 AM. Reason: New info

      Comment


        #4
        Can you give us examples of what you use this with?

        Comment


          #5
          He uses it with iRule.

          iRule sends UDP commands across the network. Supposed to go to a GlobalCache device. Instead, he intercepts the commands with HS. Then does "stuff" with the command.

          Pretty neat.

          --Dan
          Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

          Comment


            #6
            That's a pretty good summary. Primarily I use iRule for AV stuff, turn the TV on, set the right input on the receiver, dim the lights, etc. iRule can do most of these things directly but it doesn't have the equivilent of conditional triggers, which I make extensive use of. Much easier for me to send a single command from iRule to Homeseer and let Homeseer do the clever bits.

            I use iRule to control my HVAC via Homeseer as a 'go-between.'

            Also I have some other custom network devices that send messages to Homeseer so that it can track their status.

            Plus I've seen a couple of people on this forum ask for this functionality and I thought it would be a great learning exercise for me to work out how to write a Homeseer Plugin!

            -David

            Comment


              #7
              Drule, thanks for this simple yet excellent plugin. I've been looking for something like this for some time!

              Cheers!

              Comment


                #8
                How do I install the plugin? - SOLVED
                Originally posted by drule View Post
                This is a simple plugin I wrote that listens on a TCP port for incoming strings and triggers events when matching strings are received. I use it primarily with iRule (http://www.iruleathome.com) but I'm sure there are many other uses.

                By default it listens on port 6969 but you can change this by editing HSPI_HSDRTCPTRIG.ini in your HomeSeer\Config directory.

                Once installed and enabled, a new trigger type is added: "Received TCP String".

                [ATTACH]29260[/ATTACH]

                Received strings are case sensitive.

                Hope you find this useful

                -David
                Last edited by Jakob.Sand; April 18, 2012, 05:05 PM.
                Best,
                Jakob Sand, I automate everything!

                Comment


                  #9
                  What type of string terminator does this plugin look for? I can see it receiving the data I send, but not triggering the event. For a little background, I'm not using irule, just a unix utility called socat that sends TCP data. I'm just making the connection sending the string and staying connected. The homeseer log says received:martin which is the trigger string, but the event doesn't trigger. Any ideas?
                  Last edited by mterry63; May 1, 2012, 10:41 AM.

                  Comment


                    #10
                    A little experimenting and I answered my own question. The plugin wants NO string terminators. I had to supress the newline option in order to trigger.

                    Comment


                      #11
                      I've been thinking about using this plugin to work around the 'no repeating buttons' in HSTouch, but I've run into a stumbling block.

                      The plugin seems to wait for data on the tcp stream and consider the string 'complete' after 1 second of no data.

                      Unfortunately that's too long for repeating data.

                      Any way to change the timeout? Or get a special compiled version using new line or CR/LF as the terminator?

                      Comment


                        #12
                        The plugin considers a string complete either after the tcp stream read has timed out, or upon receipt of CRLF. Can you send me an example of what you are sending so that I can try it out? I'm putting the finishing touches on another plugin that will offer a lot of different ways to send and receive over IP. The new plugin absorbs all the functionality of the old one and if I can fix this issue for you, I will.

                        Cheers
                        David

                        Comment


                          #13
                          Thanks David. Right now I'm using a unix utility called 'socat' to read data from a file on the client and send it via tcp stream to the HS server. New data is triggered by appending text to the file.

                          If CR/LF terminations work, that should actually solve my problem. I'll retest it today to be sure and respond here.

                          Comment


                            #14
                            Testing again, the CRLF termination doesn't seem to work for me. I have trigger setup for the text 'martin' and sending martinCRLF the plugin simply reports recevied: martin and doesn't trigger.

                            Here's a tcpdump of the stream showing the text ending in 0d0a hex:

                            0x0000: 4500 0030 4e6d 4000 8006 2205 c0a8 046f E..0Nm@..."....o
                            0x0010: c0a8 0496 d4c3 1b39 7f91 8aab 1993 e476 .......9.......v
                            0x0020: 5018 3fff 96dd 0000 6d61 7274 696e 0d0a P.?.....martin..

                            Let me know what you think.
                            Last edited by mterry63; May 2, 2012, 10:09 AM.

                            Comment


                              #15
                              What does your event trigger look like? The line of code that writes the "Received: " message is immediately followed by a homeseer check trigger callback. So if you're seeing the message, the plugin believes it has valid data and is calling homeseer.

                              The "string received" specified on the event's trigger tab is case sensitive. The CRLF is stripped from the message that is sent to homeseer, so in your case, homeseer should be trying to match any events that have "martin" as the trigger string.

                              Can you try another test for me? Can you putty into the plugin on port 6969 and see how that reacts?

                              Thanks
                              David

                              P.S.
                              Apologies for the patching responses right now. I'm traveling this week.

                              Comment

                              Working...
                              X