Award
Congratulations DJ Sures, for answering the question and has received an EZ-Credit award! Share what you have learned and create a tutorial to help others by clicking here.

Execute Scripts Or Commands With Http Get Commands

Assistance Requested

Help thetechguru with their question and receive $10 of EZ-Credit to get more robots and parts from our store. The following information was provided about their previous efforts searching tutorials for a resolution.

thetechguru claims to have checked these sources:
 
#1

I think this is possible and has been discussed, but I can not find it. Is there a format to execute scripts or commands using an application that can send HTTP GET or POST commands but not be using a web browser, either with the HTTP Server or HTTP Server (custom).

I don't think I can do it with the HTTP Custom because it uses AJAX and I don't know how I would format a request (and unfortunately, the documentation is fairly minimal) but I thought someone was already doing this with the simple HTTP server, embedding the user name and hte request in the URL of the GET.

I also know I can do this with Telnet using the TCP Clients object, and I may use that for my solution, but it is a little more limiting.

I'll explain my goal in case it provides any other thought.

I want to be able to drive my robot from my Android phone or an Android Wear smartwatch. I don't want to use the mobile interface, I want to have an embedded computer running EZ-Builder performing a number of tasks, the remote interface just to give additional commands.

I have two applications that can easily send HTTP Get or Post requests and allow me to build custom interfaces. Anymote smart remote, and Tasker. With a Tasker plugin I can also send Telnet requests, and I may wind up going in that direction if I am wrong that this can't be done with one of the web servers, but that isn't really the direction I wanted to go. (I think I could also do it using Eventghost to receive the HTTP requests and then send telnet requests to EZ-Builder, and I am sure I could write a plugin or do something with the SDK once my C# skills are up to speed, but I could swear this is existing functionality and I just can't find the right nomenclature for the command).

Alan

I have found a few conversations, tutorials and activities that may help with your question. Take a look at these links. I've sorted them by what I believe to be most relevant but that is not always the case as I'm still learning.


Also, consider reviewing the Learn section for informative lessons and activities. Check it out!


#2

Create a plugin. It will only be a few lines of code.

Or

Use the telnet server.

The telnet server makes the most sense. Sinply send the command with a terminated \r\n

The plugin would end up reproducing the telnet server. If you're idea is to have the watch control the robot, I could consider what it takes to add the telnet server to the mobile app.

#3

Thanks DJ.

I must have been mis-remembering that this could be done via HTTP.

I explicitly don't want this in the mobile app (although others might). It is for providing remote control of a robot that will have an embedded Windows computer.

Short term, I can use the Tasker plugin to create buttons for the Telnet commands, and I will add this to my list of things I want to do with the plugin when I finally have time to learn a little C#. In fact, it fits perfectly with my plans to make an IFTTT plugin, so I might be able to kill two birds with one stone.

Alan

#4

Is Tasker the name of the plugin you want to create?

Is the idea to not send ezscript commands and send other commands instead? Is this because ezscript commands are too lengthy? Ie forward() or stop()? Would your commands be shorter in length or something?

I'd like to get a better understanding of the initiative to use a plugin instead of the telnet server.

#5

Tasker is an Android app that can do many many things based on many many triggers. It also has a plugin architecture. One of its plugins is a Telnet client, where I can set up specific sequences of tenet commands (a built in function is Get URL, which is where I was starting).

You can use Tasker to create simple Android apps that execute these tasks, or trigger them from any number of other events that Android can see.

There is also an Android Wear Smartwatch plugin for Tasker that can make simple UI's.

So what I am going to build with this, is a simple UI similar to what you did for the Apple Watch that sends forward, reverse, left, right, and stop commands (and maybe some others) to my robot from my new LG Urbane smartwatch (that was just delivered 30 minutes ago).

I probably don't need to make a plugin for this capability except for the fact that Tasker and the two Tasker plugins needed to make this work are all paid apps, and on the more expensive side for Android, and takes a bit of configuration to set up, so if others want to do the same, it will be more complex than if I can write a plugin and an Android Wear app.

I have also been thinking of how to best do an IFTTT plugin. It is easy using the IFTTT Maker channel to have a robot send events, but more difficult to make it respond. If I EZ-Builder could take actions based on GET requests without opening a web page, then the Maker channel could be used for both directions of communication, so building a integration web service plugin would be a nice challenge for me.

Alan




Alan

#6

Ah i see.

The ifft I have looked into. I was so frustrated with their terrible api that I wasn't able to continue developing.

If you were to make one, the plugin would only be difficult because their api is so terrible. Thinking about reading their api pages again gives me the shakes!

#7

That is why I wanted to take advantage of the existing Maker channel. As long as I can make the web page "internet visible" which is not difficult in my environment since I have my own domain and Dynamic DNS service, the Maker channel can do a GET or POST request. So all I would be to create a web interface that can pass credentials and script commands from a single GET or POST.

Would not be easy for all EZ-Builder users, but with good documentation I think it could be useful.

It can also be done with EventGhost hosting the web commands and sending to EZ-Builder with the telnet interface, but that adds another layer that can break, and more to configure.

Alan

#8

I use IFTTT a lot to trigger some actions in and by EZ-Builder, but I have to follow complex paths for that. I use recipes with Dropbox: I make EZ-Builder write files/take pictures in Dropbox to trigger external actions by IFTTT and the other way I make Dropbox write .txt files and EZ-Builder read them in scripts.

I would love to see an IFTTT plugin (no pressure Alan Winky) and it's a shame their api is so terrible.
(It is also a shame I am not capable of writing a plugin, but that's another story Grin)

Fred

#9

At this point, I think you are as capable of writing a plugin as I am. I need to learn C#. I am a fairly accomplished VB6 developer, but VB6 is so old it can't even be installed on anything newer than WindowsXP, and the new languages are completely different, so I am pretty much starting from scratch.

Alan

#10

C# sounds intimidating because it has the letter C in it. The only reason for the C is the inspired syntax. But I assure you, that c# is the best programming language since basic on my Apple ][ Smile

The great thing about visual studio is syntax completion. Every time you press the . button after a namespace/class/method, there is a popup of optional children. And then once you select the child, you can scroll through overrides (different uses of the command). It's amazing how self documenting C# is because of that intellisense.

Another great feature of C# is that it's very "basic-like". Meaning, basic has become more complicated than C# to do anything at all. When i read about people using VB.Net, i shake my head at how frustrated they must be to get anything done. If they just used the energy to learn C# rather than be frustrated, life would be grand.

The flexibility of C# is really where it helps programmers like me. Obviously I have quite the range of programming environment ability, as the ez-robot products demonstrate. From assembler, to C to C++ to C# to HTML to Javascript etc etc etc... The language i prefer is C#. This is because you can start small, such as the plugin tutorial demonstrates. And once you really get the language, you can start digging deep into direct memory access (which is called unsafe in C#). You can even use pinvokes to execute C/C++ unmanaged code. And if you're a C++ programmer, you can (i don't know why anyone would) use CLR.

There's a pile of benchmarks out there - and if you look, it's interesting to notice the performance benefits of C# as well. This is because unlike native code, the .net runtime can perform ahead of time pre-compiling and re-using object memory. I can go on for ever about how great the performance is and why...

Lastly, say good bye to buffer overflows with C#! Unless you're using unsafe{}, but that's for experienced C++ programmers that want access to memory via pointers.

So, visit the plugin tutorial and try it out. It's not hard!