Announcement

Collapse
No announcement yet.

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

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

    Is it somehow possible to send the value of a device via UDP? I'm looking to send for instance the latest data to a display connected to Arduino. Most of this has already been realised (Arduino/7 segment led display/interfacing via UDP); the only thing that I miss is Homeseer sending variable data to the Arduino. Sending a fixed data/text is possible but not the variable data...

    Comment


      Comment


        I don't know the first thing about the plugin or your device but by the looks of those characters I doubt they are expected responses. Incorrect characters can sometimes be an indicator of an incorrect baud rate - have you confirmed that the baud rate is set correctly?

        Comment


          @mrhappy, since you're here... can you point me in the right direction to grab stuff coming in that serial port (virtual serial - whatever) and push it as "status" for a device?

          See a couple posts up. I've got so far as to have the "VOL 48" showing up in my logs (as I'd expect) but I need to figure out how to find "VOL" then grab the two digits after it and plug them in as "volume level" in a device.

          Comment


            Originally posted by gregoryx View Post
            @mrhappy, since you're here... can you point me in the right direction to grab stuff coming in that serial port (virtual serial - whatever) and push it as "status" for a device?

            See a couple posts up. I've got so far as to have the "VOL 48" showing up in my logs (as I'd expect) but I need to figure out how to find "VOL" then grab the two digits after it and plug them in as "volume level" in a device.
            I don't know about the plugin, if I was doing anything with serial myself I do the whole thing by scratch with HS's own in built serial port controls.

            I don't know what options the plugin has at all, does it have the ability to call a script from when data arrives? If so I would get the data passed into that script, look at it and then firstly split the string on the space character to give you the separate parts. Then I would look at part 2 (VOL) and see if it was VOL (I guess you might get balance or additional data here), then I would look at the number, see whether it is valid and then finally set it to a device value.

            It is probably a couple of lines in a script just to do the simple part of it, I don't know whether the plugin has some sort of ability to do that itself or not.

            Comment


              Originally posted by mrhappy View Post
              I don't know about the plugin, if I was doing anything with serial myself I do the whole thing by scratch with HS's own in built serial port controls.

              I don't know what options the plugin has at all, does it have the ability to call a script from when data arrives? If so I would get the data passed into that script, look at it and then firstly split the string on the space character to give you the separate parts. Then I would look at part 2 (VOL) and see if it was VOL (I guess you might get balance or additional data here), then I would look at the number, see whether it is valid and then finally set it to a device value.

              It is probably a couple of lines in a script just to do the simple part of it, I don't know whether the plugin has some sort of ability to do that itself or not.
              I'm calling a script with it now - that's how I'm getting that into the logs. If you can point me to a sample script of how I'd go about stripping those bits out (as you describe) and pushing them to a virtual device, I suspect I'd be on my way. I'm still searching for such a script that I can understand well enough to implement it.

              Comment


                This would be something I would do - it is a method, there are probably better methods out there but to keep it simple.

                Code:
                Sub Main(Parm As Object)
                
                    Try
                        Dim InputStr As String = "????? PANDO VOL 47"
                        Dim SplitStr() As String = InputStr.Split(" ")
                
                        If SplitStr(2).ToLower = "vol" Then
                            If convert.tobyte(SplitStr(3)) <= 99 And convert.tobyte(SplitStr(3)) >= 0 Then
                                'we now have a correct volume value between 0 and 99
                                hs.setdevicevaluebyref(1234, convert.todouble(SplitStr(3)), True)
                            End If
                        End If
                    Catch ex As Exception : hs.writelog("SerialScript", "Exception: " & ex.Message.ToString)
                    End Try
                
                End Sub
                You would need to pass your data into that script and may need to do some slight changes but try it, you also need to create a device and change the reference of 1234 to the reference of your actual device you have created.

                Comment


                  Awesome. That seems to make sense. I'll swap the script I'm using now to see if I can get it to work.

                  This is what I'm using right now.

                  Code:
                  Sub Main(Param As Object)
                      Dim Params() As String = Split(Param.ToString, Chr(0))
                  	' Param(0) is the name of the plugin's connector
                  	' Param(1) is the ip address of the remote end
                  	' Param(2) is the data received
                      Dim SplitString() As String = Split(Params(2), Chr(13))
                      For i As Integer = 0 To UBound(SplitString)
                          Select Case SplitString(i)
                              Case "GC-IRE XXXXXXXX"
                                  ' Do stuff
                                  Exit For
                              Case "GC-IRE YYYYYYYY"
                                  ' Do other stuff
                                  Exit For
                  
                              Case Else
                                  hs.WriteLog("NF", "I don't know what to do: " & SplitString(i))
                          End Select            
                      Next
                  End Sub
                  So, I should be able to just dump that in favor of what you have? Or blend them somehow?

                  Comment


                    I would try replacing it as a start but it will need amendments, it might need amending to something like this but I can't be absolutely sure not having the device and not having the plugin as I say.

                    Code:
                    Sub Main(Param As Object)
                    
                        Try
                            Dim Params() As String = Split(Param.ToString, Chr(0))
                    	Dim InputStr As String = Params(2).ToString
                            Dim SplitStr() As String = InputStr.Split(" ")
                    
                            If SplitStr(2).ToLower = "vol" Then
                                If convert.tobyte(SplitStr(3)) <= 99 And convert.tobyte(SplitStr(3)) >= 0 Then
                                    'we now have a correct volume value between 0 and 99
                                    hs.setdevicevaluebyref(1234, convert.todouble(SplitStr(3)), True)
                                End If
                            End If
                        Catch ex As Exception : hs.writelog("SerialScript", "Exception: " & ex.Message.ToString)
                        End Try
                    
                    End Sub

                    Comment


                      Thanks for the help. I'm trying to make sense of it now. I suspect I'll get the hang of it after a bit. I /so/ don't grasp this scripting stuff. LOL.

                      Comment


                        @ Mr Happy: Thanks for the reply, but I'm convinced that the baudrate is correct. Using Realterm I see the commands that I'm expecting. It appears that the plugin debug windows shows ASCII values while the data I'm receiving are HEX values.

                        @Drule: I've noticed that someone is experiencing a similar issue in the HS2 version of the plugin. Could it be that the code is broken in both versions?

                        Just for a sanity check. Has anyone been able to trigger scripts on serial input?

                        Kind regards

                        Comment


                          Originally posted by connor View Post

                          Just for a sanity check. Has anyone been able to trigger scripts on serial input?

                          Kind regards
                          No, it is not working. Still a bug to be solved.
                          Peter

                          http://ohh.pcgsm.nl

                          Comment


                            When I have an IP connection and in the connections list I have selected a script to run, hs.writelog("eth484 ", Params(2)) gives you the ascii data in that script.
                            How can I change that to binary data?
                            Peter

                            http://ohh.pcgsm.nl

                            Comment


                              Symetryx - Jupiter 8 Amp

                              Hey guys !

                              We are dealing with a new Jupiter 8 Audio distributor and this one can receive AMX / Crestron commands through UDP protocol. The commands are pretty straightforward and I've been tempering with the IP/SERIAL plugin for a couple days with no luck.

                              Here is our setup :
                              - HS2 with latest IP/Serial plugin installed
                              - Jupiter amp can receive UDP commands through port 48630 and should be sending an ACK when command is received.
                              - Server is on same LAN as Jupiter amp within same subnet
                              - Both devices are seeing each other

                              My settings on plugin :
                              NAME : Ampcontrol
                              TYPE : UDP
                              MODE : Client
                              PORT : 48630
                              COMMAND DATA : FU<cr> ( This command should flash unit - CR means Carriage return )
                              TYPE : Raw Text ( tried all other types too but not working )
                              NO SCRIPT SELECTED

                              Anyone sees anything for the Captain Obvious of me ? Thx guys !

                              Comment


                                Originally posted by peterpc View Post
                                When I have an IP connection and in the connections list I have selected a script to run, hs.writelog("eth484 ", Params(2)) gives you the ascii data in that script.
                                How can I change that to binary data?
                                The problem is that I have a Ocelot with 3x secu16 units. They are no longer supported in HS3.
                                I want to replace them with an IP relay card that also has 8 inputs. The eth484.
                                http://www.robot-electronics.co.uk/htm/eth484tech.htm
                                It can forward the input changes to an other board or to a PC.
                                I want to get the changes into HS to set devices.
                                This is how that works:

                                Mapping inputs to custom devices
                                Following customer requests for obtaining input states without the need for polling the ETH484, this can be achieved with the existing input mapping function.
                                If you would like the inputs to be mapped to a custom device then we have a simple command structure to achieve this, the ETH484 will send the commands in blue, your device will respond with commands in yellow.
                                A TCP packet with 0x79 (password entry) in the first byte, then the following bytes will be the password supplied above
                                To acknowledge a password match, respond with 1, else send 2
                                Digital active (0x20) or Digital inactive (0x21) followed by the output number
                                Reply with a 0 for success, else send 1
                                Note that the complete sequence must be followed, even if the password fails.

                                I want to make a script that is updating the 8 devices on input change on the eth484.
                                But therefore I need to get the outputs of the board in the script.
                                first communication on a change gives me the "y", not 0x79, y is the ascii value of 0x79.
                                then I have to receive 0x20, but I get nothing.
                                If I can select the data form when selecting the script, I think it will work.
                                Is this possible?
                                Or is there a better solution?
                                Peter

                                http://ohh.pcgsm.nl

                                Comment

                                Working...
                                X