Command Line switch doesnt appear in the dashboard

Hi there,

I am migrating from OpenHab to Home Assistant. I’ve migrated almost everything except one light controller (relays) which can be controlled only by HTTP requests. I have tried multiple solutions found in the Internet but none of them helped.

I’ve tried:
configuration.yaml

command_line:
  - switch:
      name: Light 1 Q1
      command_on: "/usr/bin/curl -X GET 'http://192.168.1.150/current_state.json?pw=admin&Relay1=1'"
      command_off: "/usr/bin/curl -X GET 'http://192.168.1.150/current_state.json?pw=admin&Relay1=0'"
  - binary_sensor:
      name: "server_ac_power"
      command: "acpi -a"
      device_class: power
      payload_on: "Adapter 0: on-line"
      payload_off: "Adapter 0: off-line"

I added binary_sensor just for testing purpose. None of them appear in the dashboard. I checked logs - no error entries. What is going on? Why swich Light 1 Q1 is not visible in the dashboard?

Thanks!

Did you check if it is in the entities? If you made an error it wont show up there and wont auto-add to the dashboard.
Speaking of which: Is the dashboard still the default one or are you trying to add by hand?

I didn’t show up in Entities, I use the default dashboard.

You should have something in the error log that points to why they failed.
A quick glance at your code and the example: Command line - Home Assistant
Shows no ’ before the http (and behind it), maybe thats it?

After restarting the docker container - switch is present in the dashboard.