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.

AutoRemote EventGhost plugin:EG->Android and Android->EG

Questions and comments specific to a particular plugin should go here.
joaomgcd
Posts: 17
Joined: Tue Oct 02, 2012 9:42 pm

AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by joaomgcd »

Hi.

I've created an EventGhost plugin for the AutoRemote Android app.
AutoRemote is an app that lets you control your Android device from wherever you are via any browser, PC or another Android device. It works as a Tasker plugin, so you can pretty much do anything on your phone remotely.

Tasker can also react to anything and everything, so that makes it the perfect "sensor" for automation.

So, the EventGhost plugin can send and receive messages to and from your phone. What this does is it lets you make your PC and phone work in tandem, and react to situations only one or the other knows about.

So, for instance, when I log in to my PC at work, my phone goes into silence mode. Or when I arrive home and connect to my Wifi connection, my favourite song starts playing on my PC.

I currently distribute the plugin via my AutoRemote desktop app (which also lets you automate, albeit to a lower level than EventGhost), but would like to know if it would be possible to be included in the EventGhost stock plugins.

AutoRemote is available in Google Play here: http://goo.gl/Fyuba

Thanks for reading, and congratulations for a great app! :D

joaomgcd
User avatar
zian
Site Admin
Posts: 569
Joined: Wed Jun 24, 2009 3:54 pm

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by zian »

Thanks for the sharing of your stuff joaomgcd.

But this post doesn't belong in EvenGhost News.
How's about we move it to the PlugIn Section?
eventghost.net
Be there or be square.
joaomgcd
Posts: 17
Joined: Tue Oct 02, 2012 9:42 pm

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by joaomgcd »

I just put it there because terRemote and EG Remote also have threads there.
But thanks for your attention! :)

So, anyway this could be included in the standard EventGhost release package?

Thanks again.
joaomgcd
Posts: 17
Joined: Tue Oct 02, 2012 9:42 pm

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by joaomgcd »

Hi again.

Maybe you can help me with a problem I'm having.

I can add the AutoRemote plugin to the EventGhost tree with no problem, and add an Android device within the plugin.
After this, I can save the EventGhost tree and it will save and restore settings correctly.

After using AutoRemote though, if I try to add another plugin afterwards and try to save the EventGhost settings, it always gives me this error:

PicklingError: Can't pickle <class eg.CorePluginModule.AutoRemote.AutoRemoteDevice at 0x03FD5A80>: it's not the same object as eg.CorePluginModule.AutoRemote.AutoRemoteDevice

AutoRemoteDevice is just a class with 3 string fields that I use to save my device settings. Shouldn't I use custom classes to store settings like these? What can I do to this class to make it serializable?

Thanks in advance.
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by krambriw »

Put your eg plugin here so we can have a look at your source code
joaomgcd
Posts: 17
Joined: Tue Oct 02, 2012 9:42 pm

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by joaomgcd »

Ok, here it is.

The AutoRemoteDevice class is at the end of the file.

Thanks.
Attachments
__init__.py
(28.99 KiB) Downloaded 344 times
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by krambriw »

The thing seems impossible for me to test but I have some findings that might help you (and some general comments)

You have the following defined in the configuration for the plugin:

Code: Select all

    def Configure(
        self,
        prefix="HTTP",
        port=1818,
        name="EventGhost",
        devices=[],
        publicIp="",
        authUsername="",
        authPassword=""
    ):

Please note that you should not have a "comma" at the end of the last line

Then you should also have it like this this (even if you are not using the variables for the moment):

Code: Select all

        while panel.Affirmed():
            panel.SetResult(
            	"AutoRemote",
                portCtrl.GetValue(),
                nameCtrl.GetValue(),
                self.devices,
                publicIpCtrl.GetValue(),
                authUsername,
                authPassword
            )
In general,

- why are you re-importing libraries in several places???
- keep the line length at 79 chars
- you use incorrect chars for indents, you have tabs in several places instead of 4 spaces (editor setting???)
- clean up the code, it is hard to read, keep line length at 79 chars, use guideline for indentations and line spacing and others

Best regards, Walter
joaomgcd
Posts: 17
Joined: Tue Oct 02, 2012 9:42 pm

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by joaomgcd »

Walter, thank you very much for your response.

I agree, the code is not pretty. But in part the problem is that this was the first time I ever worked with python, and I didn't even know those basic rules you mentioned.
I'll clean up the code a bit and see if that solves it.

Thanks again!
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by krambriw »

Dear Joaomgcd,

I tried to search on the net a bit as well for the typical error and there where some findings related that indicated that importing of libraries could have an impact but I do not know. Also it might be that the class needs to be of a kind that matches eg but also here I am not sure. Maybe you can use the python shell from eg's help menu and browse the name space...also here I am not enough experienced.

I also tried to modify your code, making the class simpler but nothing helped so far...

If Pako reads this, I think he would be one of the very few that could give some advice.

Best regards, Walter
joaomgcd
Posts: 17
Joined: Tue Oct 02, 2012 9:42 pm

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by joaomgcd »

Thanks very much Walter. I really appreciate you helping!
Hope Pako sees this...
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by Pako »

I tried to look at it, but I can not.
My editor does not work with this file.
Please use 4 space characters instead of tab.
Then I'll be able to look at it.
However, I am not able to try it. I do not own any Android phone. I have only a Sony Ericsson K510i.

Pako
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by krambriw »

My Dear Pako, first of all a Happy New Year, I hope you had a good break with family and friends!

Once there is a new modified version available, I think it is possible to reproduce the error without an android (I will try and help as well)

My best regards, Walter
joaomgcd
Posts: 17
Joined: Tue Oct 02, 2012 9:42 pm

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by joaomgcd »

Thank you both very much for helping with this.
I will try and make a compatible version soon and link to a tutorial on how to get it working so you can easily reproduce the error.

Thanks again!
joaomgcd
Posts: 17
Joined: Tue Oct 02, 2012 9:42 pm

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by joaomgcd »

Ok, here's the updated file.
Hope this one is better. Forgive my pythonian ignorance. :oops:

Here's how to reproduce the error:

- Create a new EventGhost configuration
- Add the AutoRemote plugin
- Fill in "Device name" as fake
- Fill in "Device Personal URL" with http://goo.gl/BFbcy ; Press TAB
- Click the "Add" button
- Click "Ok"
- Save EventGhost configuration. There should be no errors
- Add any other plugin
- Save EventGhost configuration. The mentioned error should now appear in the log.
Attachments
__init__.py
(28.01 KiB) Downloaded 354 times
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by Pako »

Attached is a corrected version.

Pako
Attachments
__init__.py
(28.02 KiB) Downloaded 319 times
Post Reply