Scince two days I am trying to figure out how to use RESTfull notification to call a home assistant script. Unfortunately there is not much information to be found for RESTfull Notifications.
I got a RESTfull command working like this:
rest_command:
call_my_script:
url: http://ha-ip:8123/api/services/script/turn_on
method: POST
headers:
authorization: !secret ha_token_rest
content-type: 'application/json'
payload: '{"entity_id":"script.tts_on_stereo", "variables":{"message":"one more test"}}'
But any try to do the following notify variant fails with message:
Logger: homeassistant.components.rest.notify
Source: /usr/src/homeassistant/homeassistant/components/rest/notify.py:216
Integration: RESTful (documentation, issues)
First occurred: 00:22:25 (2 occurrences)
Last logged: 09:44:30
Client error. Response 400: Bad Request:
NoneType: None
I tried a lot of differnent combinations under data, but allways got the same error.
notify:
- name: notify_by_script
platform: rest
resource: http://ha-ip:8123/api/services/script/turn_on
method: POST_JSON
headers:
authorization: !secret ha_token_rest
content-type: application/json
data:
what comes here? just setting the payload entries from command above did not work.
I need the script notification so i can first turn on the speakers, then call the tts service. I need to use a notify platform so it is compatible with e.g. Alert integration.
Can anyone please give me a hint, how to get this work? I have read any nearly related topic and could not find the answer, so any help would be greatly appriciated!