I’ve got a 2010 8-relay board with a Lantronix ethernet adapter that I’d like to control from python. I’ve got the ncd_industrial_relay.py code from the github repo, and edited it as per a different post I read suggesting that these older boards need something like this (no ‘self.wrap_in_api()’):
In any case, I only ever get a timeout when running:
import socket
import ncd_industrial_relay
#set up your socket with the desired settings.
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #instantiate the board object and pass it the network socket
board1 = ncd_industrial_relay.Relay_Controller(sock) #connect the socket using desired IP and Port #IP_ADDRESS = “192.168.1.37” #PORT = 2101
IP_ADDRESS = “192.168.0.12”
PORT = 10001
I would first attempt to use Base Station to control the relays: Start - NCD.io
Power cycle the board and close any application that may be holding a socket open to the relay controller. You might even restart the computer just to make sure nothing is attempting to connect to it.
If Base Station is unable to control the relays then most likely there’s a fault on the board or a misconfiguration on the Ethernet module. For the code above it should be setup to act as a TCP server.
Can you send the configuration settings of your Ethernet module?