POST request with dynamic body text from HA to other device

I want to send small pieces of text to a tts capable device. I preferably send the text as body from a POST request. What would be the easiest approach in doing this?

Python script. Then you can actually use Unless this isn’t what you mean.

r =‘’, data = {‘key’:‘value’})

Thanx, that probably would have worked as well but I went with . This suits my needs as well.

1 Like

I’m pretty sure rest uses the, so it’s essentially the same thing. I didn’t even know about the rest component. TIL. There are way too many components to keep in mind!

I tried the python_script way.

> send ='http://' + ipaddr + ':8090/speaker', data=sendXML)

This is the result:

2019-05-16 21:28:02 ERROR (SyncWorker_19) [] Error executing script: name ‘requests’ is not defined
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/python_script/”, line 159, in execute
exec(compiled.code, restricted_globals, local)
File “”, line 14, in
NameError: name ‘requests’ is not defined

i cant “import request” for security reasons. Any hint?