Why can't I create a command line sensor?

I am trying to create a sensor via configuration.yaml The command itself works fine, but after restarting home assistant os, its effect disappears and it needs to be run again

sensor:
  - platform: command_line
    name: Wireguard addon internal IP # Creates the IP route to support ESPHome devices on Wireguard
    command: host_result=$(host a0d7b954-wireguard); addon_ip=${host_result##* }; ip route replace 192.168.1.0/24 via $addon_ip; echo $addon_ip

As far as I understand, if I have a configuration a new entity should be created and the command applied. I can’t see the entity and the command doesn’t work automatically. Any ideas?

Old setup, look here
Command Line - Home Assistant (home-assistant.io)

1 Like