Shell command fails to parse when colon is part of the command

Consider the following shell_command:

shell_command:
  toggle_adguard_protection: curl -H "Authorization: Basic {{auth}}" -d "{'protection_enabled': {{enable_protection}}}" "http://{{ip_address}}:{{port}}/control/dns_config

However, the configuration validation fails on the colon after the Authorization part.
Any idea how to work around this?

You have to wrap the whole thing in quotes, but you have quotes allover it. So just use multiline indicator

shell_command:
  toggle_adguard_protection: >
    curl -H "Authorization: Basic {{auth}}" -d "{'protection_enabled': {{enable_protection}}}" "http://{{ip_address}}:{{port}}/control/dns_config
2 Likes

Thanks! I’ll try it out

This didn’t work out, no errors appear in the logs…

are you sure the command is correct? It looks suspect. You’re at least missing a quote at the end

Here’s my latest configuration

  toggle_adguard_protection: >
    curl -H "Authorization: Basic {{auth}}" -d "{'protection_enabled': {{enable_protection}}}" "http://{{ip_address}}:{{port}}/control/dns_config"

I wonder whether the adguard integration covers what you want to do? https://www.home-assistant.io/integrations/adguard/

Funny that you asked - I have two instances (one for failover) so the integration doesn’t support it.