Fusion board timeout

#1

Hi

I am using the fusion 16 relays module.

I am using socket package to send and receive data from the module, sometimes I get timeout exception for the socket.recv, I got to a point that I defined the timeout to be 5 seconds and it still happens.
It does not happen a lot but its not expected.

Thanks, Matan Milrad

0 Likes

#2

Is the fusion set up to do any other processing than computer control currently? For instance is it set up to toggle relays based on sensor input or time schedules?

0 Likes

#3

No
Just trying to turn to on 3 relays one after the other.

0 Likes

#4

Are you API encoding the packets? i.e. [170, payload_length, [payload], checksum]?

0 Likes

#5

Yes I do, it happens on set relay in bank or get relay in bank state

0 Likes

#6

Those operations run a bit longer, but not that much longer.

Can you share the code that you’re seeing the error in?

0 Likes

#7

Also what is being controlled with the relay?

If its an inductive load then it may be causing delays in the the on-board processor due to voltage spikes.

0 Likes

#8

checksum = np.uint8(170 + 3 + 254 + relay + bank_number)
command = bytearray([170, 3, 254, relay, bank_number, checksum])
self._socket.send(command)

time.sleep(0.1) # wait for response

data = self._socket.recv(5)

The timeout is on the recv()

I had the timeout exception without any load

0 Likes

#9

Does the same happen if you use the official python library: https://github.com/ncd-io/NCDEnterpise-Python/tree/master

We just updated some Fusion Compatibility thanks to community members ( @teknix ). Primarily the turn_on/off_relay_by_index functions have a fusion_turn_on/off_relay_by_index function. The rest of the commands should be interchangeable.

Does the controller alter the state of the relays when this timeout exception occurs?

I’m currently working on a more in depth recv timeout that return a false, any received data, and a human readable string outlining the error. I can post it to the dev branch if you’re interested in trying the beta.

It may not solve the issue as its more designed to solve partial return packets if there’s a delay.

0 Likes

#10

This library does not have relay set by bank with API commands.

I am not sure about if the relay state was changed when the timeout exception happened, I will try to reproduce it.

My code works fine its just that sometimes(not so frequently) this exception occurs, I also check my set/get commands and it is the same as in this library https://github.com/ncd-io/Industrial-Relay-Control.

I used to work with the fusion board with Ethernet in C# and did not encounter with that exception, the main difference is that I was using to turn power on/off to devices so was not a lot of relay on/off commands in a row, but now I am using it to control movement so there is much more of on/off commands.

0 Likes

#11

Oh I linked the wrong library above: https://github.com/ncd-io/Industrial-Relay-Control

Long day.

My main concern is a packet that the controller doesn’t understand 254 119 1 for example. This wouldn’t return anything as its not a valid command.

Honestly with network communications, sometimes packets are lost or sufficient delays between bytes are put in to timeout the command on the controller.

There may not be anything you can do outside of a try/catch to log the error and retry x times.

0 Likes