Help with value_template delay

Hi.

I am new to Home Assistant. I think I have most things figured out but the value_template still confuses me. I’ve seen the help page but didn’t help much.
I have this switch

  - platform: command_line
    switches:
      raspbx_wg:
        command_on: "ssh [email protected] 'wg-quick up wg0'"
        command_off: "ssh [email protected] 'wg-quick down wg0'"
        command_state: ssh [email protected] 'asterisk -rx "sip show peer HOME" | grep -q "UNREACHABLE" && echo "0"'

that starts a Wireguard VPN in my raspbx. The command state returns 0 if the trunk HOME is unreachable (vpn off). I want to add a value_template so I can see the vpn’s state.
I have two problems:
1 - Don’t know the exact syntax I should use to convert the ‘0’ to off
2 - The vpn takes some seconds to get up and make the trunk online. That means that the command_state triggered immediately after the ‘on’ would still return 0

Any help?

Thanks

Never mind. I’ve figured it out :slight_smile: