URL API Problems - Need Help

Hello Everyone!
I am very new to NR and have hit a roadblock in my project.

I am setting up Fully Kiosk and they supply a URL API for text To Speech. I can put the URL (below) in my browser and the text will get read out loud on my tablet.

That works great but I can NOT figure out how to get the link below into something that I can trigger from NR. I have spent the last 14 hours watching videos and reading here and Im stumped. I thought I could just put that link as a http post request but it does not work. Any help would be GREATLY appreciated!!

Fully Kiosk URL
http://192.168.1.131:2323/?cmd=textToSpeech&text=[readthis]&password=[mysecret]

Thanks again
Aaron

Hi Aaron,

I don't know anything about Fully Kiosk, so will try briefly to describe what you are doing so others might be able to help you...

So Fully Kiosk is an browser that runs full screen on your Android device and allows you to control which websites can be opened. Since it has a REST API it is used by many home automation people to control their Android device without rooting (like e.g. in home assistant). E.g. keep the screen alive, unlock screen, control the backlighting, ...

So what you want to achieve: Node-RED needs to let voice speak on your Android device.
And you do that by sending a http request from a Http-Request node:

Some questions so people can understand the problem a bit more:

  1. Is that correct?
  2. Can you call the REST API successful with other commands (i.e. not text to speech)?
  3. Is that browser (where you test the url) running on the Android device or on another machine? The latter one would be a better test of course ...
  4. Can you call the REST API via other tools (e.g. curl)?
  5. What do you mean with "a http post request but it does not work"? Do you have some errors in the output messages of the Http-Request node or in the Node-RED log or ...

Bart

It should be as simple as a http request with the URL set.
What have you tried in node-red? Can you share your flow? (Only the relevant parts).

Ps, to export your flow, highlight only the nodes of interest then press ctrl+e, copy to clipboard then...

```
paste the copied flow between 3 backticks like this
```

Thank you very much for your replies!

Bart:
1- Yes that is correct.
2- I read this and felt really stupid for not trying. Unfortunately/fortunately I can not get any of the API URLs work in node red. The other API URLs do work in the laptop's browser though.
3- The test browser and node red are both running on my laptop and the android that needs to talk is across the room (wifi).
4- Unfortunately Im not familiar with curl (or really much of any other programming). I tried studying up last night but didnt get very far.
5- I dont get any errors that I can see. It connects to the tablet. I get a status code 200 and I get the html back from the tablet. Just no TTS.

Steve:
Thank you. That is what I thought and I'm glad I'm not too far off base. I'm sure it is maybe a formatting error or something simple but I think I have tried every combination off every option in the flow below. No luck.

[{"id":"73e92dbf.9e48c4","type":"inject","z":"cbec2047.eb4fa8","name":"","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":100,"wires":[["449d94dd.a4616c"]]},{"id":"449d94dd.a4616c","type":"http request","z":"cbec2047.eb4fa8","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.1.131:2323/?cmd=textToSpeech&text=[driveway%20motion]&password=[secret]","tls":"","persist":false,"proxy":"","authType":"","x":250,"y":140,"wires":[["4543edf0.ffa04c"]]},{"id":"4543edf0.ffa04c","type":"debug","z":"cbec2047.eb4fa8","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":410,"y":180,"wires":[]}]

Here is my debug results. 1 thing I just noticed is that the password does not seem to matter. I mistyped it and I get the same results in the debug screen. That makes me think the data in the URL is not getting processed so Im probably not sending it correctly.

object
_msgid: "559d9b4a.343684"
topic: ""
statusCode: 200

headers: object
responseUrl: "http://192.168.1.131:2323/?cmd=textToSpeech&text=[driveway%20motion]&password=[secret]"


payload: "<!DOCTYPE html>↵<html>↵<head>↵    <meta charset="UTF-8">↵    <meta name="viewport" content="width=device-width,initial-scale=1">↵    <title>Fully Remote Admin</title>↵    <link rel="shortcut icon" type="image/x-icon" href="fully-favicon.ico">↵    <style>↵* { margin: 0; padding: 0; }↵body { font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; text-align:left; box-sizing:border-box; overflow-x:hidden; min-height:100%; }↵h1 { font-size: 1.35em; margin-bottom: 0.7em; } ↵h2 { font-size: 1em; } ↵img.header { max-width:100%; }↵img.screenshot, #imgholder { max-width:100%; border:2px solid #666666; margin-top:0.2em; margin-bottom:0.4em; text-align:center; }↵#imgholder { display:none; min-width:100%; min-height:195px;}↵form, input, textarea, p, div { font-size: 1.0em; }↵p  {margin-bottom: 1em;}↵p.buttonline  {margin-bottom: 0em; line-height: 1.5em;}↵.small, .key { font-size: 0.7em; }↵.key { display: none; }↵a, a:visited {color: #304ffe; text-decoration:none;}↵.disabled { color: #808080; ..."
redirectList: array[0]

Ok... 1 minor breakthrough I think.

I tried the link in private browsing mode on my laptop and get an 'incorrect password' error with a field to re-enter the password. Once I re-enter the password the link works until I get a new private window. Also, once you type the password then the password=[secret] is no longer needed in the link anymore (the URL reads the speech without the password= part there).

I also notice in the instructions that Fully Kiosk says "Don’t forget to URLencode all query string parameters." What does that mean and could that be the cause of my troubles?

Im an idiot.

So the discovery above about the password led me to investigate exactly what part of the URL was actually being processed and where the URL was breaking. It was breaking at the ]. It was still reading the text just fine but breaking after the ]. That was the confusing part. The link was 'working' (it read text) but not 'really working' (was not passing on the password). But, since I had already logged in, my password was not needed in my laptop browser so it worked.

Turns out the link does not need the [ ]. I'm guessing that Fully Kiosk just put that in their examples to help make it clear where you put your data and assumed everyone was smart enough to know to remove them (I, clearly, was not :smile: ).

Anyway.... everything works now with just a regular http request.

Thanks again for your help! It helped convince me that I was on the right track and to look at what I was doing more deeply.

1 Like

Glad you figured it out. :+1:

By the way, if you have other difficulties with Fully Kiosk, you can drop an email to Alexei (the developper). He answers very rapidly and always keen to help!
I am myself using FK and with the API it is really awesome. IMHO, the best Android App companion for home automation.

Then you will feel at home in our community :rofl:

Nice to hear that it works now.
I'm pretty sure some people will find your setup useful!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.