-
Notifications
You must be signed in to change notification settings - Fork 131
Items Lynx10PLC
See original
This module implements code to support the Marrick Lynx10-PLC controller. See http://www.marrickltd.com/LynX105.htm Broken Link
Note: This module adds additional capability to the MisterHouse application written by Bruce Winter ([email protected]).
Use these mh.ini parameters to enable the code:
Lynx10PLC_module = Lynx10PLC
Lynx10PLC_port=/dev/ttyS0
Lynx10PLC_baudrate=19200
These parameters allow you to override the default transmit and receive gain values
Lynx10PLC_XMIT_PWR=75
Lynx10PLC_RCVR_SENS=50
This parameter will enable the module to log data using syslogd
. This example will log data to local5
facility, with priority set to info
Lynx10PLC_LOGGER=/usr/bin/logger -p local5.info --
This parameter will allow you to specify the amount of delay time after a packet has been received before sending it onto MH. This allows multiple commands to be glued together. This time is in milliseconds
Lynx10PLC_MULTI_DELAY = 250
Method | Description |
---|---|
startup |
This code create the serial port and registers the callbacks we need |
send_plc |
This function is used convert an X10 ASCII string into a Lynx-Net packet, and then sends it to the PLC. Parameters: $serial_port : Interface to write the command to $cmd : ASCII string to parseReturns: X10 Command in ASCII format |
cmd2payld |
This function is used to convert an ASCII command into the LynxNet command payload. Parameters: $cmd : ASCII command to convertReturns: LynxNet payload in "packed" format |
processPkt |
This function is used to process a valid LynxNet packet received from the PLC Parameters: $pkt : Lynx-Net packet to processReturns: 1 |
splitPkt |
This function is to extract all of the fields from a packet and store them in global variables. Because of this, the function is NOT re-entrant. Parameters: $pkt : Packet in "packed" format to anaylze Returns: nothing |
checksum | This function is used to calculate a 8-bit checksum for a given buffer. Parameters: $buf : Buffer in "packed" format to calculate checksum on $len : number of bytes to calculate checksum onReturns: checksum |
buildPkt |
This function is used to generate a LynxNet packet based upon the packet_type and payload. Parameters: $pkt_type : Type of packet to send $payld : Lynx-Net payloadReturns: packet in "pack" format |
read |
This function is used to read data from the serial interface, and will return with a complete Lynx-Net packet. If the checksum of the packet is bad, an error message is displayed, and the packet is tossed. Parameters: $no_block : 0, timeout is 100*50msec=5secs 1, timeout is 0secs Returns: packet in pack format, or undef if no packet was read. |
send |
This function is used to send a Lynx-Net packet to the serial interface. After the packet is sent, the function will wait for both the "received", and "completed" packets to return. If a packet other that these two are received, it will be processed at this time. If the packet is not completed within an defined timeout, it will be resent, and the process will repeat, until the retry limit has been exhausted. Parameters: $pkt_type : Type of packet to send $payld : Lynx-Net payload to write Returns: 1 for SUCCESS, 0 for FAILURE |
Joe Blecher [email protected]
None