Originally posted by WinoOutWest
View Post
Announcement
Collapse
No announcement yet.
IP / Serial Plugin for HS3 (by "drule") - Discussion Thread
Collapse
X
-
Originally posted by WinoOutWest View PostThis plugin is AWESOME!
My wheels are turning: I am having issues with the BLOnkyo plugin as it is not sending the commands to my older Integra receivers that I am controlling via RS232 and an IP-->RS232 device and VSPE. I tested it with a script that I got and it works fine so I am wondering if anyone can help me get one command into this plugin and I will be able to figure out the rest. It will be waaay easier to control it from this plugin than creating a bunch of scripts.
here is the script that is currently working:
sub main()
Dim PortNumber
PortNumber=4
hs.OpenComPort PortNumber,"9600,n,8,1",1,"",""
hs.SendToComPort PortNumber, "!1PWR01" & vbcr
hs.closeComPort PortNumber
end sub
If I can bypass the VSPE and send directly to the IP-->RS232 device then even better!
Can anyone help me get this command created in this plugin?
Cheers!
Darren
-David
Comment
-
Originally posted by cheeryfool View PostI haven't used HTTP connections/commands, but try the POST method instead of GET
For instance, I control a DirecTV receiver with HTTP commands by having an event whose action is "Run a Script or Script Command" and then I have "Execute immediate script command" ticked and the command is:Code:&hs.GetURL("192.168.1.1", "/remote/processKey?key=guide&clientAddr=0", True, 8080)
Code:&hs.GetURL("192.168.2.200", "/?hdmiPower", True, 80)
Code:Sub Main(parm as String) If parm <> "" Then Dim WebClient As New System.Net.WebClient Dim Result As String = WebClient.UploadValues(parm, "POST", New System.Collections.Specialized.NameValueCollection()).ToString End If End Sub
-David
Comment
-
Originally posted by drule View PostWhich IP->Serial device are you using? You can most likely send a C-escaped string "!1PWR01\n\r" to the ipaddress/port of the device as a tcp client.
-David
Thank you!
I have 3 Integra (Onlyo) receivers that I use for audio only so I only really need Power on/off and volume for. The way this plugin works I only have to create the commands once and then send them to different devices as appropriate.
Thank you so much - Can't tell you how pleased I am to have this work so effortlessly compared to my SNAFU with Vera!
Comment
-
Ok so I am probably abusing my newbie status now but is there a quick way to get feedback into a homeseer variable? Specifically I really only need/would like to have the volume level so that I can display that in my Imperihome. When the BLOnkyo plugin was working I was able to map that value to a generic text sensor in the Imperihome which suited my requirements just fine
MVLQSTN is the serial query command so presumably "!1MVLQSTN\n\r" would send the query command and get the value from the receiver. How can I capture that so I can display it as a sensor/value?
Comment
-
Originally posted by drule View PostI suspect that this will do the job for you:Code:&hs.GetURL("192.168.2.200", "/?hdmiPower", True, 80)
Thank you (again!)
I think I am gonna head over and take advantage of the 25% off sale that ends tonight. DRULE and CHEERYFOOL: this single plugin eliminates all my concerns and apprehensions about moving off my Vera. It simplifies my setup, makes it easier to manage and do "stuff" with and with a little luck and more help I will be getting the volume feedback working on my receivers, something I never had managed to get working on my Vera.
Comment
-
Originally posted by WinoOutWest View PostOk so I am probably abusing my newbie status now but is there a quick way to get feedback into a homeseer variable? Specifically I really only need/would like to have the volume level so that I can display that in my Imperihome. When the BLOnkyo plugin was working I was able to map that value to a generic text sensor in the Imperihome which suited my requirements just fine
MVLQSTN is the serial query command so presumably "!1MVLQSTN\n\r" would send the query command and get the value from the receiver. How can I capture that so I can display it as a sensor/value?
This should be fairly easy but you're going to have to dip into a bit of scripting. Presumably your Connection is defined as a TCP Client? If you tick the "Persist" checkbox, this causes the plugin to keep the connection open, rather than open the connection, send data, close the connection. A persistent connection lets you do stuff with data received from the remote device.
You can either create an event that triggers when a specific message is received, or more powerfully, you can pass all data received into a script.
Here's a example of a pass-thru script that simply writes data received into Homeseer's 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
-
Originally posted by drule View PostYou can just cut & paste the code straight from remotecentral.com. E.g., for a Samsung TV, the power command hex code would be:Code:0000 006C 0022 0003 00AD 00AD 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 06FB 00AD 00AD 0016 0016 0016 0E6C
-David
Comment
-
Time to ask for help...
I've been trying to get a "two way" function working with this script for many months... but, man... I just don't understand scripts.
I'm using drhsIpPlugin to control a Rotel preamp via serial through an iTach. The control works. And I've got a virtual device that holds the volume level - but it's based on keeping it in sync, not on getting feedback from the Rotel.
I've butchered one of the sample scripts to get it to show the returned data I want in the logs - so I suspect there's a way to parse that into pieces and then use it to set a virtual device.
Here's what I'm using:
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("drhsIpPlugin", "Volume is now: " & right(SplitString(0),3) & "(originally [" & SplitString(0) & "]") End Select Next End Sub
Here's what's hitting the logs right now (from the above script - everything hits the "else" condition):
Code:Jul-15 6:38:01 PM drhsIpPlugin Volume is now: 39 (originally [?? VID 3 VOL 39 ]
FWIW, I also want to grab the "VID 3" portion (other cases are VID 1, VID 2, VID 4, CD, TUNER, TAPE) and use those to set another virtual device.
Hoping this is as easy for one of you as it is hard for me. And then I'll learn something... THX!
Comment
-
Originally posted by drule View PostI started playing with iRule feedbacks as while ago and got it mostly working but I didn't fully finish it. In iRule, you create a feedback and add it to a page and then using the Send Status/Value action of an event, Homeseer can send values to iRule which will be updated on the page.
I'll dig out the example I used for testing if it helps. As I say, I never really finished it 100%, so I'd be happy to hear your ideas for how it might best function.
-David
I got my iRule controlling HS3, now I'd like to try and get feedback into some of my devices... I had a look but could not see any example. Do you still have that and could you possibly post it ?
Comment
-
Originally posted by gregoryx View PostI've been trying to get a "two way" function working with this script for many months... but, man... I just don't understand scripts.
I'm using drhsIpPlugin to control a Rotel preamp via serial through an iTach. The control works. And I've got a virtual device that holds the volume level - but it's based on keeping it in sync, not on getting feedback from the Rotel.
I've butchered one of the sample scripts to get it to show the returned data I want in the logs - so I suspect there's a way to parse that into pieces and then use it to set a virtual device.
Here's what I'm using:
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("drhsIpPlugin", "Volume is now: " & right(SplitString(0),3) & "(originally [" & SplitString(0) & "]") End Select Next End Sub
Here's what's hitting the logs right now (from the above script - everything hits the "else" condition):
Code:Jul-15 6:38:01 PM drhsIpPlugin Volume is now: 39 (originally [?? VID 3 VOL 39 ]
FWIW, I also want to grab the "VID 3" portion (other cases are VID 1, VID 2, VID 4, CD, TUNER, TAPE) and use those to set another virtual device.
Hoping this is as easy for one of you as it is hard for me. And then I'll learn something... THX!
We should be able to do something with that. It looks like the preamp is returning everything in one line. Do you have a link to any documentation on the protocol the preamp uses? It would be interesting to see if there any non-text bytes in the response. Can you try this example script?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", "There are " & BinaryData.Length.ToString & " bytes of binary data.") For n as Int16 = 0 to UBound(BinaryData) hs.WriteLog("Pass-thru" & n.ToString, BinaryData(n).ToString) Next End Sub
Comment
-
I threw together a guide for using iRule feedbacks with version 25 of the plugin. Please excuse the poor formatting.
-David
A quick guide to implementing an iRule feedback with v25 of the plugin.pdf
Comment
Comment