Eventghost and Autoremote and....or Join?

Discussion in 'EventGhost' started by Thinkfire, Nov 13, 2017.

  1. Thinkfire

    Thinkfire New Member

    Joined:
    Nov 13, 2017
    Messages:
    13
    Likes Received:
    0
    I am using Tasker Autoremote to help me lookup information from a spreadsheet. I sent a text message to my phone (or others do) and it passes on the information to eventghost if it has the right trigger words in the text message.

    Eventghost then takes the information, saves into excel file, opens some excel files and saves them so the formulas give me a nice crafted response and it successfully gives me the information in the log and pulls the right information based on what was texted to me.

    The issue I am running into, is I want to be able to text that information I retrieved back to the person that texted me the inquiry. I pass the number to EG so EG can pass it back, but the responses vary in legthn and I can't parse it back together. On the EG side, the variables are "provider" and "AM" and when printing these variables to log, its perfect. But passing them to Autoremote on my phone so they can be texted back, every word is its own variable. How can I fix this? Maybe I don't need to pass it back to my phone and I can just use Join to send the message? But I can't find anything on that either. There are three variables I need to pass back to my phone so I can use tasker to send the text message. 1) The phone number of the person that sent me the text (so tasker knows who to text) 2) "provider", this containts a few rows of data and number of words are dynamic, not static. 3) "AM" which containts another set of information

    This would be easier if EG had the ability to use Join to send the message directly to the person instead of passing it through my phone.
     
  2. Thinkfire

    Thinkfire New Member

    Joined:
    Nov 13, 2017
    Messages:
    13
    Likes Received:
    0
    Additionally, I cant seem to find documentation that specifies the fields for Autoremote Send Notification in EG and Autoremote Send Message. For example, what is "Automatic Actions" and what is the syntax? Or Channels? The other stuff is self explanatory.
     
  3. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Hi there.

    You should send a message back to your phone like spreadsheetresponse=:=PHONE_NUMBER=:=PROVIDER=:=AM
    In Tasker have an AutoRemote profile that intercepts the spreadsheetresponse=:= message and in the task your 3 variables will be available under %arcomm1, %arcomm2 and %arcomm3
    More info here.
    Hope this helps!
     
    Thinkfire likes this.
  4. Thinkfire

    Thinkfire New Member

    Joined:
    Nov 13, 2017
    Messages:
    13
    Likes Received:
    0
    This is what I was trying before...but it won't let me send test or AM as variables. I removed the {} from the payload variable so I could test without throwing errors.

    Code (Text):

    #Getting information from Excel and Sending it
    from os.path import join
    from xlrd import open_workbook  


    #Get the information
    rb = open_workbook(join('C:\Users\Gerid\Syncplicity Folders\My Files\APCRS\APCRS.xlsx'))
    rb.sheet_by_index(0).cell(0,0).value


    provider = rb.sheet_by_index(0).cell(1,1).value
    AM = rb.sheet_by_index(0).cell(1,2).value
    test = "this is a test"


    #Print the information
    print(provider)
    print(AM)
    print(test)

    #Sending information back to phone
    eg.plugins.AutoRemote.SendMessage(u'S8', u'goo.gl/mysecretlink', u'mysupertopsecretkey', u'apcrsresponse=:=eg.event.payload.arpar[1]=:={test}=:={AM}', u'', u'', u'', '', u'', u'')
    the response I get is this

    Code (Text):

      Confidential information
      has been removed for
      for testing
      purposes
      this is a test
      Traceback (most recent call last):
      Python script "91", line 22, in <module>
      eg.plugins.AutoRemote.SendMessage(u'S8', u'goo.gl/mysecretlink', u'mysupertopsecretkey', u'apcrsresponse=:=eg.event.payload.arpar[1]=:={test}=:={AM}', u'', u'', u'', '', u'', u'')
      File "C:\Program Files (x86)\EventGhost\plugins\AutoRemote\__init__.py", line 1000, in __call__
      message = Message(self, key,text,ttl,password,target,files)
      File "C:\Program Files (x86)\EventGhost\plugins\AutoRemote\__init__.py", line 910, in __init__
      self.message = replacePythonCodeAndEncode(text)
      File "C:\Program Files (x86)\EventGhost\plugins\AutoRemote\__init__.py", line 693, in replacePythonCodeAndEncode
      print "Error: {" + item + '} does not evaluate to a String. Not replacing: ' + repr(e)
      NameError: global name 'item' is not defined
     
  5. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Glad to help :) Can you not use the Send Message action in EG directly instead of doing it by code?
     
  6. Thinkfire

    Thinkfire New Member

    Joined:
    Nov 13, 2017
    Messages:
    13
    Likes Received:
    0
    I can, but I copied in Python and pasted it so you could see the code. Thought that would make it easier.
     
  7. Thinkfire

    Thinkfire New Member

    Joined:
    Nov 13, 2017
    Messages:
    13
    Likes Received:
    0
    Any ideas? It's driving me nuts trying to figure out how to pass variables back to the phone. Putting brackets around it gets me that error. Using % just returned %provider, using parenthesis just returns (provider)

    I get the same issues when using Send Message action in EG directly instead of doing by code. I figured by showing code you could see what my error is.
     
  8. Thinkfire

    Thinkfire New Member

    Joined:
    Nov 13, 2017
    Messages:
    13
    Likes Received:
    0
    To clarify, how do I get "test" to show up as "this is a test" on my phone when using it with =:= to seperate variables?
     
  9. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Sorry, can you just post what you tried with the direct AutoRemote action? Copy paste your action here (it'll generate a XML)
     
  10. Thinkfire

    Thinkfire New Member

    Joined:
    Nov 13, 2017
    Messages:
    13
    Likes Received:
    0
    I can when I get home.

    Can you give me the syntax to use to send variables through autoremote?

    I can't find documentation on it anywhere.
     
  11. mueller

    mueller New Member

    Joined:
    Apr 20, 2016
    Messages:
    10
    Likes Received:
    2
    @Thinkfire
    have you got the solution already?
     
  12. Thinkfire

    Thinkfire New Member

    Joined:
    Nov 13, 2017
    Messages:
    13
    Likes Received:
    0
    No. Been working. Won't be home until tonight.
     
  13. mueller

    mueller New Member

    Joined:
    Apr 20, 2016
    Messages:
    10
    Likes Received:
    2
    okay. the solution is really simple.
    instead of
    eg.plugins.AutoRemote.SendMessage(u'S8', u'goo.gl/mysecretlink', u'mysupertopsecretkey', u'apcrsresponse=:=eg.event.payload.arpar[1]=:={test}=:={AM}', u'', u'', u'', '', u'', u'')
    use
    eg.plugins.AutoRemote.SendMessage(u'S8', u'goo.gl/mysecretlink', u'mysupertopsecretkey', u'apcrsresponse=:=' + eg.event.payload.arpar[1] + '=:=' + test + '=:=' + AM , u'', u'', u'', '', u'', u'')
    that's all
     
    Thinkfire likes this.
  14. Thinkfire

    Thinkfire New Member

    Joined:
    Nov 13, 2017
    Messages:
    13
    Likes Received:
    0
    Thank you!!! I'll try this tonight. If I can get past this hiccup I can finally complete this project I've been on.

    Is there documentation of this anywhere? Or just common knowledge as a programmer?
     
  15. mueller

    mueller New Member

    Joined:
    Apr 20, 2016
    Messages:
    10
    Likes Received:
    2
    iam not really sure. but i guess the variables which are declared in the pythoneditor in eventghost are somewhere in the hierarchy but not in the current context. If you need to carry the variables with you use:
    test = "this is a test"
    eg.globals.test = test
    and somewhere else you can use eg.globals.test
     
    Thinkfire likes this.
  16. Thinkfire

    Thinkfire New Member

    Joined:
    Nov 13, 2017
    Messages:
    13
    Likes Received:
    0
    To confirm for anyone else. This worked! Thanks Mueller!
     

Share This Page