Try, experiment…yeah… I have been doing nothing but this !
Instead of continuing to throw darts in the dark and hope to hit the target, I decided to turn the lights on ![:wink: :wink:](https://community.home-assistant.io/images/emoji/twitter/wink.png?v=12)
I modified the receiver to trace in a log any malformed incoming request.
For memory, my simple need is to send a GET request like this, with 2 parameters :
/?topic=blind1&cmd=u
Playing with Rest Notify service
First basic try in configuration.yaml
notify:
- name: my_target
platform: rest
resource: http://local_ip_address
After a full HA restart, I go to developer tools and call the service
notify.my_target
There are several parameters in the UI.
message is mandatory. I enter sample_text there and click “Call Service” button.
The target receives:
GET /?message=sample_text HTTP/1.1
This is a correct GET request, except that I did not expect the first parameter “message” to be forced there by HA.
Fortunately, my requests always start with the same literal, and again fortunately, it can be changed in HA with the additional setting:
message_param_name: "topic"
With this, the target receives
GET /?topic=sample_text HTTP/1.1
Sounds like a good start!
I tried to send a more realistic request “blind1&cmd=u” by simply putting it into the message field. It failed miserably !
The target receives:
GET /?topic=blind1%26cmd%3Du HTTP/1.1
There seem to be no way to send an & or = as a string in the message.
I assume that the data: dictionary parameter would help with additional parameters.
So I tried this in the config:
notify:
- name: my_target
platform: rest
resource: http://local_ip_address
message_param_name: "topic"
data:
"cmd": "{{ cmd }}"
I call the service like this:
service: notify.my_target
data:
message: blind1
data:
cmd: u
The target now receives
GET /?topic=blind1&cmd= HTTP/1.1
Almost good, except that cmd parameter remains empty.
I tried syntax variants in dev tools and in a script with no success.
I am doing something wrong in either settings or service call or both, and can’t see what.
I give up with REST notification service and will try with the Rest command service, hoping for better results.