TCP commands for Ethernet relay swipe button/status problem

Hello everyone,

I created a python function that commands me a remote relay device. If I run the python function from the terminal, everything works correctly. I have also created another function that reads the status to me and as an output on the screen gives me 0 if the relay is on and off if the relay is off, attached to the relay I have a light bulb that turns on correctly and turns off correctly at the command .

Now I tried to implement everything on home assistant, I used Command Line Switch.

now however I have a problem, it seems that the state does not work, that is when I swipe the button, the button returns to after a few seconds to the original place, also it does not change the status of the switch.

Below is the code for the switch.yaml

  - platform: command_line
        command_on:  python3 /home/homeassistant/.homeassistant/component/atena/ '' 9761 38 3 'on'
        command_off: python3 /home/homeassistant/.homeassistant/component/atena/ '' 9761 38 3 'off'
        command_state: python3 /home/homeassistant/.homeassistant/component/atena/ '' 9761 38 3
        value_template: '{{ state == "1" }}'

Can anyone give me any suggestions?

I also noticed that the light turns on only if I double click on the end of the button

try something like this, not sure

value_template: "{{ states.light.tec_light.state == '1' }}"

does not work