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…
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
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.
Code in ‘yaml’ which was working for Months with no any problems:
# 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 == "10000000" or value == "11000000" or value == "11100000" or value == "11110000" or value == "11111000" or value == "11111100" or value == "11111110" or value == "11111111" }}'
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 == "01000000" or value == "11000000" or value == "11100000" or value == "11110000" or value == "11111000" or value == "11111100" or value == "11111110" or value == "11111111" }}'
value_template: '{{ value[1:2] == "1" }}'
friendly_name: Person gate
Were recently any changes in ‘platform: command line’ ?
Or other reason?
O.K. Looked deeper - there was a change…
It should be configured - as below:
# Relay SR-201; Car gate, Person gate
command_line:
- switch:
name: Car Gate
scan_interval: 5
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 == "10000000" or value == "11000000" or value == "11100000" or value == "11110000" or value == "11111000" or value == "11111100" or value == "11111110" or value == "11111111" }}'
value_template: '{{ value[0:1] == "1" }}'
- switch:
name: 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 == "01000000" or value == "11000000" or value == "11100000" or value == "11110000" or value == "11111000" or value == "11111100" or value == "11111110" or value == "11111111" }}'
value_template: '{{ value[1:2] == "1" }}'