How to troubleshoot rest_command

Hi,

I’m trying to change dashboard views based on an event. I’ve configured the rest_command in configuration.yaml.

#configuration.yaml

rest_command:
  kiosk_mainfloor_new:
    url: !secret rest_url2_kiosk_command

#secrets.yaml

rest_url2_kiosk_command: 'http://10.0.10.27:2323/?cmd={{ cmd }}&url={{ key }}&value={{ value }}&type=json&password=#####'

I know the rest command is properly formatted because if I replace the Jinja variables and hard code the cmd and url it works. Is there any way to see how the service call is passing the values ? I’m guessing the url isn’t being passed properly ?

#service call - developer tools

service: rest_command.kiosk_mainfloor_new
data:
  cmd: "loadUrl"
  url: "https://www.google.com

What happens if you put the command template directly into configuration.yaml?

Anything in the logs?

I’ve put the command directly in configuration.yaml and secrets.yaml and it works. Nothing in the system logs.

I’m fairly certain it’s the url that isn’t being parsed properly but can’t confirm.

Yes, I’m not convinced strings included via !secret are template-compatible.

rest_command:
  kiosk_mainfloor_new:
    url: 'http://10.0.10.27:2323/?cmd={{ cmd }}&url={{ key }}&value={{ value }}&type=json&password={{ password }}'
service: rest_command.kiosk_mainfloor_new
data:
  cmd: "loadUrl"
  key: "https://www.google.com"
  value: "my value"
  password: !secret rest_url2_kiosk_command_password

Would likely work, though.

I mean put it in configuration.yaml with the template as it is.

wow that was incredibly noobish of me :slight_smile:

Strings in the template work fine. It would help if I passed in the correct key though.

service: rest_command.kiosk_mainfloor_new
data:
  cmd: "loadURL"
  **key:** "https://www.google.com"