Set switch state from Binary Sensor

I have a command line switch that I’ve set up like this:

- platform: command_line
      friendly_name: Office PC
      command_on: "/bin/echo 'Ma:Ca:dd:rr:ee:ss' > /config/wolpipe"
      value_template: "{{ is_state('binary_sensor.office_pc_state', 'on') }}"
      unique_id: office_pc

And a Binary Sensor that I’ve set up like this:

- platform: ping
  name: office_pc_state
  count: 2
  scan_interval: 5

So I would expect the state of my switch.office_pc to be set true when the binary_sensor.office_pc_state is on. But no matter what the switch is not affected by the sensor. What am I missing in the way value_template is supposed to work?