CommandFusion Wiki

Documentation Resources

User Tools

Site Tools


hardware:cflink:relay-modules

Relay Ports CFLink Protocol

The following documentation describes the CFLink protocol for controlling relay ports on any device with relays.
This includes relay modules, cards and standalone devices such as the CF Mini

Queries

STA - Query Status

The STA (Status) query returns the status of all relays in a single module/device.

Data

  • <MODULE> = The module number to request the status of. 2 chars, uppercase 'M' followed by the module number.
  • eg. M1 = Module 1, M4 = Module 4.

Reply

  • <RELAYDATA> = For each relay port in the module/device, the port status is returned in P##:<STATE> format. Multiple relay ports are included in a single reply using the Port Separator | (Pipe character)
    • <STATE> = Single digit, 0 = Relay Open, 1 = Relay Closed.

Example

Error

  • 004 = Invalid Module Number

POS - Query Power On State

The POS (Power On State) query returns the power on state for all relays in a single module/device.
This determines the state a relay will be set to when the device starts up (eg. after a power failure, restart, etc).

Data

  • <MODULE> = The module number to request the power on status of. 2 chars, uppercase 'M' followed by the module number.
    • eg. M1 = Module 1, M4 = Module 4.

Reply

Example

Error

  • 004 = Invalid Module Number

Configuration Messages

POS - Configure Power On States

The POS (Power On State) command is used to configure the power on state of all relays in one or more modules/devices.
This determines the state a relay will be set to when the device starts up (eg. after a power failure, restart, etc).
If some relay port configurations are to remain unchanged, simply omit them from the message.

Data

  • <RELAYSTATES> = Any relay port in the module/device that needs to be configured must be entered in P##:<STATE> format. Multiple relays can be configured in a single command by using the Port Separator | (Pipe character)
    • <STATE> = Single character:
      • 0 = Relay open on power on (Default)
      • 1 = Relay closed on power on
      • L = Resume last state on power on

Reply

The changes take affect immediately. See the POS Query Reply for more details.

Example

Error

  • 003 = Invalid Port Number
  • 004 = Invalid Module Number
  • 401 = Invalid Relay Power On State

TGT - Configure Notification Targets

The TGT (Target) command is a Common Command used across all CFLink devices. For relay modules, this command will configure where STA (Status) notifications are sent.

The STA notification can be sent from a relay under the following circumstances:

  1. Physical 'test' switch on the modular base unit is pressed.
  2. A SET command is issued, including a second notification for Pulse commands.

Data

See the TGT common command for more information.

Reply

See the TGT common command for more information.

Transmission Messages

SET - Set Relay States

The SET command is used to set the state (open or closed) of relay ports across one or more modules/devices.

Data

  • <MODULE> = The module number to change the state of. 2 chars, uppercase 'M' followed by the module number.
    • eg. M1 = Module 1, M4 = Module 4.
  • <RELAYDATA> = For each relay port in the command, the port state is written in P##:<STATE> format. Multiple relays can be changed in a single command by using the Port Separator |
    • <STATE> = Single character:
      • 0 = Open relay
      • 1 = Close relay.
      • T = Toggle relay state. If relay was closed, it will open. If relay was open, it will close.
      • P = Pulse relay. This requires a third parameter to the message: P##:P:<TIME>.
        • <TIME> = The time to pulse, 00000 - 99999, 100ms resolution.
          • 00010 = Pulse for 1 second
          • 00600 = Pulse for 1 minute
          • 36000 = Pulse for 1 hour
NOTE: ANY SET COMMAND SENT TO A PORT THAT IS IN THE MIDDLE OF A PULSE ACTION WILL CANCEL THE PULSE ACTION AND OVERRIDE THE RELAY STATE IMMEDIATELY.

Reply

Note that the reply data will contain relay data for port in the module/device.

STA replies can be configured for notification targeting using the TGT command.
All replies will be sent back to the sender, as well as any configured notification targets.
In the case of a pulse command, there will be two status replies sent, one for when the relay is closed, and one for when it is opened at the end of the pulse.

Example

Error

  • 003 = Invalid Port Number
  • 004 = Invalid Module Number
  • 402 = Invalid Relay State
hardware/cflink/relay-modules.txt · Last modified: 2015/10/12 22:23 by jarrod