Posts: 7,970
Threads: 554
Joined: Mar 2005
I want to get the value of a given field *TO* my Android. I've so far stiffarmed learning EventGhost because its yet one more thing to learn and my brain, albeit massive, is overloaded.
Is there another way? Or do I need to bite the bullet and learn it?
My desired usage is to integrate with Tasker / AutoVoice so I can ask my phone/watch a question and have it answer.
Posts: 2,339
Threads: 104
Joined: Apr 2009
03-31-2016, 04:40 AM
(This post was last modified: 03-31-2016, 04:46 AM by batwater.)
Eventghost is not that hard to get set up. Let me go back and look, I started a howto for CQC / EventGhost / AutoRemote / Tasker, it might be far enough along to jump start you. Once it is set up it is easy to add android devices. I've already got enough framework in place to send a response back to any of my android devices and either trigger a text popup or say a message. I'm also experimenting with Zooper which is a widget package that interfaces directly with Tasker. I can build widgets that display statuses of HA things or use to trigger HA things.
I'm setting up the same thing you mentioned and that is the Echo and Android device voice commands / responses will all feed through the same infrastructure. The difference in approach is that I'm using EventGhost as my middleware and have a macro set up (could be more than one but one for now) to process the voice requests instead of using global actions and the HTTP interface.
The added benefit I see too with using EventGhost is that you can now bridge the two automation platforms and have decent 2 way communication.
Posts: 40,483
Threads: 491
Joined: Aug 2002
By what mechanism does one talk to the phone? Is the phone running some sort of server that can be talked to?
Dean Roddey
Explorans limites defectum
Posts: 2,339
Threads: 104
Joined: Apr 2009
Two ways, both are handled in the AutoRemote EventgGost plugin, either direct IP (tries this first), phone if on local network has a server service running (I trigger this in Tasker as a part of my home profile), or if on cellular network, via hosted server. The ability for EventGhost to handle the messaging such that I dont' have to worry about whether I am on internal or on the external network is what makes EG attractive to me, it handles those details so I don't have to.
So, while at home, where most of this would occur for me in my use case I have all communication over my home network but have the option to send / receive things while on the cellular network. I have pondered automating the activation of a VPN tunnel for secured I/O but at this point am not doing anything that I am concerned about going to that extent to secure.
Ideally I would like to see an AutoRemote driver straight into CQC and eliminate the extra service running but this works and gives me at most 1-2 second response time which is more than adequate.
Posts: 40,483
Threads: 491
Joined: Aug 2002
By server service, do you mean a web server, or does it have some specific service that has a defined API or something?
Dean Roddey
Explorans limites defectum
Posts: 2,339
Threads: 104
Joined: Apr 2009
The developer calls it a "WiFi Service" From the FAQ here basically it's a mini HTTP listener
First make sure that the AutoRemote Wifi service is turned on in Tasker. You can do so with the ├ó┬Ç┬£AutoRemote Wifi├ó┬Ç┬Ø Tasker action. Then do an HTTP POST to the IP of the device on port 1817 with the following payload:
{├ó┬Ç┬£message├ó┬Ç┬Ø:├ó┬Ç┬Øhello├ó┬Ç┬Ø,├ó┬Ç┬Øsender├ó┬Ç┬Ø:├ó┬Ç┬ØYOUR_PERSONAL_KEY├ó┬Ç┬Ø,├ó┬Ç┬Øttl├ó┬Ç┬Ø:0,├ó┬Ç┬Øcommunication_base_params├ó┬Ç┬Ø:{├ó┬Ç┬£type├ó┬Ç┬Ø:├ó┬Ç┬ØMessage├ó┬Ç┬Ø,├ó┬Ç┬Øfallback├ó┬Ç┬Ø:false,├ó┬Ç┬Øvia├ó┬Ç┬Ø:├ó┬Ç┬ØWifi├ó┬Ç┬Ø},├ó┬Ç┬Øversion├ó┬Ç┬Ø:├ó┬Ç┬Ø1.63″}
How does the ├ó┬Ç┬£Send Later├ó┬Ç┬Ø feature
Also
AutoRemote uses Google Cloud Messaging, GCM for short, http://developer.android.com/google/gcm/index.html) to receive its messages. This is a low power feature that is always enabled on your phone. When GCM receives a message it wakes up the recipient app (in this case, AutoRemote) and lets the app take care of it. AutoRemote is awake for that split second it takes to process the message and send it to Tasker, and then is shut down right away, so it never remains in the background.
Posts: 40,483
Threads: 491
Joined: Aug 2002
It would be fairly easy to do a CML macro that would take the basic parameters you want to send and send out such an HTTP POST.
Dean Roddey
Explorans limites defectum
Posts: 2,339
Threads: 104
Joined: Apr 2009
Aside from the communication overhead (which is buried in EventGhost) the command syntax between CQC and tasker via AutoRemote is simple to use.
Each AutoRemote message sent is in the form " parameters=:=command " So for example if I want to send a message to my phone I would send the command "BenCell&&CQC Say=:=This is a test" (without the quotes) to EventGhost tells EG to send to my cellphone BenCell (anything to the left of the && token is parsed by EG) the command to speak the words "This is a Test" CQC tells Tasker what profile to execute and Say tells tasker to execute the task to say the text provided. If I send PopUp instead of Say it pops up a dialog box on the phone with the message. With this I only have to know what device I want to send a message to, EG maintains the device communication mapping automagically.
Perhaps it would be relatively easy to create an HTTP Post macro but a whole lot more info will have to be maintained within CQC to accomplish. I like not having to worry about those details and only need to know what device I'm sending to or receiving from. Receiving from allows me to know what device made the request and provide a spoken or popup response (or one of many other functions) in context with the request.
Posts: 2,339
Threads: 104
Joined: Apr 2009
I found an intent that does the opposite, takes a command from the Echo and sends it to Tasker via AutoRemote. I have this up and running triggering the same voice tasks I have already built into Tasker. Only gap right now is that I can't get a response back from CQC to the Echo like I can to my Android device if the Android device were originating the voice command.
Original thread here There are 2 linked YouTube videos.
GitHub source here
Posts: 7,970
Threads: 554
Joined: Mar 2005
batwater Wrote:Eventghost is not that hard to get set up. Let me go back and look, I started a howto for CQC / EventGhost / AutoRemote / Tasker, it might be far enough along to jump start you. Once it is set up it is easy to add android devices. I've already got enough framework in place to send a response back to any of my android devices and either trigger a text popup or say a message. I'm also experimenting with Zooper which is a widget package that interfaces directly with Tasker. I can build widgets that display statuses of HA things or use to trigger HA things.
I'm setting up the same thing you mentioned and that is the Echo and Android device voice commands / responses will all feed through the same infrastructure. The difference in approach is that I'm using EventGhost as my middleware and have a macro set up (could be more than one but one for now) to process the voice requests instead of using global actions and the HTTP interface.
The added benefit I see too with using EventGhost is that you can now bridge the two automation platforms and have decent 2 way communication.
Trying to learn this now. What gets installed on the phone and what on the MS?
|