•   
  • 1
  • 12
  • 13
  • 14(current)
  • 15
  • 16
  •   
Release Control Kodi with your Google Home
(2020-07-03, 01:14)harlekin Wrote: Found a way to fix the glitch 403 issue, while still keep using glitch.

Register a free account with pipedream.com, click on workflows, create a new workflow
- first step http webhook
- second step node.js

make it look like that:
Image

In http webhook click on curl - and simply copy the url you see there at the bottom (see top of the screenshot). This is the new url that has to be entered in your ifttt options, you can leave the rest as is (in ifttt).

In the node.js step you simply copy/paste in this code:
Code:
const axios = require("axios");

// Make an HTTP GET request using axios
const resp = await axios({
method: "POST",
url: `https://jsonplaceholder.typicode.com/posts`,
headers: {
"Content-Type": "application/json"
},
data: { name: "Luke" }
});
src and better formating: https://docs.pipedream.com/workflows/ste...tp-headers Wink

Then replace the url with your glitch server url (including the /whatever) and { name: "Luke" } with your {"token":"tokenpassword"}


Thats it. Works. Smile

IFTTT now sends a json request to the pipedream url, that triggers a json request to your glitch server. That means that IFTTT isnt communicating with glitch directly anymore - hence no more 403 errors. Yay. Wink

edit: Or use a RaspPi to host OmerTus GoogleHomeKodi yourself, using docker. I went for the quicker fix -- with the downside, that the solution in this thread adds some additional delay. (Not outrageous, but noticeable.)
 
(2020-07-07, 23:29)RonnieBoy82 Wrote: Do I make a new workflow for each command or can it be done on one. Sorry, not a coder at all

I don't know - I've implemented my voice commands in IFTTT with custom german triggerwords, so I had to create one for each command (used).

I haven't tried implementing the entire suite, so I don't know. But imho it should be possible.

IFTTT originally sent out the same post command to an url with a json body as the node.js script does. So both should be 'the same' as far as the glitch server is concerned. Post a screenshot of the IFTTT setup page for your command if you want more help. Smile (edit url and token so they arent the ones you use.. Smile )
Reply
Ah, strike that - the implementation would be -

YOUR_NODE_SERVER/broker?phrase={{TextField}}

while {{TextField}} would be filled in by the Google Assistant App in IFTTT, so you'd need a way to forward that specific link to pipedream.com - and then have pipedream.com use it. While I'm entirely sure that this is possible, I'm no coder either - so I cant help you set up a node.js script that would be able to do that.

If any coders out there read this and would be willing to help write that node.js implementation, please do. Smile
Reply
(2020-07-03, 01:14)harlekin Wrote: Found a way to fix the glitch 403 issue, while still keep using glitch.

Register a free account with pipedream.com, click on workflows, create a new workflow
- first step http webhook
- second step node.js

make it look like that:
Image

In http webhook click on curl - and simply copy the url you see there at the bottom (see top of the screenshot). This is the new url that has to be entered in your ifttt options, you can leave the rest as is (in ifttt).

In the node.js step you simply copy/paste in this code:
Code:
const axios = require("axios");

// Make an HTTP GET request using axios
const resp = await axios({
method: "POST",
url: `https://jsonplaceholder.typicode.com/posts`,
headers: {
"Content-Type": "application/json"
},
data: { name: "Luke" }
});
src and better formating: https://docs.pipedream.com/workflows/ste...tp-headers Wink

Then replace the url with your glitch server url (including the /whatever) and { name: "Luke" } with your {"token":"tokenpassword"}


Thats it. Works. Smile

IFTTT now sends a json request to the pipedream url, that triggers a json request to your glitch server. That means that IFTTT isnt communicating with glitch directly anymore - hence no more 403 errors. Yay. Wink

edit: Or use a RaspPi to host OmerTus GoogleHomeKodi yourself, using docker. I went for the quicker fix -- with the downside, that the solution in this thread adds some additional delay. (Not outrageous, but noticeable.)

I get an error in Pipedream

ReferenceError Const is not defined
       at Object.module.exports (/steps/nodejs.js:4:1)
No return values or exports for this step

