Control of an "internet relay board" bit of help

Folks, I have already got it working, but need a bit of help with the mechanics of what is going on.

A long time ago I bought a board that connects to the internet and has two relays on it.
They can be controlled from the net.

There are two ways of going this: TCP and UDP.
They supply an “app” to do it, but I have sort of back-engineered how it works and so now I can control it from other devices.

This is what I have on NR:

[{"id":"6efacc1a.0c2234","type":"inject","z":"2d44537.f26082c","name":"","topic":"","payload":"11","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":3170,"wires":[["caa11367.2b1738"]]},{"id":"caa11367.2b1738","type":"udp out","z":"2d44537.f26082c","name":"","addr":"192.168.0.21","iface":"","port":"6723","ipv":"udp4","outport":"","base64":false,"multicast":"false","x":480,"y":3170,"wires":[]},{"id":"303fcdc.485b232","type":"inject","z":"2d44537.f26082c","name":"","topic":"","payload":"21","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":3210,"wires":[["caa11367.2b1738"]]},{"id":"4b6be5c4.dd0e34","type":"inject","z":"2d44537.f26082c","name":"","topic":"","payload":"11*","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":3130,"wires":[["caa11367.2b1738"]]},{"id":"87eb840a.c305c","type":"tcp out","z":"2d44537.f26082c","host":"192.168.0.21","port":"6722","beserver":"client","base64":false,"end":false,"name":"","x":480,"y":3330,"wires":[]},{"id":"8a3ac7d2.f423f8","type":"inject","z":"2d44537.f26082c","name":"","topic":"","payload":"11","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":3330,"wires":[["87eb840a.c305c"]]},{"id":"c9ed75f.9075388","type":"inject","z":"2d44537.f26082c","name":"","topic":"","payload":"21","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":3370,"wires":[["87eb840a.c305c"]]},{"id":"aaacbf9c.d03868","type":"inject","z":"2d44537.f26082c","name":"","topic":"","payload":"11*","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":3290,"wires":[["87eb840a.c305c"]]},{"id":"5109ce29.870c98","type":"comment","z":"2d44537.f26082c","name":"Ethernet Relay control","info":"","x":450,"y":3090,"wires":[]}]

Boring, I know.

But where I am stuck is that if the app uses TCP/HTP, then I can get back the state of the relays.
Yes, I know this isn’t where they were made, but to get an idea of what the nodes do…

I can also get the information by telneting to the IP address.
I enter the “command” and I get back a series of numbers representing the state of the relays.

That is via TCP.

So I am stuck why when I put a TCP RX node and set it to monitor the channel, NR complains saying the port is already busy/used.

Yeah, for TX not RX. I know (appreciate) this is a bit off topic, but I am simply wanting to learn.
As I have the operation of the relays working with NR, I thought it wouldn’t hurt to ask.

You need to tell us about your platform and more about the relay and how it is connected.

Basically, the problem is that something has already taken exclusive access to the port before NR can get to it.

With more info, people will possible be able to help.

It is a "stand alone" board which is controlled by a custom app/program.

I used wireshark to work out what was going on and then decided to use NR to control it.

The custom program has either TCP or UDP comms.

If I use TCP and I send a command to the board, I get back a string of 8 bytes and the relay that is operated has its bit set to 1.

That is on channel 6722.

So, given the config I posted I can turn the relay(s) on/off as I want either by TCP or UDP.

ORIGINALLY (and I say that as now, when I try it again it isn't complaining) if I put in a TCP RECEIVE node, and set it to listen to port 6722, it would complain that 6722 was "already in use" - or something like that.

Now I seem to be able to have the TCP RECEIVE node and DEBUG node and it deploys, but I am not receiving any data on that node.

The thing is, that with their app, it has a small window and I see the data being sent/received by/to the board.

For the sake of it, I was wanting to try and capture the return TCP data so I can indicate via NR the state of the relays.

The program/app does NOT work on Ubuntu and so I can't just rattle off a screen grab. It wants windoze.

But this is the NR config now. (Picture only)

As I can't produce the problem any more, I guess I will just have to let this one go to the keeper - as it were.

But I shall have to further investigate how to get the TCP packets coming back to the app.
(They are probably on yet another channel and not 6722, though the app implies that.)

Oh, here is WireShark's result and you can see that it is using 6722. Though I did also try the other one shown (receive) and also didn't get any results.

Screenshot%20from%202018-06-15%2011-33-27

Screenshot%20from%202018-06-15%2011-49-54

Did you try the TCP request node, that will wait for a reply from the other end.

Thanks.

Didn’t think of using that node - probably because I didn’t know it existed.

Did you get this working in the end? I am trying to use the Sainsmart TCP controlled relay board from Bangood and looking for some tips on getting this going with NR.

Thanks!

Hi, and welcome to the forum.

This thread is 2 years old - you really should create a new thread - hopefully you will then get more responses.