Command line switch looking like wake on line control

Edit:
Issue solved!

Hi there.
Two things in this issue:

  1. I wanted to create a command line switch that looks just like the switch of wake_on_lan platform. So there’s a lightening on the left side (yellow if device is on) and standard switch on the right.
    Default command line switch has lightening on the left and lightening on the right. I don’t want that!

  2. I want a state of switch to be linked to the device_tracker (or binary sensor basing on device tracker). I did it the most obvious way, that is:

    value_template: “{{ states.binary_sensor.soundbar.state == 'on }}”

However it looks like the state check is launched just once, right after command execution, which is too soon for device tracker…

Anyone can help with that?

Edit: stupid question - that’s template switch…

if your command line switch has a command_state command, it will take on the appearance you want.
Here I have 2 command line switches defined.

- platform: command_line
  switches:
    zone1:
      command_on:  "/usr/bin/curl -s --connect-timeout 5 \"http://ip/bin/manual?zone=zb&state=on\""
      command_off: "/usr/bin/curl -s --connect-timeout 5 \"http://ip/bin/manual?zone=zb&state=off\""
    zone2:
      command_on:  "/usr/bin/curl -s --connect-timeout 5 \"http://ip/bin/manual?zone=zc&state=on\""
      command_off: "/usr/bin/curl -s --connect-timeout 5 \"http://ip/bin/manual?zone=zc&state=off\""
      command_state: "/usr/bin/curl -s --connect-timeout 5 \"http://ip/json/zones\""
      value_template: '{{value_json["zones"][1]["state"] == "on" }}'

This is how they look:
Capture