Announcement

Collapse
No announcement yet.

sending IR fron hstouch3

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

  • sending IR fron hstouch3

    Hello,

    I've a bit trouble to send ir codes to my IR devices from hstouch3, with a sq blaster.

    In HStouch 2 was is quite easy. (make a button and give it this script: &hs.sendIR "[JVC]LV_TV, POWER_TOGGLE" )

    But how does this work in HStouh3

    I hope someone can help me with this problem.

    I did try it with events but that go too slow. especially if I type in a channel number like 123. My TV will go to channel 1. so this is not a good way to send IR signals from hstouh3 to my IR devices.

    Kind regards,
    JD

    Hardware:
    SQ-blaster
    SQ blaster +

    Software

    HS PRO 3 on a Windows 7 machine
    SQ-blaster plugin
    Last edited by JQJQ; February 25th, 2015, 05:54 PM. Reason: extra explanation

  • #2
    I am not sure about the SQ Blaster connection, but I use the script below to send IR commands to my iTach WF2IF. Maybe it can be adapted for your Blaster. It is not slick code but it works.

    Bob

    Code:
    ' import required modules
    Imports Cisco.txt
    Imports System.Net
    Imports System.Net.Sockets
    Imports System.Text
        Sub Main(ByVal parms as Object)
            Const Host = "192.168.1.250"
            Const HostPort = 4998
            Const Digit_1 = "sendir,1:2,1,57571,1,1,191,191,46,141,46,141,46,46,46,141,46,141,46,46,46,46,46,46,46,46,46,141,46,46,46,46,46,46,46,141,46,46,46,46,46,141,46,141,46,141,46,141,46,46,46,141,46,2150"&vbCR
            Const Digit_2 = "sendir,1:2,1,57571,1,1,191,191,46,141,46,141,46,46,46,141,46,141,46,141,46,46,46,46,46,46,46,141,46,46,46,46,46,46,46,141,46,46,46,46,46,46,46,141,46,141,46,141,46,46,46,141,46,2150"&vbCR
            Const Digit_7 = "sendir,1:2,1,57571,1,1,191,191,46,141,46,141,46,46,46,141,46,141,46,46,46,141,46,141,46,46,46,141,46,46,46,46,46,46,46,141,46,46,46,46,46,141,46,46,46,46,46,141,46,46,46,141,46,2150"&vbCR
            
            
            Dim test as Integer = 1
            Dim device_ref as Integer
            device_ref = hs.GetDeviceRefByName("1st Floor Network VIZIO Television")
     '      If hs.IsOn(device_ref) Then
            If test = 1 then
                 Dim tcpClient As New System.Net.Sockets.TcpClient()
                 tcpClient.Connect(host, hostport)
                 Dim networkStream As NetworkStream = tcpClient.GetStream()
                 Dim strResponse As String
                 strResponse = "No response"
                 If networkStream.CanWrite Then
                    Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(Digit_1)
                    networkStream.Write(sendBytes, 0, sendBytes.Length)
                    Dim bytes(tcpClient.ReceiveBufferSize) As Byte
                    networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
                    Dim returndata As String = Encoding.ASCII.GetString(bytes)
                    strResponse = "Device responded: " & CStr(returndata)
                    Dim sendBytes2 As [Byte]() = Encoding.ASCII.GetBytes(Digit_2)
                    networkStream.Write(sendBytes2, 0, sendBytes.Length)
                    Dim bytes2(tcpClient.ReceiveBufferSize) As Byte
                    networkStream.Read(bytes2, 0, CInt(tcpClient.ReceiveBufferSize))
                    Dim returndata2 As String = Encoding.ASCII.GetString(bytes2)
                    strResponse = "Device responded: " & CStr(returndata)
                    Dim sendBytes3 As [Byte]() = Encoding.ASCII.GetBytes(Digit_7)
                    networkStream.Write(sendBytes3, 0, sendBytes.Length)
                    Dim bytes3(tcpClient.ReceiveBufferSize) As Byte
                    networkStream.Read(bytes3, 0, CInt(tcpClient.ReceiveBufferSize))
                    Dim returndata3 As String = Encoding.ASCII.GetString(bytes3)
                    strResponse = "Device responded: " & CStr(returndata)
                 Else
                    If Not networkStream.CanWrite Then
                       strResponse = "Error: Cannot write data to the device"
                       tcpClient.Close()
                    End If
                 End If
            End If
          End Sub

    Comment

    Working...
    X