Announcement

Collapse
No announcement yet.

IP / Serial Plugin for HS3 (by "drule") - Discussion Thread

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

    Originally posted by skavan View Post
    Hi,

    I'm sure I;m being very dense, but am trying to implement a simple use case and failing.

    So - all I want to do, is have an event that sends the currently playing track name to drhslpPlugin (which in turn sends the received payload to a connected tcp ip client -- and the client is receiving the output nicely).

    I have set up an event, driven by a "Sonos Track Change" and I am selecting my connection (iRule) and I select the device: Sonos Track and the payload of Status. Instead of getting the track name, I get the value "No Track".

    When I inspect the Sonos Track device/variable it seems there is a status of 1000, a Value of "No Track" and a String Value containing the track name that I am actually trying to access.

    How do I get at it!

    While I'm at it, what I really would like to do is also prepend and append a delimiter to it.

    Darn. Almost Instant Gratification -- but not quite!
    I added 'string' to the send status/value action options. Attaching v22 to this post which also includes yesterday's fix for the eth484 pass-thru.

    -David

    HSPI_drhsIpPlugIn.zip

    Comment


      Originally posted by Fischi View Post
      Hi,
      I've installed a INTRONICO MFC-8800 relay card with8 inputs and 8 outputs to HS3.
      The controlling of the outputs with the drhspi plugin works successfull, only the received string is unknown until now for me.
      Is there a possibility for the drhsip plugin to trigger events which
      trigger on Received string contains : instead of String Received : ?

      Best regards, Fischi
      Have you tried matching OK\n with an encoding type of C Escaped?

      -David

      Comment


        Hi David,

        OK\n also doesn't work !

        Regards,
        Fischi

        Comment


          Originally posted by Fischi View Post
          Hi David,

          OK\n also doesn't work !

          Regards,
          Fischi
          :-( That would have been a quick fix.

          To help debug this can you use the following code as a pass-thru script? It will write the bytes that HS receives from your device out to the log.
          Code:
          Sub Main(param() As Object)
              Dim ConnectionName As String = param(0)
              Dim FromIp As String = param(1)
              Dim AsciiData As String = param(2)
              Dim BinaryData(UBound(param(3))) As Byte
              Array.Copy(param(3), BinaryData, BinaryData.Length)
          
              hs.WriteLog("Pass-thru", ConnectionName)
              hs.WriteLog("Pass-thru", FromIp)
              hs.WriteLog("Pass-thru", AsciiData)
              hs.WriteLog("Pass-thru", "There are " & BinaryData.Length.ToString & " bytes of binary data.")
          
              For n as Int16 = 0 to UBound(BinaryData)
                  hs.WriteLog("Pass-thru b" & n.ToString, BinaryData(n).ToString)
              Next
          End Sub
          -David

          Comment


            Thanks David,
            I'll try it soon.

            Here a sample from the user guide of the mfc-8800 (page 53)
            for the ON command

            Syntax:on:[output number]



            Parameterutput-number- 0 ... 7

            Description: The instruction sets the specified output to high-state.
            Example: on:0 //Sets output Q0 to high-state
            Returns: OK
            See also: rd_iq:; off

            I think, it should return OK to the plugin, but it doesn't
            Is this correct ?

            Reg.,
            Fischi

            Comment


              Originally posted by peterpc View Post
              To make things clear, for HS2 I used a plugin especially made for the door lock. Not your plugin.
              Here's v23. I made some changes to the way the serial port's properties are configured. After updating, please go back to the serial port tab in the plugin's config page and reapply your settings. Don't forget to select RTS/CTS as your flow control.

              -David

              HSPI_drhsIpPlugIn.zip

              Comment


                Originally posted by Fischi View Post
                I think, it should return OK to the plugin, but it doesn't
                Is this correct ?

                Reg.,
                Fischi
                My guess is that it is returning OK and some other control characters like CR or LF. The pass-thru script will write all the data received to HS's log and from there we should be able to work out the best way to make this work for you.

                -David

                Comment


                  Hi David,

                  here the log entries for the ON and OFF command :

                  (passtrugh ON
                  Okt-23 17:15:00 Pass-thru b5 13
                  Okt-23 17:15:00 Pass-thru b4 10
                  Okt-23 17:15:00 Pass-thru b3 75
                  Okt-23 17:15:00 Pass-thru b2 79
                  Okt-23 17:15:00 Pass-thru b1 13
                  Okt-23 17:15:00 Pass-thru b0 10
                  Okt-23 17:15:00 Pass-thru There are 6 bytes of binary data.
                  Okt-23 17:15:00 Pass-thru OK
                  Okt-23 17:15:00 Pass-thru 192.168.178.23:2101
                  Okt-23 17:15:00 Pass-thru Intronic mfc-8800
                  Okt-23 17:14:59 Pass-thru b3 50
                  Okt-23 17:14:59 Pass-thru b2 58
                  Okt-23 17:14:59 Pass-thru b1 110
                  Okt-23 17:14:59 Pass-thru b0 111
                  Okt-23 17:14:59 Pass-thru There are 4 bytes of binary data.
                  Okt-23 17:14:59 Pass-thru on:2
                  Okt-23 17:14:59 Pass-thru 192.168.178.23:2101
                  Okt-23 17:14:59 Pass-thru Intronic mfc-8800
                  Okt-23 17:14:59 Event Event Trigger "Drhsip O2n"
                  Okt-23 17:14:59 Event Event Drhsip O2n triggered by the event page 'Run' button

                  (passthrugh OFF
                  Okt-23 17:18:21 Pass-thru b6 13
                  Okt-23 17:18:21 Pass-thru b5 10
                  Okt-23 17:18:21 Pass-thru b4 75
                  Okt-23 17:18:21 Pass-thru b3 79
                  Okt-23 17:18:21 Pass-thru b2 13
                  Okt-23 17:18:21 Pass-thru b1 10
                  Okt-23 17:18:21 Pass-thru b0 50
                  Okt-23 17:18:21 Pass-thru There are 7 bytes of binary data.
                  Okt-23 17:18:21 Pass-thru 2 OK
                  Okt-23 17:18:21 Pass-thru 192.168.178.23:2101
                  Okt-23 17:18:21 Pass-thru Intronic mfc-8800
                  Okt-23 17:18:21 Pass-thru b3 58
                  Okt-23 17:18:21 Pass-thru b2 102
                  Okt-23 17:18:21 Pass-thru b1 102
                  Okt-23 17:18:21 Pass-thru b0 111
                  Okt-23 17:18:21 Pass-thru There are 4 bytes of binary data.
                  Okt-23 17:18:21 Pass-thru off:
                  Okt-23 17:18:21 Pass-thru 192.168.178.23:2101
                  Okt-23 17:18:21 Pass-thru Intronic mfc-8800
                  Okt-23 17:18:21 Event Event Trigger "Drhsip O2ff"
                  Okt-23 17:18:21 Event Event Drhsip O2ff triggered by the event page 'Run' button.

                  How to continue ?

                  (I don't know where the smileys come from)
                  Best regards,
                  Fischi


                  Comment


                    Originally posted by Fischi View Post
                    Hi David,

                    here the log entries for the ON and OFF command :
                    Hmmm, so the messages look like they are on:2\n\rOK\n\r and off:2\n\rOK\n\r

                    The problem is that the plugin is receiving them split across two packets. What speed does this device run at and is it half or full duplex?

                    -David

                    Comment


                      Thanks and Strategy

                      Originally posted by drule View Post
                      I added 'string' to the send status/value action options. Attaching v22 to this post which also includes yesterday's fix for the eth484 pass-thru.

                      -David

                      [ATTACH]49593[/ATTACH]
                      WOW! Thanks. You are GOOD!

                      So - while I'm here, I thought I'd clarify your "recommended" approach to integration with iRule.

                      Let start with the most basic:
                      1. Enhanced Feedback TO iRule
                        - The simple method would be the one above (assuming the triggering device is setup in HS). i.e. Trigger to drhsIP Host Connection. iRule grabs the data and acts accordingly.
                        - A more advanced method would be to Trigger script, use that script to build nice strings and then from code, call the drhsIP connection, with a more evolved payload.
                      2. 2 Way Communication
                        - Create a drhsIP Client Connection. Use script to interpret the inbound data and fire events or update status from this code. GUI is the lovely iRule. Device Control is a marriage of iRule controlled stuff (mostly AV) and HS controlled stuff (mostly Home Automation) -- and your extraordinary plugin is the bridge.
                      3. Longer Term Strategy
                        - So -- do you think the right play is the "marriage" mentioned above or moving all device control to HS and just using iRule to interface to HS as a two way, attractive GUI?


                      If anything in the above is suboptimal in approach would love to hear before I get to far involved!

                      Thank you again for an amazing plugin and even more amazing responsiveness.

                      Comment


                        Originally posted by skavan View Post
                        So - while I'm here, I thought I'd clarify your "recommended" approach to integration with iRule.
                        Now there's an interesting question! The very early version of this plugin was a simple tcp host that listened for strings. I wrote it for the purpose of being able to send "commands" from iRule into HS but tried to keep it generic enough so that it might be useful for other things too.

                        Initially I was using it to send strings such as "iRule00" & "iRule01" to HS, which would then trigger events. That event might have multiple actions, eg., turn the TV on, dim the lights, change the input on my HDMI switch, etc.. I'm a big Insteon user so I would probably use the term "scene" to describe my HS events.

                        At first, I had HS control everything. I view it as a Rosetta Stone of home automation. I didn't use iRule to change channel on the TV for instance, because HS could already do that for me and why configure something twice? However, over time I keep changing my mind back and forth on that one :-) iRule is better at somethings than HS so why not have it do them? So what I've ended up with is a mishmash, an ever changing mishmash. For instance, on my main TV I have a Sonos playbar. iRule's Sonos plugin isn't to my liking but dcorsus's Sonos plugin for HS is superb. Therefore I have an iRule button than sends a string to HS, which triggers an event to control the Sonos volume via dorcus's plugin.

                        As far sending stuff back to iRule from HS, my initial thought was to use an HS event triggered by say a light switch changing dim level, to send data to an iRule feedback construct. Unfortunately, I haven't had the time to fully implement it in my own iRule setup and consequently I suspect that there's a bunch of fine-tuning required that I haven't yet seen. I welcome other people's thoughts and observations on how this can be improved.

                        So, sorry but I haven't really answered your question about a recommended approach!

                        -David

                        Comment


                          Originally posted by drule View Post
                          OK, got my Eth484 and now I have it all working! I found a bug that was causing the plugin to attempt to read data from a tcp host connection after the remote client had closed the session. After the pass-thru script sent the acknowledgement byte, the Eth484 closed the connection and the plugin crashed trying to read more data from the now closed connection. I have sent cheeryfool the updated plugin to post on the main thread.

                          I also discovered that the Eth484 sends 3 bytes. not 2 when sending status. The Eth484 documentation says "The ETH484 then sends digital active (0x20) or digital inactive (0x21) followed by the output number. So it would send two bytes 0x20, 0x01." My Eth484 is sending 3 bytes: 0x20, 0x01, 0x00.

                          Cheers
                          -David
                          Installed the script.
                          And it is working ok.
                          Thanks!!
                          Peter

                          http://ohh.pcgsm.nl

                          Comment


                            Originally posted by peterpc View Post
                            Installed the script.
                            And it is working ok.
                            Thanks!!

                            Comment


                              Hi David
                              you wrote:
                              "The problem is that the plugin is receiving them split across two packets. What speed does this device run at and is it half or full duplex?"

                              I don't know, how to get this information?

                              I've tested the ON command with string on:2 and the ON event triggers OK.
                              So I can set a virtual device showing O2 is on.

                              I've also tested the OFF command with string off: like seen in the passthru
                              log and it also triggers OK,
                              but I can't set the virtual device to OFF because the received string is only
                              off: and not off:4 (similar to on:4).
                              This is corious and it's a pity.

                              Regards,
                              Fischi

                              Comment


                                Originally posted by Fischi View Post
                                Hi David
                                you wrote:
                                "The problem is that the plugin is receiving them split across two packets. What speed does this device run at and is it half or full duplex?"

                                I don't know, how to get this information?

                                I've tested the ON command with string on:2 and the ON event triggers OK.
                                So I can set a virtual device showing O2 is on.

                                I've also tested the OFF command with string off: like seen in the passthru
                                log and it also triggers OK,
                                but I can't set the virtual device to OFF because the received string is only
                                off: and not off:4 (similar to on:4).
                                This is corious and it's a pity.

                                Regards,
                                Fischi
                                It seems peculiar that the device appears to be splitting the data across multiple packets. I thought if the device was running at 10Mbps rather than 100Mbps or 1000Mbps, that might be an explanation. I think I can come up with a way to concatenate the packets (I already do something like this in serial connections with a timeout based on baud rate). PM me your email address and I will send you a test build of the plugin to try sometime over the next few days.

                                -David

                                Comment

                                Working...
                                X