const axios = require("axios");
Const ;resp = await axios({
method: "POST",
url: 'https://xxxxxxx.glitch.me/',
headers: {
"Content-Type": "application/json"
},
Reply
url has to be:

https://xxxxxxx.glitch.me/playpause

(for it to trigger the play/pause action f.e.)

for example.

or

https://xxxxxxx.glitch.me/broker?phrase={{TextField}}

IF someone builds a node.js script for a general interpretation (which we do not have yet)
(edit: This would work as follows, IFTTT would have to be set up to send https://xxxxxxx.glitch.me/broker?phrase={{TextField}} in the json body as well, node.js script would have to parse the body for that url, set it as a variable, and then send the POST command to that url - this should be easy to implement for anyone that knows node.js Smile )
-

Also you are missing the token in the body. Smile

Copy the entire code from https://docs.pipedream.com/workflows/ste...tp-headers

then replace

the url in there with https://xxxxxxx.glitch.me/playpause 

and

{ name: "Luke" } with {"token":"YOURTOKEN"}

(yourtoken is the one you set up in .env in glitch (as auth_token))
Reply
(2020-07-08, 18:54)harlekin Wrote: url has to be:

https://xxxxxxx.glitch.me/playpause

(for it to trigger the play/pause action f.e.)

for example.

or

https://xxxxxxx.glitch.me/broker?phrase={{TextField}}

IF someone builds a node.js script for a general interpretation (which we do not have yet)
(edit: This would work as follows, IFTTT would have to be set up to send https://xxxxxxx.glitch.me/broker?phrase={{TextField}} in the json body as well, node.js script would have to parse the body for that url, set it as a variable, and then send the POST command to that url - this should be easy to implement for anyone that knows node.js Smile )
-

Also you are missing the token in the body. Smile

Copy the entire code from https://docs.pipedream.com/workflows/ste...tp-headers

then replace

the url in there with https://xxxxxxx.glitch.me/playpause 

and

{ name: "Luke" } with {"token":"YOURTOKEN"}

(yourtoken is the one you set up in .env in glitch (as auth_token))

sorry i'm not a coder so i don't understand what you mean by:


https://xxxxxxx.glitch.me/broker?phrase={{TextField}}

IF someone builds a node.js script for a general interpretation (which we do not have yet)
(edit: This would work as follows, IFTTT would have to be set up to send https://xxxxxxx.glitch.me/broker?phrase={{TextField}} in the json body as well, node.js script would have to parse the body for that url, set it as a variable, and then send the POST command to that url - this should be easy to implement for anyone that knows node.js Smile )
-

I;m trying to use this as i did IFTTT before where all commands were passed to the glitch broker??

so updated code is:


Const ;response = await axios({
method: "POST",
url: 'https://xxxxxmaster.glitch.me/broker?phrase={{TextField}}',
headers: {
"Content-Type": "application/json"
},
data: {name:"Luke"} with {"token":"my glitch token"}
});
Reply
I guess there is a diff between:

Const 

and

const

I changed and not get a different set of errors

ErrorRequest failed with status code 500
at null.createError (/tmp/ee/node_modules/axios/lib/core/createError.js:16:15)
at null.settle (/tmp/ee/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/tmp/ee/node_modules/axios/lib/adapters/http.js:236:11)
at IncomingMessage.emit (events.js:203:15)
at null.endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
Reply
Yes, the server responded differently. Wink 401 means authentication failed (you are missing the token) 500 means, more stuff is garbled up. Wink

- Its not so difficult. Get the glitch instance to work first. (Test with the internal testing option (sunglasses at the top))
- Set up one IFTTT command, the same it is described in the readme ( https://github.com/OmerTu/GoogleHomeKodi/ ), make it the one for playpause
- Then look at the screenshot above and make sure you set up pipedream exactly the same (except for different server url and a different token)
- then hit curl in the fist step in pipedream, and copy the url at the bottom into the IFTTT url field. Save. Thats it. Smile

If you use the code from the link provided, you really just click into the node.js object in pipedream, and post it into 'whats already there'. Then you replace url and the token bracket, and then you hit deploy.

I can set up an action in less than 10 seconds. Wink Its not rocketscience. Wink Look at the image again. If you have to. Smile
Reply
(2020-07-08, 20:03)harlekin Wrote: Yes, the server responded differently. Wink 401 means authentication failed (you are missing the token) 500 means, more stuff is garbled up. Wink

- Its not so difficult. Get the glitch instance to work first. (Test with the internal testing option (sunglasses at the top))
- Set up one IFTTT command, the same it is described in the readme ( https://github.com/OmerTu/GoogleHomeKodi/ ), make it the one for playpause
- Then look at the screenshot above and make sure you set up pipedream exactly the same (except for different server url and a different token)
- then hit curl in the fist step in pipedream, and copy the url at the bottom into the IFTTT url field. Save. Thats it. Smile

If you use the code from the link provided, you really just click into the node.js object in pipedream, and post it into 'whats already there'. Then you replace url and the token bracket, and then you hit deploy.

I can set up an action in less than 10 seconds. Wink Its not rocketscience. Wink Look at the image again. If you have to. Smile

always funny how coders think it is not rocket science for us non coders Smile

Regardless your comments helped me to look at glitch first.  I assumed no issues with glitch because i made no changes and it worked fine.

However in looking at glitch i determined:

my router forwarding port had changed on device
i then noticed i was connected through VPN which was causing some issue

I then successfully tested glitch kodi connection

THen i changed the pipedream code url to /playpause

I did not get any error in pipedream but did in glitch

I then changed pipedream code url to /navselect

and BAAM!!!!  Kodi responded.

NOW...

How do i get it to accept any commands given to IFTTT?
Reply
Currently you dont. You'd have to set up every action (you can see in the readme https://github.com/OmerTu/GoogleHomeKodi ) seperately on your own (in IFTTT and in pipedream).

Until someone thats actually a coder, can write a node.js script, that would read the specific 'words' that IFTTT gets from the Google Assistant as commands from a post action that is sent from IFTTT (f.e. in a json 'body').

So far we cant get any 'dynamic' part (words you'd speak) through pipedream. Only the actions you define in writing. And you'd have to do that for every command separately.

So far I've done it for playpause, stop, and info (linked to a script that presses info a second time after 10 seconds) on my installation. So just the most used commands in my case.
Reply
according to Pipestream support:

There is. Since you can run any Node.js code on Pipedream, you have access to any variables from your trigger step (for example, the incoming HTTP request), or data exported from previous steps.

For example, if I wanted to trigger a workflow on HTTP requests, and include the value I sent in the text field of my HTTP payload, I could reference that data like so:

const axios = require("axios");
const resp = await axios({
method: "GET",
url: `https://xxxxliving.glitch.me/broker?phrase=${event.body.text}`,
headers: {
"Content-Type": "application/json"
}
})

const axios = require("axios");
const resp = await axios({
method: "POST",
url: `https://xxxxliving.glitch.me/broker?phrase=${event.body.myVariableText}`,
headers: {
"Content-Type": "application/json"
}
})


it is actually sending something to kodi since kodi pings, glitch log shows

message": "undefined: Cannot read property 'toLowerCase' of undefined",
Reply
Yes, it is not a limitation of pipedream. Smile

https://xxxxxmaster.glitch.me/broker?phrase={{TextField}} would be how the url field is originally set up in IFTTT, where {{TextField}} would be dynamically 'created' depending on what you say to the google assistant after the trigger words.

Now - first issue, you'd have to get the content of {{TextField}} somehow from the url line in IFTTT into the json 'body' of the post message (it would send to pipedream). I'm not sure if IFTTT supports that, but it might. Smile

Once thats the case, you'd write a node.js script that parses (looks at) the json 'body' of the post message it gets, takes that bit (content of {{TextField}} ), and creates the final glitch url out of it. Then sends another POST request to the final glitch url, from pipedream (node.js).

Yesterday I hunted for note.js code snippets that parse POST json, but to no avail - none of them I tried seemed to work to even display the json content. So someone with actual coding experience would have to help us out here. Smile
Reply
Easier method to do a 'display info' then wait 5 seconds and do another 'displayinfo' (meaning it vanishes from screen Wink ) using pipedream:
Code:
const axios = require("axios");
// Make an HTTP GET request using axios
const resp = await axios({
method: "POST",
url: `https://xxxxxxxxxx.glitch.me/displayinfo`,
headers: {
"Content-Type": "application/json"
},
data: {"token":"xxxxxxxxxx"}
}
);
await sleep(5000);
await axios({
method: "POST",
url: `https://xxxxxxxxxx.glitch.me/displayinfo`,
headers: {
"Content-Type": "application/json"
},
data: {"token":"xxxxxxxxxx"}
}
);
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}

Just insert this into a node.js box, following a http steps trigger box in pipedream (as you would have with a command above). Then copy the curl url from the http steps box and insert it into an IFTTT Applet.
Reply
Could someone please help with setting up on repl.it please?
Reply
Ok, got simple commands to work on repl.it but can’t get any commands with text fields working. Please help
Reply
Got it working great on repl.it. Here is where you can get a walk through on how:

https://github.com/OmerTu/GoogleHomeKodi...-663013407
Reply
  •   
  • 1
  • 12
  • 13
  • 14(current)
  • 15
  • 16
  •   



Logout Mark Read Team Forum Stats Members Help
Control Kodi with your Google Home4
This forum uses Lukasz Tkacz MyBB addons.