Page 1 of 1

Support for Ethernet relay board

Posted: Wednesday 31 May 2017 17:39
by PieterS
Would be nice for me if I could select New hardware: A relayboard, named SR-201, which can be reached to activate relays by sending http-commands over TCP or UDP.

It is a small, cheap device with 2 relays and 6 extensions for relays and an ethernet-interface. Powered by Micro USB power supply, 5 V

On http://www.ebay.com/itm/LAN-Ethernet-2- ... SwTM5Y3hlY

There is Java-code and Perl-code on https://github.com/cryxli/sr201
Generating that code gives a simple application but no timers or notifcation of logs. I thought, very handy to use by Domoticz; send with http-commands by buttons in that application.

Thank you in advance.

Re: Support for Ethernet relay board

Posted: Wednesday 31 May 2017 18:29
by SweetPants
Create dummy switches and use "On Action" scripts or HTTP command to send the right code's via ethernet. No need for separate hardware.

Re: Support for Ethernet relay board

Posted: Thursday 01 June 2017 12:21
by PieterS
Ok, thnx for quick and clear answer. I will give it a try.

Re: Support for Ethernet relay board

Posted: Tuesday 04 December 2018 20:58
by thomasx
did you have luck with the relay board already?
I have the same board, it works fine with the pc software.
But I can't find the right commands to send from domoticz.
When i use for example http://192.168.1.100:6722,11 or http://192.168.1.100:6722:11
it doesn't do anything.
Can anyone please give me advise TO find the right way to send commands via tcp ?

Re: Support for Ethernet relay board

Posted: Tuesday 04 December 2018 21:05
by SweetPants
You can't use http to send the command(s). If you look at the Perl script https://github.com/cryxli/sr201/blob/ma ... gSR-201.pl it uses telnet internally. Why not use this script and call it from the On/Off actions in Domoticz using script:///<your script>.

Re: Support for Ethernet relay board

Posted: Sunday 09 December 2018 17:02
by fabry91
I tried different command found into the document here https://github.com/cryxli/sr201/blob/ma ... gSR-201.pl

But I can't get it working, anyone has got the realy powering on and off with the dummy device?

Thank you!!!! :|

Re: Support for Ethernet relay board

Posted: Monday 04 February 2019 22:01
by PieterS
For every choice on the selectorswitch I made a seperate batchfile. In the command I made a call to the external command NETCAT that I had to install on my Synology.
I try to explain it in short batchfile

Code: Select all

## Batchfile voor aantrekken relais 3 (met vertraging van 1 seconde)
##
## Let op: Volledige pad opgeven naar script anders weet Domoticz batchfile niet te vinden.
## Let op: er mag NIETS achter het ECHO-commando komen!!!
## Parameter -c is belangrijk want anders wacht OS gedurende 5 seconden op response van device!
##
## Release alle relais, slaap 1 seconde, pull relais 3 gedurende 20 minuten
///volume1/Pieter/Domoticz/scripts/Relais3-off.sh && sleep 1s && echo -n "13:1200" | nc -c 192.168.1.100 6722
Hope you understand my dutch
Image

Re: Support for Ethernet relay board

Posted: Wednesday 05 January 2022 20:27
by fabry91
PieterS wrote: Monday 04 February 2019 22:01 For every choice on the selectorswitch I made a seperate batchfile. In the command I made a call to the external command NETCAT that I had to install on my Synology.
I try to explain it in short batchfile

Code: Select all

## Batchfile voor aantrekken relais 3 (met vertraging van 1 seconde)
##
## Let op: Volledige pad opgeven naar script anders weet Domoticz batchfile niet te vinden.
## Let op: er mag NIETS achter het ECHO-commando komen!!!
## Parameter -c is belangrijk want anders wacht OS gedurende 5 seconden op response van device!
##
## Release alle relais, slaap 1 seconde, pull relais 3 gedurende 20 minuten
///volume1/Pieter/Domoticz/scripts/Relais3-off.sh && sleep 1s && echo -n "13:1200" | nc -c 192.168.1.100 6722
Hope you understand my dutch
Image
Hello Pieter,

hope you can help me, I also have a SR-201 fully working on raspberry enviromental with netcat command like: "echo -n "21" | nc -n -w 1 192.168.0.99 6722"

Now I have migrated Domoticz to Synology, DSM 7.0, I'm having problem to run the script, in this post there are all the details
Spoiler: show
viewtopic.php?f=11&t=37743&p=284705#p284705
Right now I am in the situation that Domoticz logs tells me: "Error executing script command (/opt/domoticz/scripts/relay_ch1_off.sh). returned: 32512".

Thank you very much in advanced!

Re: Support for Ethernet relay board

Posted: Wednesday 05 January 2022 21:43
by PieterS
H Fabry91,

Oh, another goal for me. :? Up till now I didn't had that failure because I didn't test that option. Since a week I changed from version 2020.1 (Jumbotroll) to a docker container on my DS718+. Still running on DSM 6.2...

At this moment I didn't use that feature with the relayboard because it is a switch for the gardenpump and valves for irrigation... No need in winter. :lol:

I did a short test and got the same error in the log:

Code: Select all

2022-01-05 21:22:53.809 Beregening: Light/Switch (Sector beregening)
2022-01-05 21:22:53.801 Status: User: Admin (IP: 192.168.1.108) initiated a switch command (745/Sector beregening/Set Level)
2022-01-05 21:22:53.804 Error: SQLHelper: Error script not found '/opt/domoticz/scripts/Relais1-on.sh'
And I am pretty sure the scripts are in that path.

How did you figure out that the solution is a &-character at the end of the commandline? Didn't help me.

About the error you mentioned:

I got that when I did an upgrade of the package of Domoticz from Jumbotroll. The path to Netcat seemed to be lost or so. Solution for me was to install the package of Netcat again. Maybe that helps you a bit?

Anyway, another goal for me. Let us know if your problem is solved and especially how! :P