IRTrans
The IRTrans I/O Server controls IRTrans Ethernet, WiFi and PoE infrared transceivers, sending infrared commands to A/V equipment and generating events when the device receives and decodes an infrared code.
Each IRTrans module is configured as a separate I/O Server. The driver keeps a persistent monitor session open to the device, so received IR codes are reported in real time, and transmits commands with low latency.
Infrared codes can be transmitted either from the remote control database stored in the device's internal flash memory, or from CCF Hex files stored locally in HSYCO's ir directory.
This I/O Server replaces the built-in IRTrans support of HSYCO 4.1 and earlier, where IRTrans devices were declared with the IRTrans parameter in hsyco.ini and controlled with the IR EVENTS keyword, the irtransCommand() method and the IREvent() callback. See Migrating from the built-in IRTrans support below.
Device Configuration
The IRTrans device should be configured with a static IP address, or a fixed DHCP assigned address.
Using the IRTrans Web Interface or the IRTrans GUI Client:
- enable the built-in IRTrans server (LAN mode), listening on its default port 21000
- store in the device's flash memory the remote control databases you want to transmit or receive
- enable the receiver if you want HSYCO to generate events on received IR codes
The driver uses port 21000 for both directions: a TCP connection for the monitor session and UDP datagrams for transmission. Make sure both are allowed on any firewall between HSYCO and the device.
CCF Hex Files
As an alternative to the device's internal database, remote controls can be defined locally in HSYCO, in the ir directory, one file per remote control, named <remote>.ccfhex.
Each file contains one line per command, in the format:
<command> = <ccf hex string>
The CCF Hex string can be split over several lines; blank lines are ignored. For example, ir/tvsony.ccfhex:
poweron = 0000 006D 0022 0002 0155 00AA 0040 0016
0040 0016 0016 0016 0016 0016 0016 0016
poweroff = 0000 006D 0022 0002 0155 00AA 0016 0016
0040 0016 0016 0016 0040 0016 0016 0016
When a command is transmitted, the driver looks up the local CCF Hex database first. If the remote control file exists and defines that command, the CCF Hex code is sent to the device; otherwise the command is sent by name and resolved by the device using its internal database.
Files in the ir directory are reloaded automatically when modified, without restarting HSYCO.
HSYCO Configuration
Add an IRTRANS I/O Server in the I/O Servers section of the Settings, one for each IRTrans device, and set its parameters.
Communication
- IP Address: IP address of the IRTrans device
- Port: leave blank to use the default port 21000
Options
| ID | Default | Values | Description |
|---|---|---|---|
| ccfhex | true | true | use the local CCF Hex database in the ir directory, when a matching remote control file exists |
| false | always transmit commands by name, using the device's internal database | ||
| commanddelay | 500 | 0 ≤ n ≤ 10000 | delay, in milliseconds, inserted between the commands of a multi-command sequence written to the tx datapoint |
| led | i | transmit on the internal IR LED only | |
| e | transmit on the external IR LED only | ||
| b | transmit on both the internal and external IR LEDs | ||
| 1 ≤ n ≤ 8 | transmit on IR output n, on devices with multiple outputs | ||
| leave blank to use the device's default output |
Datapoints
| ID | Value | R/W | Description |
|---|---|---|---|
| connection | online | R | the monitor session with the IRTrans device is established |
| offline | R | initialization of the driver failed, or the connection to the device has been lost | |
| <remote> | <command> | W | transmit <command> of remote control <remote> |
| <command>@<led> | W | transmit <command> of remote control <remote> on the specified IR output, overriding the led option | |
| rx | <remote>,<command> | R | the device received and decoded an infrared code |
| tx | <remote>,<command> | R | an infrared code has been transmitted |
| <remote>,<command> | W | transmit <command> of remote control <remote> | |
| <sequence> | W | transmit a sequence of commands, see Command Sequences below | |
| ccf | <ccf hex string> | W | transmit a raw CCF Hex code; the transmission is reported on the tx datapoint with the value ccf |
The rx and tx datapoints are transient: an IO event is generated on every reception or transmission, even when the same code repeats.
Command Sequences
The tx datapoint accepts a sequence of commands, separated by spaces or semicolons, and transmits them in order:
tvsony,poweron; @2000; tvsony,hdmi1; amp,poweron
Each element of the sequence is either:
- a command, in the
<remote>,<command>or<remote>.<command>format @<milliseconds>, an explicit pause before the next command@0, which switches the rest of the sequence to fast mode, reducing the automatic inter-command delay to 1 millisecond
Commands are separated by the delay set with the commanddelay option, unless an explicit @<milliseconds> pause is specified between them. No delay is applied before the first command of a sequence. Explicit pauses longer than 10 seconds are truncated to 10 seconds, to avoid blocking the driver's command queue.
Examples
Assuming the I/O Server ID is tv:
EVENTS - transmit a command:
TIME 23 : 00 : IO tv.tvsony = poweroff
EVENTS - transmit a sequence:
USER movie : IO tv.tx = tvsony,poweron; @2000; tvsony,hdmi1; amp,poweron
EVENTS - act on a received command:
IO tv.rx = tvsony,poweron : IO lights.living = off
IO tv.rx = tvsony,poweroff : IO lights.living = on
JavaScript:
ioSet('tv.tvsony', 'poweron');
function IOEvent(name, value) {
if (name == 'tv.rx' && value == 'tvsony,poweron') {
...
}
}
Java:
userBase.ioSet("tv.tvsony", "poweron");
static void IOEvent(String name, String value) {
if (name.equals("tv.rx") && value.equals("tvsony,poweron")) {
...
}
}
User interface - a button that transmits an IR command:
<button action="datapoint" datapoint="tv.tvsony" setvalue="poweron" displaystateindescription="false" label="Power" />
Migrating from the built-in IRTrans support
Up to HSYCO 4.1, IRTrans devices were declared in hsyco.ini and were not I/O Servers. Starting with HSYCO 4.2 they are configured as standard I/O Servers.
The ir directory and the format of the .ccfhex files are unchanged, and existing files keep working with no modification.
Configuration
Add one IRTRANS I/O Server for each IRTrans device, using the same ID the device had, so that references in your projects and code keep working with minimal changes. The retired IRTrans, IRTransIP.* and IRTransPort parameters are ignored at start-up, and are dropped from hsyco.ini the next time the Settings application saves it.
| HSYCO 4.1 - hsyco.ini | HSYCO 4.2 |
|---|---|
IRTrans = tv | ioServers = tv |
IRTransIP.tv = 192.168.0.50 | ioServersType.tv = IRTRANS |
IRTransPort = 21000 | ioServersIP.tv = 192.168.0.50 |
ioServersPort.tv = 21000 |
Programming
| HSYCO 4.1 | HSYCO 4.2 |
|---|---|
IR tv = tvsony.poweron (action) | IO tv.tvsony = poweron |
IR tv = tvsony.poweron : (trigger) | IO tv.rx = tvsony,poweron : |
irtransCommand('tv', 'tvsony.poweron') | ioSet('tv.tvsony', 'poweron') |
hsyco.irtransCommand("tv", "tvsony.poweron") | userBase.ioSet("tv.tvsony", "poweron") |
IREvent(true, 0, "tvsony,poweron") | IOEvent("tv.rx", "tvsony,poweron") |
IREvent(false, 0, "tvsony,poweron") | IOEvent("tv.tx", "tvsony,poweron") |
The ACL rules of type io still apply. The command string matched by the rules changes from <irtrans_id>=<remote>.<command> to <io_server_id>.<remote>=<command>.
Legacy User Interface Objects
The ir, irmini and irmicro objects of the HSYCO 3 user interface are no longer supported, and are automatically converted into button objects with the datapoint action when a HSYCO 3 project is migrated. The conversion assumes that the I/O Server has the same ID as the IRTrans device it replaces:
| HSYCO 3 | HSYCO 4.2 |
|---|---|
ir(tv, tvsony.poweron, ...) | <button action="datapoint" datapoint="tv.tvsony" setvalue="poweron" ... /> |
The irimage object is not converted: replace it with a button object with an icon or an image, using the datapoint action.
IRTrans Serial Gateway
The IRTrans RS232 gateway, configured as a Comm Port of type irtrans, is no longer supported.
Release Notes
4.2.0
- initial release, replacing the built-in IRTrans support of previous versions
IRTrans is a registered trademark of IRTrans GmbH.