Problem with Switch with Command Line

Hello Guys, today I am having issues with a dummy switch that depending on the state on or off is gonna send a command via curl.

this is the configuration that I put in configuration.yaml

# hue-switch    
switch2:
  - platform: command_line
  switches:
    hue_entertainment:
      command_on: curl -k --user admin:admin 'http://192.168.1.137:4490/action.html?macro=56E2755C-315F-4024-9150-51B4F349E5FC'
      command_off: curl -k --user admin:admin 'http://192.168.1.137:4481/authenticatedaction.html?macro=09DE9D03-DD73-4FBB-966C-332B5F8BCC93'

For some reason, when I add that code in the file, my home assistant interface crash and I don’t have a way to make it start. Just removing that lines make the web ui come back again, why?

the purpose of the script is having a button on the interface that when it’s gonna be on its gonna execute that command, and if I switch off the other… seems pretty easy but I can’t get what Im doing wrong here…

Thanks

try this. Your spacing was off for switches: line under platform.

# hue-switch    
switch2:
  - platform: command_line
    switches:
      hue_entertainment:
        command_on: curl -k --user admin:admin 'http://192.168.1.137:4490/action.html?macro=56E2755C-315F-4024-9150-51B4F349E5FC'
        command_off: curl -k --user admin:admin 'http://192.168.1.137:4481/authenticatedaction.html?macro=09DE9D03-DD73-4FBB-966C-332B5F8BCC93'

After making changes to your config you should run the Check Config operation (available on the General Configuration page.) That will help prevent configuration errors from keeping HA from restarting successfully.

Basically you have an indentation typo. Also there needs to be a space between switch and 2. It should be:

# hue-switch    
switch 2:
  - platform: command_line
    switches:
      hue_entertainment:
        command_on: curl -k --user admin:admin 'http://192.168.1.137:4490/action.html?macro=56E2755C-315F-4024-9150-51B4F349E5FC'
        command_off: curl -k --user admin:admin 'http://192.168.1.137:4481/authenticatedaction.html?macro=09DE9D03-DD73-4FBB-966C-332B5F8BCC93'
1 Like

didn’t even see the 2