0
Отвечен
Sending UDP command by JS
Im try to controll Ashly Pema 8250 amplifier by i3pro.
I have working commands in driver tree, but i would like to write commands in script and its don't work.
Сервис поддержки клиентов работает на платформе UserEcho
Hello.
If you use Custom UDP Network, the command should look like this:
Read more here.
OK, so I have to define all commendsd in driver tree?
How can I read and send volume level and convert to eg. 0-100% if:
"Ashly encodes level as a 16-bit (two byte) value. This value's range is from -50.0dB to +12.0dB with tenth-dB
precision. The process for converting a value in dB to the encoded form is to take the dB value, multiply by 10,
and add 8192. For example, the encoded form of -6.3dB would be -6.3dB * 10 + 8192 = 8129. You can then
take that encoded value and convert it to the two bytes by converting to hexadecimal (0x1FC1). So the first
byte is 0x1F and the second byte is 0xC1."
Hello.
You can choose one of the following options:
1) Define commands in the driver and send them using the Set method.
2) Do not define commands in the driver and send data using the Send method.
In the second case the data to be sent must be specified in the script. You can read data in the EVENT_RECEIVE_TEXT or EVENT_RECEIVE_DATA events.
Hi,
Its possible to convert in script two bytes hexadecimal to one decimal value?
Im try tu use Send method (need to use hexToDec and DecToHex) but its doesn't work. What am I doing wrong?
IR.AddListener(IR.EVENT_ITEM_PRESS, IR.GetItem("Page 1").GetItem("buttonJS"), function()
{
IR.GetDevice("ASHLY").Send(['0xaa,0xaa,0xaa,0xaa,0x00,0x14,0xAA,0x01,0xf3,0x1b,0x64,0x65,0x66,0x61,0x75,0x6C,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x0A,0x04,0x00,0x05,0x00,0x03,0xFF', '\r\n']);
//IR.GetDevice("ASHLY").Send(['AA AA AA AA 00 14 AA 01 F3 1B 64 65 66 61 75 6C 74 00 00 00 00 00 00 00 00 00 00 01 00 00 0A 04 00 05 00 03 FF', '\r\n']);
//IR.GetDevice("ASHLY").Send(['0xaa 0xaa 0xaa 0xaa 0x00 0x14 0xAA 0x01 0xf3 0x1b 0x64 0x65 0x66 0x61 0x75 0x6C 0x74 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x0A 0x04 0x00 0x05 0x00 0x03 0xFF', '\r\n']);
IR.ShowPopup("Popup 1");
});
Make a delay before sending the command. In your case, the driver probably didn't have time to initialize. Select the delay experimentally. Example in the attachment.
Ashly.irpz
Im try timeout 500, 1000, 1500 but doesn't work :(
what is correct syntax?
0xaa,0xaa,0xaa,0xaa,0x00
0xaa 0xaa 0xaa 0xaa 0x00 0x14 0xAA
AA AA AA AA 00 14 AA 01 F3 1B 64 65
The syntax in the project we attached earlier is correct (0xaa). The project sends data via UDP at the start with a delay. Make sure that you have UDP connections enabled on the port specified in the project. You may have a firewall blocking UDP connections.
UDP connection is correct because if I copy these syntax to command in driver tree and its works
0xAA,0xAA,0xAA,0xAA,0x00,0x14,0xAA,0x01,0xF3,0x1B,0x64,0x65,0x66,0x61,0x75,0x6C,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x0A,0x04,0x00,0x05,0x01,0x03,0xFF
Attach your project where you set up sending commands in channels (i.e. the project that sends the command correctly).
Ashly.irpz
Hello.
In your project a packet is sent from the channel:
You can use the script to send it like this:
The result will be exactly the same as in the screenshot above.
YES! :)
If I use your script its work correct. After check - in my script is ' ' before and after syntax.
IR.GetDevice("ASHLY").Send(['0xAA,0xAA,0xAA,0xAA,0x00,0x14,0xAA,0x01,0xF3,0x1B,0x64,0x65,0x66,0x61,0x75,0x6C,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x0A,0x04,0x00,0x05,0x01,0x03,0xFF', '\r\n']);
Yes, you need to send an array in the Send method. In your case, you need an array of numbers in HEX, not an array of strings.
Im try to receive data from ASHLY.
IR.AddListener(IR.EVENT_RECEIVE_DATA, IR.GetDevice("ASHLY"), function(data)
{
IR.Log(data);
});
receive in ASCI, could I receive in HEX? Or convert to HEX?
How can I change status if receive:
and change if receive:
I make it. Its possible to make easier?
IR.AddListener(IR.EVENT_RECEIVE_DATA, IR.GetDevice("ASHLY"), function(data)
{
IR.Log(data);
if ((data) == "143,143,143,143,0,20,170,1,243,27,1,2,0,0,2,3,0,5,1,255") {
IR.Log("WC1mute");
}
if ((data) == "143,143,143,143,0,20,170,1,243,27,1,2,0,0,2,3,0,5,0,255") {
IR.Log("WC1unmute");
}
});
Hello.
To interpret the data received from the device, you need to refer to the documentation for the device. It is possible that interpretation via a condition, as in your example, is the solution for your case.
In documentation are:
"bytes 12-15 basically reserved by Get Parameter Header."
Sometimes byte 12 are 0, sometimes 20, 30, 100, 101 but i need rest of bytes not that.
Can you attach this documentation here?
Ethernet-Communications-v5_3.pdf
Hello.
You need to parse the resulting array using a script. This data cannot be converted to an ASCII string. For example, you only need 15-18 bytes for a string: 0x8F,0x8F,0x8F,0x8F,0x00,0x14,0xAA,0x01,0xF3,0x1B,0x01,0x00,0x00,0x00,0x02,0x03,0x00,0x05,0x00,0xFF:
Hello.
Im receive data but sometimes some part of syntax in the middle (byte 12-15) are different. How can I skip it?
{
IR.Log(data);
if ((data) == "143,143,143,143,0,20,170,1,243,27,1,2,0,0,2,3,0,5,1,255") {
IR.Log("WC1mute");
}
Hello.
What do you mean? Do you want to delete 12-15 bytes from the array?
Hello.
Do you need our help at the moment?