Power Switches


Characteristics

The ETH boards provide contact relay outputs with a current rating of up to 16A each.
The embedded webserver enables configuring password, username, IP for the webinterface. Moreover, it enables configuring password and port settings for the "webservice" to control the board without the webserver.


Install

ETH484 and ETH008 use DHCP to get an IP. You can determine the IP by checking your DHCP or namp with a "no port scan" (-sn or in previous nmap releases -sP)

Inside a 192.168.1.0/24 network:
1) Disconnect ETH board from power and log available nodes in the network (while network cable is connected)

nmap -sn 192.168.1.0/24 > notconnected

2) Power on the ETH board (wait 15 sec) and check again the available nodes in the network

nmap -sn 192.168.1.0/24 > connected

3) Check the difference of these two files

diff notconnected connected | grep scan

(If there was no IP, try it again - nmap no port scan is not 100% reliable). Connect to the IP with a web browser:

http://192.168.1.X
 # user:admin, password:password

Configuring

I changed the follwing options:

  • Switched to a static IP
  • Changed the web-interface password
  • Changed the TCP/IP Password

Reading the current state of the relay outputs

Reading the state seems to work with authorization
Here the most important code snippets (without logging, error handling, ...) from a python example I'm using:

#!/usr/bin/python
import socket
    
ETHxxx_HOST             = '192.168.1.X'
ETHxxx_PORT             = 17494
    
def main():
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.connect((ETHxxx_HOST, ETHxxx_PORT))
        s.send( bytearray([0x24])  )
        data = s.recv(1)
        s.close()
        print int(ord(data[0]))
    
    except Exception,e:
        print 'Error : %s' % str(e)
    
if __name__ == "__main__":
    main() 

Switch the current state of the relay outputs

Switching the state seems requires authorization

#!/usr/bin/python
import socket
    
ETHxxx_HOST             = '192.168.1.XXX'
ETHxxx_PORT             = 17494
relay_id                = 2    # (choose relay 1-8)
cmd_code                = 0x20 # Switch ON
#cmd_code               = 0x21 # Switch OFF
    
def main():
    
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.connect((ETHxxx_HOST, ETHxxx_PORT))
        key = bytearray([0x79, ord('p'), ord('a'), ord('s'), ord('s'), ord('w'), ord('o'), ord('r'), ord('d')])
        s.send(key)
        data = s.recv(1)
        if data == unichr(0x01):
            print 'Authorization SUCCESSFUL at ETHxxx'
        elif data == unichr(0x02):
            print 'Authorization FAILED at ETHxxx'
    
        msg = bytearray([cmd_code, relay_id, 0])
    
        s.send(msg)
        data = s.recv(1)
    
        if data == unichr(0x00):
            print 'Command exec SUCCESS at ETH484'
        elif data == unichr(0x01):
            print 'Command exec FAIL at ETH484'
    
        s.close()
    
    except Exception,e:
        print 'Error : %s' % str(e)
    
if __name__ == "__main__":
    main()