User Tools

Site Tools


ha:sr201

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
ha:sr201 [13/06/2025 22:06] andrewha:sr201 [16/06/2025 23:15] (current) – [Testing from BASH] andrew
Line 29: Line 29:
 Below is a quick play about from BASH to test the relay with raw TCP.  ''nc'' is Netcat, a really useful utility to communicate with raw TCP/IP, either to send packets as here, but also you can use it to set up a listener on a port. See the repo link above to work out the data fed to nc from the printf. Using printf as echo by default sends a newline / CR which will upset the module. Below is a quick play about from BASH to test the relay with raw TCP.  ''nc'' is Netcat, a really useful utility to communicate with raw TCP/IP, either to send packets as here, but also you can use it to set up a listener on a port. See the repo link above to work out the data fed to nc from the printf. Using printf as echo by default sends a newline / CR which will upset the module.
 If you're stuck on windows you probably don't have netcat, yet another reason to upgrade to Linux. If you're stuck on windows you probably don't have netcat, yet another reason to upgrade to Linux.
 +
 +<code>
 +#    Commands are ASCII strings that must be sent in one packet
 +#    (even for TCP):
 +#
 +#        0R     No operation (but return status).
 +#
 +#        1R*    Close relay if it's open, wait approx 1/2 a second, open
 +#               relay.
 +#
 +#        1R     Close relay if it's open.
 +#
 +#        1R:0   Close relay if it's open.
 +#
 +#        1R:n   Close relay if it's open, then in n seconds (1 <= n <= 65535)
 +#               open it.
 +#
 +#        2R     Open relay if it's closed.
 +#
 +#    Where:
 +#
 +#        R      is the relay number, '1' .. '8' The main board has relay's
 +#               '1' and '2', the extension board (if present) has the rest.
 +#               If R is 'X' all relays are effected.
 +#
 +#    If the command is sent over TCP (not UDP, TCP only), the relay will
 +#    reply with a string of 8 0's and 1's, representing the "before" command
 +#    was executed" state of relay's 1..8 in that order.  A '0' is sent if the
 +#    relay is open, '1' if closed.
 +</code>
 +  
      
 <code> <code>
ha/sr201.txt · Last modified: by andrew

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki