Hi all,
I need a little help with this project. I am trying to control my Tempur pedic bed from HomeSeer. I have obtained the Hex commands to perform the functions that I need but I am having trouble converting the Hex command string to a binary representation of the Hex command. The bed must receive commands via UDP on port 50007 and responds with an "ACK3" when the command is accepted. In Linux I can send the below command line which works perfectly but xxd does the data conversion to binary:
"echo "33053203945c0000c8" | xxd -r -p | nc -n -4u -w1 192.168.1.XX 50007"
I and running HomeSeer on Windows 10 and would like to have a vb.net script to perform the functions. Right now I have a convoluted method to control the bed. I have a .sh file with the above command on my raspberry Pi shop system and use JSON on my Windows system to run an event on the Rpi which invokes the .sh file which controls the bed. Whew...
I have the below code started but the conversion of the Hex command is not right and when I look at Wireshark I do not see the UDP command issued on the network. Also the routine says that it sends 26 bytes of data and it should send 9. Any help would be appreciated. The code I have is below:
I need a little help with this project. I am trying to control my Tempur pedic bed from HomeSeer. I have obtained the Hex commands to perform the functions that I need but I am having trouble converting the Hex command string to a binary representation of the Hex command. The bed must receive commands via UDP on port 50007 and responds with an "ACK3" when the command is accepted. In Linux I can send the below command line which works perfectly but xxd does the data conversion to binary:
"echo "33053203945c0000c8" | xxd -r -p | nc -n -4u -w1 192.168.1.XX 50007"
I and running HomeSeer on Windows 10 and would like to have a vb.net script to perform the functions. Right now I have a convoluted method to control the bed. I have a .sh file with the above command on my raspberry Pi shop system and use JSON on my Windows system to run an event on the Rpi which invokes the .sh file which controls the bed. Whew...
I have the below code started but the conversion of the Hex command is not right and when I look at Wireshark I do not see the UDP command issued on the network. Also the routine says that it sends 26 bytes of data and it should send 9. Any help would be appreciated. The code I have is below:
Code:
'*********************************************************************************** '*** This Routine should send a 9 byte binary representation of a Hex code via UDP '*** The bytCommand is sent to a Tempurpedic Adjustable Bed on port 50007 '*** The Commands are as follows: '*** Memory Position 1 Hex 33053203945C0000C8 '*** Memory Position 2 Hex 33053203945c0100c9 '*** Flat Position Hex 3305320A945C0400CC '*** Vibration 1 Hex 33053203948D007861 '*** Vibration Off Hex 3305320A9486000012 Imports System.Net Imports System.Net.Sockets Imports System.Text Sub Main(ByVal parms as Object) Dim udpClient As New UdpClient Dim GLOIP As IPAddress Dim GLOINTPORT As Integer Dim bytCommand As Byte() = New Byte() {} Dim pRet As Integer GLOIP = IPAddress.Parse("192.168.1.XX") GLOINTPORT = 50007 udpClient.Connect(GLOIP, GLOINTPORT) bytCommand = Encoding.ASCII.GetBytes("33053203945C0000C8") pRet = udpClient.Send(bytCommand, bytCommand.Length) hs.writelog("No of bytes send " & pRet) End Sub
Comment