Rest_command vs notify problems?

Hi All,

I’ve just updated to the latest release 0.36.1 and was pleased to see rest_commands added, which prompted me to move my (non notify rest commands) away from the notify configuration and into the rest_command configuration which was more logical. Here comes the but…

I don’t seem to be able to change the url or payload for a get request using a script or developer tools…

rest_command:
  myapi_demo:
    url: 'http://api.domain.com/'

Selecting the rest_command domain and myapi_demo from the developer tools the REST command fires but I cannot seem to change the url or more importantly the payload for a get command? Equally, if I use a script in the same way I would have set the parameters for a notify REST they don’t seem to work for the new rest command. I’m going to try templates next but the trouble is I don’t want to use data from another sensor but use literal hard coded data passed in through a script or automation.

I suspect this might just be my understanding of how this works but it’s a real shame the example doc does not give an example to clear this up.

Will update here if I get this fixed but hopefully someone can shed some light on this?

Using the following JSON not working:

{ "payload" : "?parama=123&paramb=456" }

Hopefully someone else is having this problem but my Forum and chat search having turned up anything yet.

I forgot to give an example of calling from a script or automation…

alias: "Demo script called from UI"
sequence:
  # Send telegram
  - service: notify.tg_hass
    data:
       title: Test Telegram
       message: This is an example
  - service: rest_command.myapi_demo
    data:
       payload: >
          ?parama=123&paramb=456

It calls the rest command url that has been set in the configuration but it does not send any parameters. This all works fine using the Notifications component and REST but why does it not work with the new Rest Command?

I’m sure it going to be bang head again wall very soon but can’t believe no one else is having any issues with this?

Anyone?

I’m having same issue :frowning: @pvizeli any hints?

I’m pushed for time on other projects at the moment but you could just continue with Notify or better still command line or AppDaemon. When I get more time I will update here if I have any more information. Sorry not to be able to help at this moment in time.

as per https://github.com/home-assistant/home-assistant/issues/6781

url: 'https://192.168.1.154/tools?cmd=NeoPixelAll,{{ states("sensor.northpool_current_percent")|int }},{{ 100 - states("sensor.northpool_current_percent")|int }},0'

works like a charm