Assigning a command_line switch to an area without doing custom UI changes

I’ve got a garage floodlight that’s on an amcrest camera module that is being controlled by some curl commands.

I’m wanting to set the area that it’s located in without going into advanced mode and manually taking control of the UI. The light is defined in my configuration.yml as per below.

switch:
  - platform: command_line
    switches:
      garage_floodlight:
        command_on:    '/usr/bin/curl -s --digest -u admin:password "http://IP/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2\[0\]\[0\]\[1\].Mode=Manual" '
        command_off:   '/usr/bin/curl -s --digest -u admin:password "http://IP/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2\[0\]\[0\]\[1\].Mode=Off" '
        command_state: '/usr/bin/curl -s --digest -u admin:password "http://IP/cgi-bin/configManager.cgi?action=getConfig&name=Lighting_V2\[0\]\[0\]\[1\].Mode" | grep -oc "Manual" ||true' 
        value_template: '{{ value == "1" }}' 
        friendly_name: Garage Floodlight
        unique_id: garage_floodlight

There doesn’t seem to be a method to define where the switch is located without doing manual control of the UI. It appears in the switch category of the UI. But because it does NOT have a unique_id, it doesn’t appear as though you can assign it to a room. (You can’t assign it a unique_id either).

I get why they updated the API back to make the garage_floodlight the entity id, but the lack of ability to be able to set an entity_id here kind of sucks. If nothing else, how about a toggle to assign an entity_id and a unique_id.

Is there a way to:
a) move the switch to a specific area
b) make it appear like a light
c) keep standard UI control?

1 Like

@haydon we’re you ever able to figure out a way to do this?

I’ve got basically the exact same question… Would love to just move the “Light” that I defined that’s actually some shell commands into a house “area” so it’s easy to find…

Unfortunately no - this would require the homeassistant contributors to change their code to allow this. The easiest solution is to just manually manage lovelace. I’m starting to lean towards that option as I have some sonoff s31s that I don’t always want to see the power usage on - and prefer a non cluttered main screen (with a separate tab for statistics)

1 Like

It looks like this has been added:

Configuration Documentation: