Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Write to file from autoremote message

If you have a question or need help, this is the place to be.
Post Reply
lucidstate
Posts: 2
Joined: Thu Nov 05, 2015 3:45 am

Write to file from autoremote message

Post by lucidstate »

I'm new to Autoremote and Eventghost. I've got a number of android devices that will send some data to eventghost. Then that data will be stored in a file on my desktop (txt file for now, database when I learn more). I've figured out how to send the info to eventghost, but I don't don't know where to start to get it into a file. I don't see any prebuilt actions that look like they would write to a file. Do I need a plugin?
eirik226
Experienced User
Posts: 142
Joined: Wed Nov 07, 2012 5:22 pm

Re: Write to file from autoremote message

Post by eirik226 »

Hello,

You can do this with a python script.

Code: Select all

f = open('minfil.txt', 'w+')
f.writelines('Hello!\n')
f.writelines('World!\n')
f.writelines('This is a line\n')
This is just an example and will in no way do what you said - but as I said, you can do this with a python script.

https://docs.python.org/2/tutorial/inputoutput.html
lucidstate
Posts: 2
Joined: Thu Nov 05, 2015 3:45 am

Re: Write to file from autoremote message

Post by lucidstate »

Thank you! I'm not above learning how to python script. I've got just enough hobby programming experience to get started. But how do I actually pass information from eventghost to python?

like:

Code: Select all

myData = somehowgetfromeventghost
f = open('minfil.txt', 'w+')
f.writelines(myData)

eirik226
Experienced User
Posts: 142
Joined: Wed Nov 07, 2012 5:22 pm

Re: Write to file from autoremote message

Post by eirik226 »

Im not 100% what you mean - but if you press add action on eventghost and look under the tab or what I should call it "eventghost" there should be python script and python command, you want to use python script.

So basically you have this setup:

1. From phone to eventghost
2. pick up the event you receive from phone with python script
3. write that event to a textfile

My knowledge on this is not that good - I try to write an example (this is almost guaranteed not correct)

Code: Select all

info = eg.event.payload[0} #this should get you the payload of the event.
print info #This should print info (just to check that it's correct)

#Now you need to write info to a textfile - like I showed you above 
I'm sorry I can't help you anymore, and I'm not even sure if this is correct at all. I'm really not that good with python, still learning!
Javier
Experienced User
Posts: 73
Joined: Sun Dec 01, 2013 3:45 pm

Re: Write to file from autoremote message

Post by Javier »

AutoRemote sends payloads differently than others plugins, see this post.
viewtopic.php?f=2&t=7383#p36994
Post Reply