SR-201 Ethernet Relay Board HassIO integraiton

What do you want to know?

This is the configuration I have ended up with

- platform: command_line
  scan_interval: 5
  switches:
    floodlight_led:
      command_on: echo -n 11 | nc 192.168.1.100 6722
      command_off: echo -n 21 | nc 192.168.1.100 6722
      friendly_name: LED
    floodlight_main:
      command_on: echo -n 12 | nc 192.168.1.100 6722
      command_off: echo -n 22 | nc 192.168.1.100 6722
      friendly_name: Left

I have personal and car gate. Now they are opened by 2 push-button switches.
So 1 relay i could use for ‘personal gate’ and 2nd for ‘car gate’.
I need to get let’s say 1 second impuls on each relay.
Not sure hot to do that via ‘command_line’. As long pressing the buttons is causing unexpected results on the magnet coils…

O.K. I looked in some instructions, so in my case I should send:

command_on: echo -n 11:1 | nc 192.168.1.99 6722

Do you mean that you don’t want the relay to be self-locking and be in inching mode?

So turning on for 1 second and immediately off to trigger your gate right?

EDIT: OK yeah there should be a guide with the different commands to use

Yes, this is what I need. As I see it it also ‘1 shot’ or ‘jog’ command:

command_on: echo -n 11* | nc 192.168.1.99 6722

I thought it was 11* to do it but it’s probably a trial and error thing. The rest of the code should work. Just try different command option till you get it right.

My only issue I was having was that there was some degree of delay from pressing the button to the relay reacting

EDIT: Haha keep getting that 10 seconds delay. Glad you are sorted it though. Didn’t need any help after all :stuck_out_tongue:

Also some video with instruction…

SR-201 relay instruction…

1 Like

Yeah those little exe files are very handy for giving it a desired IP and checking the different code options

In my case following configuration is working:

# Relay SR-201; Car gate, Person gate
  - platform: command_line
    scan_interval: 5
    switches:
      car_gate:
          command_on: echo -n 11:1 | nc 192.168.1.99 6722
#        command_off: echo -n 21:1 | nc 192.168.1.99 6722
          command_state: echo -n '00:0^' | nc 192.168.1.99 6722
          value_template: '{{ value[0:1] == "1" }}'
          friendly_name: Car gate
      person_gate:
          command_on: echo -n 12:5 | nc 192.168.1.99 6722
#        command_off: echo -n 22:1 | nc 192.168.1.99 6722
          command_state: echo -n '00:0^' | nc 192.168.1.99 6722
          value_template: '{{ value[1:2] == "1" }}' 
          friendly_name: Person gate

‘command_off’ is blocked as I use kind of timers in both cases: ‘11:1’; ‘22:5’.

1 Like

I also made proper connections and tested all.
All is working. So I can advice such solution in case someone wants to have control of the gates via ‘Home Assistant’.

As a next step I wanted to have on the ‘car gate’ a sensors checking if gate is open or close.
Someone can advice a good quality external sensors? I prefer via cable, not radio/Wi-Fi.

Via cable I would just recommend a normal open/close contact connected to an ESP8236 running ESPHOME (it’s very easy). You could even connect the physical push buttons if you would want to monitor that too. Although probably unnecessary as I assume those are only accessible by you.

Yes, I tried market available contacts, simple proximity switches. But they are poor quality…
And after longer exposure to rain/low-high temperature, etc. they are useless…
So I’m asking for good quality examples.

I don’t have one specific example to give you unfortunately. But I’m pretty sure the magnetic switches they came in metallic enclosures, and not just plastic ones. So those should be fine for outside usage I would have thought.